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

Side by Side Diff: webrtc/modules/audio_coding/neteq/neteq_external_decoder_unittest.cc

Issue 2021063002: NetEq decoder database: Don't keep track of sample rate for builtin decoders (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@decoder-samp-rate
Patch Set: explicit capture Created 4 years, 6 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) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 13 matching lines...) Expand all
24 namespace webrtc { 24 namespace webrtc {
25 25
26 using ::testing::_; 26 using ::testing::_;
27 using ::testing::Return; 27 using ::testing::Return;
28 28
29 class NetEqExternalDecoderUnitTest : public test::NetEqExternalDecoderTest { 29 class NetEqExternalDecoderUnitTest : public test::NetEqExternalDecoderTest {
30 protected: 30 protected:
31 static const int kFrameSizeMs = 10; // Frame size of Pcm16B. 31 static const int kFrameSizeMs = 10; // Frame size of Pcm16B.
32 32
33 NetEqExternalDecoderUnitTest(NetEqDecoder codec, 33 NetEqExternalDecoderUnitTest(NetEqDecoder codec,
34 int sample_rate_hz,
34 MockExternalPcm16B* decoder) 35 MockExternalPcm16B* decoder)
35 : NetEqExternalDecoderTest(codec, decoder), 36 : NetEqExternalDecoderTest(codec, sample_rate_hz, decoder),
36 external_decoder_(decoder), 37 external_decoder_(decoder),
37 samples_per_ms_(CodecSampleRateHz(codec) / 1000), 38 samples_per_ms_(sample_rate_hz / 1000),
38 frame_size_samples_(kFrameSizeMs * samples_per_ms_), 39 frame_size_samples_(kFrameSizeMs * samples_per_ms_),
39 rtp_generator_(new test::RtpGenerator(samples_per_ms_)), 40 rtp_generator_(new test::RtpGenerator(samples_per_ms_)),
40 input_(new int16_t[frame_size_samples_]), 41 input_(new int16_t[frame_size_samples_]),
41 // Payload should be no larger than input. 42 // Payload should be no larger than input.
42 encoded_(new uint8_t[2 * frame_size_samples_]), 43 encoded_(new uint8_t[2 * frame_size_samples_]),
43 payload_size_bytes_(0), 44 payload_size_bytes_(0),
44 last_send_time_(0), 45 last_send_time_(0),
45 last_arrival_time_(0) { 46 last_arrival_time_(0) {
46 // NetEq is not allowed to delete the external decoder (hence Times(0)). 47 // NetEq is not allowed to delete the external decoder (hence Times(0)).
47 EXPECT_CALL(*external_decoder_, Die()).Times(0); 48 EXPECT_CALL(*external_decoder_, Die()).Times(0);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 // the decoder object, while the second one uses an externally created decoder 167 // the decoder object, while the second one uses an externally created decoder
167 // object (ExternalPcm16B wrapped in MockExternalPcm16B, both defined above). 168 // object (ExternalPcm16B wrapped in MockExternalPcm16B, both defined above).
168 // The test verifies that the output from both instances match. 169 // The test verifies that the output from both instances match.
169 class NetEqExternalVsInternalDecoderTest : public NetEqExternalDecoderUnitTest, 170 class NetEqExternalVsInternalDecoderTest : public NetEqExternalDecoderUnitTest,
170 public ::testing::Test { 171 public ::testing::Test {
171 protected: 172 protected:
172 static const size_t kMaxBlockSize = 480; // 10 ms @ 48 kHz. 173 static const size_t kMaxBlockSize = 480; // 10 ms @ 48 kHz.
173 174
174 NetEqExternalVsInternalDecoderTest() 175 NetEqExternalVsInternalDecoderTest()
175 : NetEqExternalDecoderUnitTest(NetEqDecoder::kDecoderPCM16Bswb32kHz, 176 : NetEqExternalDecoderUnitTest(NetEqDecoder::kDecoderPCM16Bswb32kHz,
177 32000,
176 new MockExternalPcm16B), 178 new MockExternalPcm16B),
177 sample_rate_hz_( 179 sample_rate_hz_(32000) {
178 CodecSampleRateHz(NetEqDecoder::kDecoderPCM16Bswb32kHz)) {
179 NetEq::Config config; 180 NetEq::Config config;
180 config.sample_rate_hz = 181 config.sample_rate_hz = sample_rate_hz_;
181 CodecSampleRateHz(NetEqDecoder::kDecoderPCM16Bswb32kHz);
182 neteq_internal_.reset( 182 neteq_internal_.reset(
183 NetEq::Create(config, CreateBuiltinAudioDecoderFactory())); 183 NetEq::Create(config, CreateBuiltinAudioDecoderFactory()));
184 } 184 }
185 185
186 void SetUp() override { 186 void SetUp() override {
187 ASSERT_EQ(NetEq::kOK, neteq_internal_->RegisterPayloadType( 187 ASSERT_EQ(NetEq::kOK, neteq_internal_->RegisterPayloadType(
188 NetEqDecoder::kDecoderPCM16Bswb32kHz, 188 NetEqDecoder::kDecoderPCM16Bswb32kHz,
189 "pcm16-swb32", kPayloadType)); 189 "pcm16-swb32", kPayloadType));
190 } 190 }
191 191
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 enum TestStates { 240 enum TestStates {
241 kInitialPhase, 241 kInitialPhase,
242 kNormalPhase, 242 kNormalPhase,
243 kExpandPhase, 243 kExpandPhase,
244 kFadedExpandPhase, 244 kFadedExpandPhase,
245 kRecovered 245 kRecovered
246 }; 246 };
247 247
248 LargeTimestampJumpTest() 248 LargeTimestampJumpTest()
249 : NetEqExternalDecoderUnitTest(NetEqDecoder::kDecoderPCM16B, 249 : NetEqExternalDecoderUnitTest(NetEqDecoder::kDecoderPCM16B,
250 8000,
250 new MockExternalPcm16B), 251 new MockExternalPcm16B),
251 test_state_(kInitialPhase) { 252 test_state_(kInitialPhase) {
252 EXPECT_CALL(*external_decoder(), HasDecodePlc()) 253 EXPECT_CALL(*external_decoder(), HasDecodePlc())
253 .WillRepeatedly(Return(false)); 254 .WillRepeatedly(Return(false));
254 } 255 }
255 256
256 virtual void UpdateState(AudioFrame::SpeechType output_type) { 257 virtual void UpdateState(AudioFrame::SpeechType output_type) {
257 switch (test_state_) { 258 switch (test_state_) {
258 case kInitialPhase: { 259 case kInitialPhase: {
259 if (output_type == AudioFrame::kNormalSpeech) { 260 if (output_type == AudioFrame::kNormalSpeech) {
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 kStartSeqeunceNumber, 446 kStartSeqeunceNumber,
446 kStartTimestamp, 447 kStartTimestamp,
447 kJumpFromTimestamp, 448 kJumpFromTimestamp,
448 kJumpToTimestamp)); 449 kJumpToTimestamp));
449 450
450 RunTest(130); // Run 130 laps @ 10 ms each in the test loop. 451 RunTest(130); // Run 130 laps @ 10 ms each in the test loop.
451 EXPECT_EQ(kRecovered, test_state_); 452 EXPECT_EQ(kRecovered, test_state_);
452 } 453 }
453 454
454 } // namespace webrtc 455 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/neteq/mock/mock_audio_decoder.h ('k') | webrtc/modules/audio_coding/neteq/neteq_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698