OLD | NEW |
---|---|
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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
323 // Start with sending DTX. | 323 // Start with sending DTX. |
324 ASSERT_EQ(0, acm_->SetVAD(true, true, VADVeryAggr)); | 324 ASSERT_EQ(0, acm_->SetVAD(true, true, VADVeryAggr)); |
325 packet_sent_ = false; | 325 packet_sent_ = false; |
326 InsertOnePacketOfSilence(CodecIdInst(kCodecId[0]).id); // Enough to test | 326 InsertOnePacketOfSilence(CodecIdInst(kCodecId[0]).id); // Enough to test |
327 // with one codec. | 327 // with one codec. |
328 ASSERT_TRUE(packet_sent_); | 328 ASSERT_TRUE(packet_sent_); |
329 EXPECT_EQ(kAudioFrameCN, last_frame_type_); | 329 EXPECT_EQ(kAudioFrameCN, last_frame_type_); |
330 | 330 |
331 // Has received, only, DTX. Last Audio codec is undefined. | 331 // Has received, only, DTX. Last Audio codec is undefined. |
332 EXPECT_EQ(-1, receiver_->LastAudioCodec(&codec)); | 332 EXPECT_EQ(-1, receiver_->LastAudioCodec(&codec)); |
333 EXPECT_EQ(-1, receiver_->last_audio_codec_id()); | 333 EXPECT_FALSE(receiver_->last_packet_sample_rate_hz()); |
334 | 334 |
335 for (auto id : kCodecId) { | 335 for (auto id : kCodecId) { |
336 const CodecIdInst c(id); | 336 const CodecIdInst c(id); |
337 | 337 |
338 // Set DTX off to send audio payload. | 338 // Set DTX off to send audio payload. |
339 acm_->SetVAD(false, false, VADAggr); | 339 acm_->SetVAD(false, false, VADAggr); |
340 packet_sent_ = false; | 340 packet_sent_ = false; |
341 InsertOnePacketOfSilence(c.id); | 341 InsertOnePacketOfSilence(c.id); |
342 | 342 |
343 // Sanity check if Actually an audio payload received, and it should be | 343 // Sanity check if Actually an audio payload received, and it should be |
344 // of type "speech." | 344 // of type "speech." |
345 ASSERT_TRUE(packet_sent_); | 345 ASSERT_TRUE(packet_sent_); |
346 ASSERT_EQ(kAudioFrameSpeech, last_frame_type_); | 346 ASSERT_EQ(kAudioFrameSpeech, last_frame_type_); |
347 EXPECT_EQ(c.id, receiver_->last_audio_codec_id()); | 347 ASSERT_TRUE(receiver_->last_packet_sample_rate_hz()); |
348 EXPECT_EQ(c.inst.plfreq, *receiver_->last_packet_sample_rate_hz()); | |
kwiberg-webrtc
2015/11/23 13:03:50
Optional has an operator== function, so you should
hlundin-webrtc
2015/11/23 13:50:45
Acknowledged, but that won't give the same behavio
kwiberg-webrtc
2015/11/23 14:03:35
Well, no, what I suggested won't do exactly what y
hlundin-webrtc
2015/11/23 14:13:34
Right. I activated my brain now and realized that
| |
348 | 349 |
349 // Set VAD on to send DTX. Then check if the "Last Audio codec" returns | 350 // Set VAD on to send DTX. Then check if the "Last Audio codec" returns |
350 // the expected codec. | 351 // the expected codec. |
351 acm_->SetVAD(true, true, VADAggr); | 352 acm_->SetVAD(true, true, VADAggr); |
352 | 353 |
353 // Do as many encoding until a DTX is sent. | 354 // Do as many encoding until a DTX is sent. |
354 while (last_frame_type_ != kAudioFrameCN) { | 355 while (last_frame_type_ != kAudioFrameCN) { |
355 packet_sent_ = false; | 356 packet_sent_ = false; |
356 InsertOnePacketOfSilence(c.id); | 357 InsertOnePacketOfSilence(c.id); |
357 ASSERT_TRUE(packet_sent_); | 358 ASSERT_TRUE(packet_sent_); |
358 } | 359 } |
359 EXPECT_EQ(c.id, receiver_->last_audio_codec_id()); | 360 EXPECT_EQ(c.inst.plfreq, *receiver_->last_packet_sample_rate_hz()); |
kwiberg-webrtc
2015/11/23 13:03:50
Same.
hlundin-webrtc
2015/11/23 13:50:45
Will it make the code better?
EXPECT_EQ(rtc::Optio
kwiberg-webrtc
2015/11/23 14:03:35
In this case, arguably yes, since Optional's opera
hlundin-webrtc
2015/11/23 14:13:35
Done.
| |
360 EXPECT_EQ(0, receiver_->LastAudioCodec(&codec)); | 361 EXPECT_EQ(0, receiver_->LastAudioCodec(&codec)); |
361 EXPECT_TRUE(CodecsEqual(c.inst, codec)); | 362 EXPECT_TRUE(CodecsEqual(c.inst, codec)); |
362 } | 363 } |
363 } | 364 } |
364 | 365 |
365 } // namespace acm2 | 366 } // namespace acm2 |
366 | 367 |
367 } // namespace webrtc | 368 } // namespace webrtc |
OLD | NEW |