Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(180)

Side by Side Diff: webrtc/modules/audio_coding/codecs/legacy_encoded_audio_frame_unittest.cc

Issue 2342443005: Moved Opus-specific payload splitting into AudioDecoderOpus. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 // resulting frames can be checked and we can be reasonably certain no 111 // resulting frames can be checked and we can be reasonably certain no
112 // sample was missed or repeated. 112 // sample was missed or repeated.
113 rtc::Buffer payload(expected_split.payload_size_ms * bytes_per_ms_); 113 rtc::Buffer payload(expected_split.payload_size_ms * bytes_per_ms_);
114 uint8_t value = 0; 114 uint8_t value = 0;
115 // Allow wrap-around of value in counter below. 115 // Allow wrap-around of value in counter below.
116 for (size_t i = 0; i != payload.size(); ++i, ++value) { 116 for (size_t i = 0; i != payload.size(); ++i, ++value) {
117 payload[i] = value; 117 payload[i] = value;
118 } 118 }
119 119
120 auto results = LegacyEncodedAudioFrame::SplitBySamples( 120 auto results = LegacyEncodedAudioFrame::SplitBySamples(
121 nullptr, &payload, kBaseTimestamp, true, bytes_per_ms_, 121 nullptr, &payload, kBaseTimestamp, bytes_per_ms_, samples_per_ms_);
122 samples_per_ms_);
123 122
124 EXPECT_EQ(expected_split.num_frames, results.size()); 123 EXPECT_EQ(expected_split.num_frames, results.size());
125 uint32_t expected_timestamp = kBaseTimestamp; 124 uint32_t expected_timestamp = kBaseTimestamp;
126 uint32_t expected_byte_offset = 0; 125 uint32_t expected_byte_offset = 0;
127 value = 0; 126 value = 0;
128 for (size_t i = 0; i != expected_split.num_frames; ++i) { 127 for (size_t i = 0; i != expected_split.num_frames; ++i) {
129 const auto& result = results[i]; 128 const auto& result = results[i];
130 const LegacyEncodedAudioFrame* frame = 129 const LegacyEncodedAudioFrame* frame =
131 static_cast<const LegacyEncodedAudioFrame*>(result.frame.get()); 130 static_cast<const LegacyEncodedAudioFrame*>(result.frame.get());
132 const size_t length_bytes = expected_split.frame_sizes[i] * bytes_per_ms_; 131 const size_t length_bytes = expected_split.frame_sizes[i] * bytes_per_ms_;
(...skipping 23 matching lines...) Expand all
156 NetEqDecoder::kDecoderPCM16Bwb, 155 NetEqDecoder::kDecoderPCM16Bwb,
157 NetEqDecoder::kDecoderPCM16Bswb32kHz, 156 NetEqDecoder::kDecoderPCM16Bswb32kHz,
158 NetEqDecoder::kDecoderPCM16Bswb48kHz, 157 NetEqDecoder::kDecoderPCM16Bswb48kHz,
159 NetEqDecoder::kDecoderPCM16B_2ch, 158 NetEqDecoder::kDecoderPCM16B_2ch,
160 NetEqDecoder::kDecoderPCM16Bwb_2ch, 159 NetEqDecoder::kDecoderPCM16Bwb_2ch,
161 NetEqDecoder::kDecoderPCM16Bswb32kHz_2ch, 160 NetEqDecoder::kDecoderPCM16Bswb32kHz_2ch,
162 NetEqDecoder::kDecoderPCM16Bswb48kHz_2ch, 161 NetEqDecoder::kDecoderPCM16Bswb48kHz_2ch,
163 NetEqDecoder::kDecoderPCM16B_5ch)); 162 NetEqDecoder::kDecoderPCM16B_5ch));
164 163
165 } // namespace webrtc 164 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698