OLD | NEW |
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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 time_now = next_send_time = last_lost_time_ = | 194 time_now = next_send_time = last_lost_time_ = |
195 rtp_generator_->GetRtpHeader(kPayloadType, frame_size_samples_, | 195 rtp_generator_->GetRtpHeader(kPayloadType, frame_size_samples_, |
196 &rtp_header_); | 196 &rtp_header_); |
197 for (int k = 0; k < num_loops; ++k) { | 197 for (int k = 0; k < num_loops; ++k) { |
198 // Delay by one frame such that the FEC can come in. | 198 // Delay by one frame such that the FEC can come in. |
199 while (time_now + kFrameSizeMs >= next_send_time) { | 199 while (time_now + kFrameSizeMs >= next_send_time) { |
200 next_send_time = rtp_generator_->GetRtpHeader(kPayloadType, | 200 next_send_time = rtp_generator_->GetRtpHeader(kPayloadType, |
201 frame_size_samples_, | 201 frame_size_samples_, |
202 &rtp_header_); | 202 &rtp_header_); |
203 if (!Lost(next_send_time)) { | 203 if (!Lost(next_send_time)) { |
204 InsertPacket(rtp_header_, payload_, next_send_time); | 204 static const uint8_t payload[kPayloadSizeByte] = {0}; |
| 205 InsertPacket(rtp_header_, payload, next_send_time); |
205 } | 206 } |
206 } | 207 } |
207 GetOutputAudio(&output_frame_); | 208 GetOutputAudio(&output_frame_); |
208 time_now += kOutputLengthMs; | 209 time_now += kOutputLengthMs; |
209 } | 210 } |
210 CheckNetworkStatistics(expects); | 211 CheckNetworkStatistics(expects); |
211 neteq()->FlushBuffers(); | 212 neteq()->FlushBuffers(); |
212 } | 213 } |
213 | 214 |
214 void DecodeFecTest() { | 215 void DecodeFecTest() { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 } | 271 } |
271 | 272 |
272 private: | 273 private: |
273 MockAudioDecoder* external_decoder_; | 274 MockAudioDecoder* external_decoder_; |
274 const int samples_per_ms_; | 275 const int samples_per_ms_; |
275 const size_t frame_size_samples_; | 276 const size_t frame_size_samples_; |
276 std::unique_ptr<test::RtpGenerator> rtp_generator_; | 277 std::unique_ptr<test::RtpGenerator> rtp_generator_; |
277 WebRtcRTPHeader rtp_header_; | 278 WebRtcRTPHeader rtp_header_; |
278 uint32_t last_lost_time_; | 279 uint32_t last_lost_time_; |
279 uint32_t packet_loss_interval_; | 280 uint32_t packet_loss_interval_; |
280 uint8_t payload_[kPayloadSizeByte]; | |
281 AudioFrame output_frame_; | 281 AudioFrame output_frame_; |
282 }; | 282 }; |
283 | 283 |
284 TEST(NetEqNetworkStatsTest, DecodeFec) { | 284 TEST(NetEqNetworkStatsTest, DecodeFec) { |
285 MockAudioDecoder decoder(48000, 1); | 285 MockAudioDecoder decoder(48000, 1); |
286 NetEqNetworkStatsTest test(NetEqDecoder::kDecoderOpus, 48000, &decoder); | 286 NetEqNetworkStatsTest test(NetEqDecoder::kDecoderOpus, 48000, &decoder); |
287 test.DecodeFecTest(); | 287 test.DecodeFecTest(); |
288 EXPECT_CALL(decoder, Die()).Times(1); | 288 EXPECT_CALL(decoder, Die()).Times(1); |
289 } | 289 } |
290 | 290 |
291 TEST(NetEqNetworkStatsTest, StereoDecodeFec) { | 291 TEST(NetEqNetworkStatsTest, StereoDecodeFec) { |
292 MockAudioDecoder decoder(48000, 2); | 292 MockAudioDecoder decoder(48000, 2); |
293 NetEqNetworkStatsTest test(NetEqDecoder::kDecoderOpus, 48000, &decoder); | 293 NetEqNetworkStatsTest test(NetEqDecoder::kDecoderOpus, 48000, &decoder); |
294 test.DecodeFecTest(); | 294 test.DecodeFecTest(); |
295 EXPECT_CALL(decoder, Die()).Times(1); | 295 EXPECT_CALL(decoder, Die()).Times(1); |
296 } | 296 } |
297 | 297 |
298 TEST(NetEqNetworkStatsTest, NoiseExpansionTest) { | 298 TEST(NetEqNetworkStatsTest, NoiseExpansionTest) { |
299 MockAudioDecoder decoder(48000, 1); | 299 MockAudioDecoder decoder(48000, 1); |
300 NetEqNetworkStatsTest test(NetEqDecoder::kDecoderOpus, 48000, &decoder); | 300 NetEqNetworkStatsTest test(NetEqDecoder::kDecoderOpus, 48000, &decoder); |
301 test.NoiseExpansionTest(); | 301 test.NoiseExpansionTest(); |
302 EXPECT_CALL(decoder, Die()).Times(1); | 302 EXPECT_CALL(decoder, Die()).Times(1); |
303 } | 303 } |
304 | 304 |
305 } // namespace test | 305 } // namespace test |
306 } // namespace webrtc | 306 } // namespace webrtc |
OLD | NEW |