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

Side by Side Diff: webrtc/modules/audio_coding/neteq/neteq_network_stats_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) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 logic expand_rate; 106 logic expand_rate;
107 logic speech_expand_rate; 107 logic speech_expand_rate;
108 logic preemptive_rate; 108 logic preemptive_rate;
109 logic accelerate_rate; 109 logic accelerate_rate;
110 logic secondary_decoded_rate; 110 logic secondary_decoded_rate;
111 logic clockdrift_ppm; 111 logic clockdrift_ppm;
112 logic added_zero_samples; 112 logic added_zero_samples;
113 NetEqNetworkStatistics stats_ref; 113 NetEqNetworkStatistics stats_ref;
114 }; 114 };
115 115
116 NetEqNetworkStatsTest(NetEqDecoder codec, 116 NetEqNetworkStatsTest(NetEqDecoder codec,
117 MockAudioDecoder* decoder) 117 int sample_rate_hz,
118 : NetEqExternalDecoderTest(codec, decoder), 118 MockAudioDecoder* decoder)
119 external_decoder_(decoder), 119 : NetEqExternalDecoderTest(codec, sample_rate_hz, decoder),
120 samples_per_ms_(CodecSampleRateHz(codec) / 1000), 120 external_decoder_(decoder),
121 frame_size_samples_(kFrameSizeMs * samples_per_ms_), 121 samples_per_ms_(sample_rate_hz / 1000),
122 rtp_generator_(new test::RtpGenerator(samples_per_ms_)), 122 frame_size_samples_(kFrameSizeMs * samples_per_ms_),
123 last_lost_time_(0), 123 rtp_generator_(new test::RtpGenerator(samples_per_ms_)),
124 packet_loss_interval_(0xffffffff) { 124 last_lost_time_(0),
125 Init(); 125 packet_loss_interval_(0xffffffff) {
126 Init();
126 } 127 }
127 128
128 bool Lost(uint32_t send_time) { 129 bool Lost(uint32_t send_time) {
129 if (send_time - last_lost_time_ >= packet_loss_interval_) { 130 if (send_time - last_lost_time_ >= packet_loss_interval_) {
130 last_lost_time_ = send_time; 131 last_lost_time_ = send_time;
131 return true; 132 return true;
132 } 133 }
133 return false; 134 return false;
134 } 135 }
135 136
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 std::unique_ptr<test::RtpGenerator> rtp_generator_; 272 std::unique_ptr<test::RtpGenerator> rtp_generator_;
272 WebRtcRTPHeader rtp_header_; 273 WebRtcRTPHeader rtp_header_;
273 uint32_t last_lost_time_; 274 uint32_t last_lost_time_;
274 uint32_t packet_loss_interval_; 275 uint32_t packet_loss_interval_;
275 uint8_t payload_[kPayloadSizeByte]; 276 uint8_t payload_[kPayloadSizeByte];
276 AudioFrame output_frame_; 277 AudioFrame output_frame_;
277 }; 278 };
278 279
279 TEST(NetEqNetworkStatsTest, DecodeFec) { 280 TEST(NetEqNetworkStatsTest, DecodeFec) {
280 MockAudioDecoder decoder(1); 281 MockAudioDecoder decoder(1);
281 NetEqNetworkStatsTest test(NetEqDecoder::kDecoderOpus, &decoder); 282 NetEqNetworkStatsTest test(NetEqDecoder::kDecoderOpus, 48000, &decoder);
282 test.DecodeFecTest(); 283 test.DecodeFecTest();
283 EXPECT_CALL(decoder, Die()).Times(1); 284 EXPECT_CALL(decoder, Die()).Times(1);
284 } 285 }
285 286
286 TEST(NetEqNetworkStatsTest, StereoDecodeFec) { 287 TEST(NetEqNetworkStatsTest, StereoDecodeFec) {
287 MockAudioDecoder decoder(2); 288 MockAudioDecoder decoder(2);
288 NetEqNetworkStatsTest test(NetEqDecoder::kDecoderOpus, &decoder); 289 NetEqNetworkStatsTest test(NetEqDecoder::kDecoderOpus, 48000, &decoder);
289 test.DecodeFecTest(); 290 test.DecodeFecTest();
290 EXPECT_CALL(decoder, Die()).Times(1); 291 EXPECT_CALL(decoder, Die()).Times(1);
291 } 292 }
292 293
293 TEST(NetEqNetworkStatsTest, NoiseExpansionTest) { 294 TEST(NetEqNetworkStatsTest, NoiseExpansionTest) {
294 MockAudioDecoder decoder(1); 295 MockAudioDecoder decoder(1);
295 NetEqNetworkStatsTest test(NetEqDecoder::kDecoderOpus, &decoder); 296 NetEqNetworkStatsTest test(NetEqDecoder::kDecoderOpus, 48000, &decoder);
296 test.NoiseExpansionTest(); 297 test.NoiseExpansionTest();
297 EXPECT_CALL(decoder, Die()).Times(1); 298 EXPECT_CALL(decoder, Die()).Times(1);
298 } 299 }
299 300
300 } // namespace test 301 } // namespace test
301 } // namespace webrtc 302 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698