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

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

Issue 2807273004: Change NetEq::InsertPacket to take an RTPHeader (Closed)
Patch Set: git cl format Created 3 years, 8 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) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 void NetEqDecodingTest::Process() { 317 void NetEqDecodingTest::Process() {
318 // Check if time to receive. 318 // Check if time to receive.
319 while (packet_ && sim_clock_ >= packet_->time_ms()) { 319 while (packet_ && sim_clock_ >= packet_->time_ms()) {
320 if (packet_->payload_length_bytes() > 0) { 320 if (packet_->payload_length_bytes() > 0) {
321 WebRtcRTPHeader rtp_header; 321 WebRtcRTPHeader rtp_header;
322 packet_->ConvertHeader(&rtp_header); 322 packet_->ConvertHeader(&rtp_header);
323 #ifndef WEBRTC_CODEC_ISAC 323 #ifndef WEBRTC_CODEC_ISAC
324 // Ignore payload type 104 (iSAC-swb) if ISAC is not supported. 324 // Ignore payload type 104 (iSAC-swb) if ISAC is not supported.
325 if (rtp_header.header.payloadType != 104) 325 if (rtp_header.header.payloadType != 104)
326 #endif 326 #endif
327 ASSERT_EQ(0, neteq_->InsertPacket( 327 ASSERT_EQ(0,
328 rtp_header, 328 neteq_->InsertPacket(
329 rtc::ArrayView<const uint8_t>( 329 rtp_header.header,
330 packet_->payload(), packet_->payload_length_bytes()), 330 rtc::ArrayView<const uint8_t>(
331 static_cast<uint32_t>(packet_->time_ms() * 331 packet_->payload(), packet_->payload_length_bytes()),
332 (output_sample_rate_ / 1000)))); 332 static_cast<uint32_t>(packet_->time_ms() *
333 (output_sample_rate_ / 1000))));
333 } 334 }
334 // Get next packet. 335 // Get next packet.
335 packet_ = rtp_source_->NextPacket(); 336 packet_ = rtp_source_->NextPacket();
336 } 337 }
337 338
338 // Get audio from NetEq. 339 // Get audio from NetEq.
339 bool muted; 340 bool muted;
340 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted)); 341 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted));
341 ASSERT_FALSE(muted); 342 ASSERT_FALSE(muted);
342 ASSERT_TRUE((out_frame_.samples_per_channel_ == kBlockSize8kHz) || 343 ASSERT_TRUE((out_frame_.samples_per_channel_ == kBlockSize8kHz) ||
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 const size_t kSamples = 10 * 16; 520 const size_t kSamples = 10 * 16;
520 const size_t kPayloadBytes = kSamples * 2; 521 const size_t kPayloadBytes = kSamples * 2;
521 for (size_t i = 0; i < num_frames; ++i) { 522 for (size_t i = 0; i < num_frames; ++i) {
522 const uint8_t payload[kPayloadBytes] = {0}; 523 const uint8_t payload[kPayloadBytes] = {0};
523 WebRtcRTPHeader rtp_info; 524 WebRtcRTPHeader rtp_info;
524 rtp_info.header.sequenceNumber = i; 525 rtp_info.header.sequenceNumber = i;
525 rtp_info.header.timestamp = i * kSamples; 526 rtp_info.header.timestamp = i * kSamples;
526 rtp_info.header.ssrc = 0x1234; // Just an arbitrary SSRC. 527 rtp_info.header.ssrc = 0x1234; // Just an arbitrary SSRC.
527 rtp_info.header.payloadType = 94; // PCM16b WB codec. 528 rtp_info.header.payloadType = 94; // PCM16b WB codec.
528 rtp_info.header.markerBit = 0; 529 rtp_info.header.markerBit = 0;
529 ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0)); 530 ASSERT_EQ(0, neteq_->InsertPacket(rtp_info.header, payload, 0));
530 } 531 }
531 // Pull out all data. 532 // Pull out all data.
532 for (size_t i = 0; i < num_frames; ++i) { 533 for (size_t i = 0; i < num_frames; ++i) {
533 bool muted; 534 bool muted;
534 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted)); 535 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted));
535 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_); 536 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_);
536 } 537 }
537 538
538 NetEqNetworkStatistics stats; 539 NetEqNetworkStatistics stats;
539 EXPECT_EQ(0, neteq_->NetworkStatistics(&stats)); 540 EXPECT_EQ(0, neteq_->NetworkStatistics(&stats));
(...skipping 20 matching lines...) Expand all
560 const size_t kSamples = 10 * 16; 561 const size_t kSamples = 10 * 16;
561 const size_t kPayloadBytes = kSamples * 2; 562 const size_t kPayloadBytes = kSamples * 2;
562 while (frame_index < kNumFrames) { 563 while (frame_index < kNumFrames) {
563 // Insert one packet each time, except every 10th time where we insert two 564 // Insert one packet each time, except every 10th time where we insert two
564 // packets at once. This will create a negative clock-drift of approx. 10%. 565 // packets at once. This will create a negative clock-drift of approx. 10%.
565 int num_packets = (frame_index % 10 == 0 ? 2 : 1); 566 int num_packets = (frame_index % 10 == 0 ? 2 : 1);
566 for (int n = 0; n < num_packets; ++n) { 567 for (int n = 0; n < num_packets; ++n) {
567 uint8_t payload[kPayloadBytes] = {0}; 568 uint8_t payload[kPayloadBytes] = {0};
568 WebRtcRTPHeader rtp_info; 569 WebRtcRTPHeader rtp_info;
569 PopulateRtpInfo(frame_index, frame_index * kSamples, &rtp_info); 570 PopulateRtpInfo(frame_index, frame_index * kSamples, &rtp_info);
570 ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0)); 571 ASSERT_EQ(0, neteq_->InsertPacket(rtp_info.header, payload, 0));
571 ++frame_index; 572 ++frame_index;
572 } 573 }
573 574
574 // Pull out data once. 575 // Pull out data once.
575 bool muted; 576 bool muted;
576 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted)); 577 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted));
577 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_); 578 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_);
578 } 579 }
579 580
580 NetEqNetworkStatistics network_stats; 581 NetEqNetworkStatistics network_stats;
581 ASSERT_EQ(0, neteq_->NetworkStatistics(&network_stats)); 582 ASSERT_EQ(0, neteq_->NetworkStatistics(&network_stats));
582 EXPECT_EQ(-103192, network_stats.clockdrift_ppm); 583 EXPECT_EQ(-103192, network_stats.clockdrift_ppm);
583 } 584 }
584 585
585 TEST_F(NetEqDecodingTest, TestAverageInterArrivalTimePositive) { 586 TEST_F(NetEqDecodingTest, TestAverageInterArrivalTimePositive) {
586 const int kNumFrames = 5000; // Needed for convergence. 587 const int kNumFrames = 5000; // Needed for convergence.
587 int frame_index = 0; 588 int frame_index = 0;
588 const size_t kSamples = 10 * 16; 589 const size_t kSamples = 10 * 16;
589 const size_t kPayloadBytes = kSamples * 2; 590 const size_t kPayloadBytes = kSamples * 2;
590 for (int i = 0; i < kNumFrames; ++i) { 591 for (int i = 0; i < kNumFrames; ++i) {
591 // Insert one packet each time, except every 10th time where we don't insert 592 // Insert one packet each time, except every 10th time where we don't insert
592 // any packet. This will create a positive clock-drift of approx. 11%. 593 // any packet. This will create a positive clock-drift of approx. 11%.
593 int num_packets = (i % 10 == 9 ? 0 : 1); 594 int num_packets = (i % 10 == 9 ? 0 : 1);
594 for (int n = 0; n < num_packets; ++n) { 595 for (int n = 0; n < num_packets; ++n) {
595 uint8_t payload[kPayloadBytes] = {0}; 596 uint8_t payload[kPayloadBytes] = {0};
596 WebRtcRTPHeader rtp_info; 597 WebRtcRTPHeader rtp_info;
597 PopulateRtpInfo(frame_index, frame_index * kSamples, &rtp_info); 598 PopulateRtpInfo(frame_index, frame_index * kSamples, &rtp_info);
598 ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0)); 599 ASSERT_EQ(0, neteq_->InsertPacket(rtp_info.header, payload, 0));
599 ++frame_index; 600 ++frame_index;
600 } 601 }
601 602
602 // Pull out data once. 603 // Pull out data once.
603 bool muted; 604 bool muted;
604 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted)); 605 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted));
605 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_); 606 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_);
606 } 607 }
607 608
608 NetEqNetworkStatistics network_stats; 609 NetEqNetworkStatistics network_stats;
(...skipping 17 matching lines...) Expand all
626 627
627 // Insert speech for 5 seconds. 628 // Insert speech for 5 seconds.
628 const int kSpeechDurationMs = 5000; 629 const int kSpeechDurationMs = 5000;
629 for (t_ms = 0; t_ms < kSpeechDurationMs; t_ms += 10) { 630 for (t_ms = 0; t_ms < kSpeechDurationMs; t_ms += 10) {
630 // Each turn in this for loop is 10 ms. 631 // Each turn in this for loop is 10 ms.
631 while (next_input_time_ms <= t_ms) { 632 while (next_input_time_ms <= t_ms) {
632 // Insert one 30 ms speech frame. 633 // Insert one 30 ms speech frame.
633 uint8_t payload[kPayloadBytes] = {0}; 634 uint8_t payload[kPayloadBytes] = {0};
634 WebRtcRTPHeader rtp_info; 635 WebRtcRTPHeader rtp_info;
635 PopulateRtpInfo(seq_no, timestamp, &rtp_info); 636 PopulateRtpInfo(seq_no, timestamp, &rtp_info);
636 ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0)); 637 ASSERT_EQ(0, neteq_->InsertPacket(rtp_info.header, payload, 0));
637 ++seq_no; 638 ++seq_no;
638 timestamp += kSamples; 639 timestamp += kSamples;
639 next_input_time_ms += static_cast<double>(kFrameSizeMs) * drift_factor; 640 next_input_time_ms += static_cast<double>(kFrameSizeMs) * drift_factor;
640 } 641 }
641 // Pull out data once. 642 // Pull out data once.
642 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted)); 643 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted));
643 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_); 644 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_);
644 } 645 }
645 646
646 EXPECT_EQ(AudioFrame::kNormalSpeech, out_frame_.speech_type_); 647 EXPECT_EQ(AudioFrame::kNormalSpeech, out_frame_.speech_type_);
647 rtc::Optional<uint32_t> playout_timestamp = PlayoutTimestamp(); 648 rtc::Optional<uint32_t> playout_timestamp = PlayoutTimestamp();
648 ASSERT_TRUE(playout_timestamp); 649 ASSERT_TRUE(playout_timestamp);
649 int32_t delay_before = timestamp - *playout_timestamp; 650 int32_t delay_before = timestamp - *playout_timestamp;
650 651
651 // Insert CNG for 1 minute (= 60000 ms). 652 // Insert CNG for 1 minute (= 60000 ms).
652 const int kCngPeriodMs = 100; 653 const int kCngPeriodMs = 100;
653 const int kCngPeriodSamples = kCngPeriodMs * 16; // Period in 16 kHz samples. 654 const int kCngPeriodSamples = kCngPeriodMs * 16; // Period in 16 kHz samples.
654 const int kCngDurationMs = 60000; 655 const int kCngDurationMs = 60000;
655 for (; t_ms < kSpeechDurationMs + kCngDurationMs; t_ms += 10) { 656 for (; t_ms < kSpeechDurationMs + kCngDurationMs; t_ms += 10) {
656 // Each turn in this for loop is 10 ms. 657 // Each turn in this for loop is 10 ms.
657 while (next_input_time_ms <= t_ms) { 658 while (next_input_time_ms <= t_ms) {
658 // Insert one CNG frame each 100 ms. 659 // Insert one CNG frame each 100 ms.
659 uint8_t payload[kPayloadBytes]; 660 uint8_t payload[kPayloadBytes];
660 size_t payload_len; 661 size_t payload_len;
661 WebRtcRTPHeader rtp_info; 662 WebRtcRTPHeader rtp_info;
662 PopulateCng(seq_no, timestamp, &rtp_info, payload, &payload_len); 663 PopulateCng(seq_no, timestamp, &rtp_info, payload, &payload_len);
663 ASSERT_EQ(0, neteq_->InsertPacket( 664 ASSERT_EQ(0, neteq_->InsertPacket(
664 rtp_info, 665 rtp_info.header,
665 rtc::ArrayView<const uint8_t>(payload, payload_len), 0)); 666 rtc::ArrayView<const uint8_t>(payload, payload_len), 0));
666 ++seq_no; 667 ++seq_no;
667 timestamp += kCngPeriodSamples; 668 timestamp += kCngPeriodSamples;
668 next_input_time_ms += static_cast<double>(kCngPeriodMs) * drift_factor; 669 next_input_time_ms += static_cast<double>(kCngPeriodMs) * drift_factor;
669 } 670 }
670 // Pull out data once. 671 // Pull out data once.
671 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted)); 672 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted));
672 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_); 673 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_);
673 } 674 }
674 675
(...skipping 22 matching lines...) Expand all
697 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_); 698 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_);
698 EXPECT_EQ(AudioFrame::kCNG, out_frame_.speech_type_); 699 EXPECT_EQ(AudioFrame::kCNG, out_frame_.speech_type_);
699 t_ms += 10; 700 t_ms += 10;
700 } 701 }
701 // Insert one CNG frame each 100 ms. 702 // Insert one CNG frame each 100 ms.
702 uint8_t payload[kPayloadBytes]; 703 uint8_t payload[kPayloadBytes];
703 size_t payload_len; 704 size_t payload_len;
704 WebRtcRTPHeader rtp_info; 705 WebRtcRTPHeader rtp_info;
705 PopulateCng(seq_no, timestamp, &rtp_info, payload, &payload_len); 706 PopulateCng(seq_no, timestamp, &rtp_info, payload, &payload_len);
706 ASSERT_EQ(0, neteq_->InsertPacket( 707 ASSERT_EQ(0, neteq_->InsertPacket(
707 rtp_info, 708 rtp_info.header,
708 rtc::ArrayView<const uint8_t>(payload, payload_len), 0)); 709 rtc::ArrayView<const uint8_t>(payload, payload_len), 0));
709 ++seq_no; 710 ++seq_no;
710 timestamp += kCngPeriodSamples; 711 timestamp += kCngPeriodSamples;
711 next_input_time_ms += kCngPeriodMs * drift_factor; 712 next_input_time_ms += kCngPeriodMs * drift_factor;
712 } 713 }
713 } 714 }
714 715
715 // Insert speech again until output type is speech. 716 // Insert speech again until output type is speech.
716 double speech_restart_time_ms = t_ms; 717 double speech_restart_time_ms = t_ms;
717 while (out_frame_.speech_type_ != AudioFrame::kNormalSpeech) { 718 while (out_frame_.speech_type_ != AudioFrame::kNormalSpeech) {
718 // Each turn in this for loop is 10 ms. 719 // Each turn in this for loop is 10 ms.
719 while (next_input_time_ms <= t_ms) { 720 while (next_input_time_ms <= t_ms) {
720 // Insert one 30 ms speech frame. 721 // Insert one 30 ms speech frame.
721 uint8_t payload[kPayloadBytes] = {0}; 722 uint8_t payload[kPayloadBytes] = {0};
722 WebRtcRTPHeader rtp_info; 723 WebRtcRTPHeader rtp_info;
723 PopulateRtpInfo(seq_no, timestamp, &rtp_info); 724 PopulateRtpInfo(seq_no, timestamp, &rtp_info);
724 ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0)); 725 ASSERT_EQ(0, neteq_->InsertPacket(rtp_info.header, payload, 0));
725 ++seq_no; 726 ++seq_no;
726 timestamp += kSamples; 727 timestamp += kSamples;
727 next_input_time_ms += kFrameSizeMs * drift_factor; 728 next_input_time_ms += kFrameSizeMs * drift_factor;
728 } 729 }
729 // Pull out data once. 730 // Pull out data once.
730 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted)); 731 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted));
731 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_); 732 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_);
732 // Increase clock. 733 // Increase clock.
733 t_ms += 10; 734 t_ms += 10;
734 } 735 }
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 kDelayToleranceMs, 827 kDelayToleranceMs,
827 kMaxTimeToSpeechMs); 828 kMaxTimeToSpeechMs);
828 } 829 }
829 830
830 TEST_F(NetEqDecodingTest, UnknownPayloadType) { 831 TEST_F(NetEqDecodingTest, UnknownPayloadType) {
831 const size_t kPayloadBytes = 100; 832 const size_t kPayloadBytes = 100;
832 uint8_t payload[kPayloadBytes] = {0}; 833 uint8_t payload[kPayloadBytes] = {0};
833 WebRtcRTPHeader rtp_info; 834 WebRtcRTPHeader rtp_info;
834 PopulateRtpInfo(0, 0, &rtp_info); 835 PopulateRtpInfo(0, 0, &rtp_info);
835 rtp_info.header.payloadType = 1; // Not registered as a decoder. 836 rtp_info.header.payloadType = 1; // Not registered as a decoder.
836 EXPECT_EQ(NetEq::kFail, neteq_->InsertPacket(rtp_info, payload, 0)); 837 EXPECT_EQ(NetEq::kFail, neteq_->InsertPacket(rtp_info.header, payload, 0));
837 EXPECT_EQ(NetEq::kUnknownRtpPayloadType, neteq_->LastError()); 838 EXPECT_EQ(NetEq::kUnknownRtpPayloadType, neteq_->LastError());
838 } 839 }
839 840
840 #if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX) 841 #if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)
841 #define MAYBE_DecoderError DecoderError 842 #define MAYBE_DecoderError DecoderError
842 #else 843 #else
843 #define MAYBE_DecoderError DISABLED_DecoderError 844 #define MAYBE_DecoderError DISABLED_DecoderError
844 #endif 845 #endif
845 846
846 TEST_F(NetEqDecodingTest, MAYBE_DecoderError) { 847 TEST_F(NetEqDecodingTest, MAYBE_DecoderError) {
847 const size_t kPayloadBytes = 100; 848 const size_t kPayloadBytes = 100;
848 uint8_t payload[kPayloadBytes] = {0}; 849 uint8_t payload[kPayloadBytes] = {0};
849 WebRtcRTPHeader rtp_info; 850 WebRtcRTPHeader rtp_info;
850 PopulateRtpInfo(0, 0, &rtp_info); 851 PopulateRtpInfo(0, 0, &rtp_info);
851 rtp_info.header.payloadType = 103; // iSAC, but the payload is invalid. 852 rtp_info.header.payloadType = 103; // iSAC, but the payload is invalid.
852 EXPECT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0)); 853 EXPECT_EQ(0, neteq_->InsertPacket(rtp_info.header, payload, 0));
853 // Set all of |out_data_| to 1, and verify that it was set to 0 by the call 854 // Set all of |out_data_| to 1, and verify that it was set to 0 by the call
854 // to GetAudio. 855 // to GetAudio.
855 for (size_t i = 0; i < AudioFrame::kMaxDataSizeSamples; ++i) { 856 for (size_t i = 0; i < AudioFrame::kMaxDataSizeSamples; ++i) {
856 out_frame_.data_[i] = 1; 857 out_frame_.data_[i] = 1;
857 } 858 }
858 bool muted; 859 bool muted;
859 EXPECT_EQ(NetEq::kFail, neteq_->GetAudio(&out_frame_, &muted)); 860 EXPECT_EQ(NetEq::kFail, neteq_->GetAudio(&out_frame_, &muted));
860 ASSERT_FALSE(muted); 861 ASSERT_FALSE(muted);
861 // Verify that there is a decoder error to check. 862 // Verify that there is a decoder error to check.
862 EXPECT_EQ(NetEq::kDecoderErrorCode, neteq_->LastError()); 863 EXPECT_EQ(NetEq::kDecoderErrorCode, neteq_->LastError());
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
949 950
950 uint32_t receive_timestamp = 0; 951 uint32_t receive_timestamp = 0;
951 bool muted; 952 bool muted;
952 for (int n = 0; n < 10; ++n) { // Insert few packets and get audio. 953 for (int n = 0; n < 10; ++n) { // Insert few packets and get audio.
953 auto block = input.GetNextBlock(); 954 auto block = input.GetNextBlock();
954 ASSERT_EQ(expected_samples_per_channel, block.size()); 955 ASSERT_EQ(expected_samples_per_channel, block.size());
955 size_t enc_len_bytes = 956 size_t enc_len_bytes =
956 WebRtcPcm16b_Encode(block.data(), block.size(), payload); 957 WebRtcPcm16b_Encode(block.data(), block.size(), payload);
957 ASSERT_EQ(enc_len_bytes, expected_samples_per_channel * 2); 958 ASSERT_EQ(enc_len_bytes, expected_samples_per_channel * 2);
958 959
959 ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, rtc::ArrayView<const uint8_t>( 960 ASSERT_EQ(0, neteq_->InsertPacket(
960 payload, enc_len_bytes), 961 rtp_info.header,
961 receive_timestamp)); 962 rtc::ArrayView<const uint8_t>(payload, enc_len_bytes),
963 receive_timestamp));
962 output.Reset(); 964 output.Reset();
963 ASSERT_EQ(0, neteq_->GetAudio(&output, &muted)); 965 ASSERT_EQ(0, neteq_->GetAudio(&output, &muted));
964 ASSERT_EQ(1u, output.num_channels_); 966 ASSERT_EQ(1u, output.num_channels_);
965 ASSERT_EQ(expected_samples_per_channel, output.samples_per_channel_); 967 ASSERT_EQ(expected_samples_per_channel, output.samples_per_channel_);
966 ASSERT_EQ(AudioFrame::kNormalSpeech, output.speech_type_); 968 ASSERT_EQ(AudioFrame::kNormalSpeech, output.speech_type_);
967 969
968 // Next packet. 970 // Next packet.
969 rtp_info.header.timestamp += expected_samples_per_channel; 971 rtp_info.header.timestamp += expected_samples_per_channel;
970 rtp_info.header.sequenceNumber++; 972 rtp_info.header.sequenceNumber++;
971 receive_timestamp += expected_samples_per_channel; 973 receive_timestamp += expected_samples_per_channel;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1085 bool seq_no_wrapped = false; 1087 bool seq_no_wrapped = false;
1086 for (double t_ms = 0; t_ms < kSpeechDurationMs; t_ms += 10) { 1088 for (double t_ms = 0; t_ms < kSpeechDurationMs; t_ms += 10) {
1087 // Each turn in this for loop is 10 ms. 1089 // Each turn in this for loop is 10 ms.
1088 while (next_input_time_ms <= t_ms) { 1090 while (next_input_time_ms <= t_ms) {
1089 // Insert one 30 ms speech frame. 1091 // Insert one 30 ms speech frame.
1090 uint8_t payload[kPayloadBytes] = {0}; 1092 uint8_t payload[kPayloadBytes] = {0};
1091 WebRtcRTPHeader rtp_info; 1093 WebRtcRTPHeader rtp_info;
1092 PopulateRtpInfo(seq_no, timestamp, &rtp_info); 1094 PopulateRtpInfo(seq_no, timestamp, &rtp_info);
1093 if (drop_seq_numbers.find(seq_no) == drop_seq_numbers.end()) { 1095 if (drop_seq_numbers.find(seq_no) == drop_seq_numbers.end()) {
1094 // This sequence number was not in the set to drop. Insert it. 1096 // This sequence number was not in the set to drop. Insert it.
1095 ASSERT_EQ(0, 1097 ASSERT_EQ(0, neteq_->InsertPacket(rtp_info.header, payload,
1096 neteq_->InsertPacket(rtp_info, payload, receive_timestamp)); 1098 receive_timestamp));
1097 ++packets_inserted; 1099 ++packets_inserted;
1098 } 1100 }
1099 NetEqNetworkStatistics network_stats; 1101 NetEqNetworkStatistics network_stats;
1100 ASSERT_EQ(0, neteq_->NetworkStatistics(&network_stats)); 1102 ASSERT_EQ(0, neteq_->NetworkStatistics(&network_stats));
1101 1103
1102 // Due to internal NetEq logic, preferred buffer-size is about 4 times the 1104 // Due to internal NetEq logic, preferred buffer-size is about 4 times the
1103 // packet size for first few packets. Therefore we refrain from checking 1105 // packet size for first few packets. Therefore we refrain from checking
1104 // the criteria. 1106 // the criteria.
1105 if (packets_inserted > 4) { 1107 if (packets_inserted > 4) {
1106 // Expect preferred and actual buffer size to be no more than 2 frames. 1108 // Expect preferred and actual buffer size to be no more than 2 frames.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1174 1176
1175 const int algorithmic_delay_samples = std::max( 1177 const int algorithmic_delay_samples = std::max(
1176 algorithmic_delay_ms_ * kSampleRateKhz, 5 * kSampleRateKhz / 8); 1178 algorithmic_delay_ms_ * kSampleRateKhz, 5 * kSampleRateKhz / 8);
1177 // Insert three speech packets. Three are needed to get the frame length 1179 // Insert three speech packets. Three are needed to get the frame length
1178 // correct. 1180 // correct.
1179 uint8_t payload[kPayloadBytes] = {0}; 1181 uint8_t payload[kPayloadBytes] = {0};
1180 WebRtcRTPHeader rtp_info; 1182 WebRtcRTPHeader rtp_info;
1181 bool muted; 1183 bool muted;
1182 for (int i = 0; i < 3; ++i) { 1184 for (int i = 0; i < 3; ++i) {
1183 PopulateRtpInfo(seq_no, timestamp, &rtp_info); 1185 PopulateRtpInfo(seq_no, timestamp, &rtp_info);
1184 ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0)); 1186 ASSERT_EQ(0, neteq_->InsertPacket(rtp_info.header, payload, 0));
1185 ++seq_no; 1187 ++seq_no;
1186 timestamp += kSamples; 1188 timestamp += kSamples;
1187 1189
1188 // Pull audio once. 1190 // Pull audio once.
1189 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted)); 1191 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted));
1190 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_); 1192 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_);
1191 } 1193 }
1192 // Verify speech output. 1194 // Verify speech output.
1193 EXPECT_EQ(AudioFrame::kNormalSpeech, out_frame_.speech_type_); 1195 EXPECT_EQ(AudioFrame::kNormalSpeech, out_frame_.speech_type_);
1194 1196
1195 // Insert same CNG packet twice. 1197 // Insert same CNG packet twice.
1196 const int kCngPeriodMs = 100; 1198 const int kCngPeriodMs = 100;
1197 const int kCngPeriodSamples = kCngPeriodMs * kSampleRateKhz; 1199 const int kCngPeriodSamples = kCngPeriodMs * kSampleRateKhz;
1198 size_t payload_len; 1200 size_t payload_len;
1199 PopulateCng(seq_no, timestamp, &rtp_info, payload, &payload_len); 1201 PopulateCng(seq_no, timestamp, &rtp_info, payload, &payload_len);
1200 // This is the first time this CNG packet is inserted. 1202 // This is the first time this CNG packet is inserted.
1201 ASSERT_EQ( 1203 ASSERT_EQ(0, neteq_->InsertPacket(
1202 0, neteq_->InsertPacket( 1204 rtp_info.header,
1203 rtp_info, rtc::ArrayView<const uint8_t>(payload, payload_len), 0)); 1205 rtc::ArrayView<const uint8_t>(payload, payload_len), 0));
1204 1206
1205 // Pull audio once and make sure CNG is played. 1207 // Pull audio once and make sure CNG is played.
1206 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted)); 1208 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted));
1207 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_); 1209 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_);
1208 EXPECT_EQ(AudioFrame::kCNG, out_frame_.speech_type_); 1210 EXPECT_EQ(AudioFrame::kCNG, out_frame_.speech_type_);
1209 EXPECT_FALSE(PlayoutTimestamp()); // Returns empty value during CNG. 1211 EXPECT_FALSE(PlayoutTimestamp()); // Returns empty value during CNG.
1210 EXPECT_EQ(timestamp - algorithmic_delay_samples, 1212 EXPECT_EQ(timestamp - algorithmic_delay_samples,
1211 out_frame_.timestamp_ + out_frame_.samples_per_channel_); 1213 out_frame_.timestamp_ + out_frame_.samples_per_channel_);
1212 1214
1213 // Insert the same CNG packet again. Note that at this point it is old, since 1215 // Insert the same CNG packet again. Note that at this point it is old, since
1214 // we have already decoded the first copy of it. 1216 // we have already decoded the first copy of it.
1215 ASSERT_EQ( 1217 ASSERT_EQ(0, neteq_->InsertPacket(
1216 0, neteq_->InsertPacket( 1218 rtp_info.header,
1217 rtp_info, rtc::ArrayView<const uint8_t>(payload, payload_len), 0)); 1219 rtc::ArrayView<const uint8_t>(payload, payload_len), 0));
1218 1220
1219 // Pull audio until we have played |kCngPeriodMs| of CNG. Start at 10 ms since 1221 // Pull audio until we have played |kCngPeriodMs| of CNG. Start at 10 ms since
1220 // we have already pulled out CNG once. 1222 // we have already pulled out CNG once.
1221 for (int cng_time_ms = 10; cng_time_ms < kCngPeriodMs; cng_time_ms += 10) { 1223 for (int cng_time_ms = 10; cng_time_ms < kCngPeriodMs; cng_time_ms += 10) {
1222 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted)); 1224 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted));
1223 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_); 1225 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_);
1224 EXPECT_EQ(AudioFrame::kCNG, out_frame_.speech_type_); 1226 EXPECT_EQ(AudioFrame::kCNG, out_frame_.speech_type_);
1225 EXPECT_FALSE(PlayoutTimestamp()); // Returns empty value during CNG. 1227 EXPECT_FALSE(PlayoutTimestamp()); // Returns empty value during CNG.
1226 EXPECT_EQ(timestamp - algorithmic_delay_samples, 1228 EXPECT_EQ(timestamp - algorithmic_delay_samples,
1227 out_frame_.timestamp_ + out_frame_.samples_per_channel_); 1229 out_frame_.timestamp_ + out_frame_.samples_per_channel_);
1228 } 1230 }
1229 1231
1230 // Insert speech again. 1232 // Insert speech again.
1231 ++seq_no; 1233 ++seq_no;
1232 timestamp += kCngPeriodSamples; 1234 timestamp += kCngPeriodSamples;
1233 PopulateRtpInfo(seq_no, timestamp, &rtp_info); 1235 PopulateRtpInfo(seq_no, timestamp, &rtp_info);
1234 ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0)); 1236 ASSERT_EQ(0, neteq_->InsertPacket(rtp_info.header, payload, 0));
1235 1237
1236 // Pull audio once and verify that the output is speech again. 1238 // Pull audio once and verify that the output is speech again.
1237 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted)); 1239 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted));
1238 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_); 1240 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_);
1239 EXPECT_EQ(AudioFrame::kNormalSpeech, out_frame_.speech_type_); 1241 EXPECT_EQ(AudioFrame::kNormalSpeech, out_frame_.speech_type_);
1240 rtc::Optional<uint32_t> playout_timestamp = PlayoutTimestamp(); 1242 rtc::Optional<uint32_t> playout_timestamp = PlayoutTimestamp();
1241 ASSERT_TRUE(playout_timestamp); 1243 ASSERT_TRUE(playout_timestamp);
1242 EXPECT_EQ(timestamp + kSamples - algorithmic_delay_samples, 1244 EXPECT_EQ(timestamp + kSamples - algorithmic_delay_samples,
1243 *playout_timestamp); 1245 *playout_timestamp);
1244 } 1246 }
(...skipping 12 matching lines...) Expand all
1257 const int kSamples = kFrameSizeMs * kSampleRateKhz; 1259 const int kSamples = kFrameSizeMs * kSampleRateKhz;
1258 const int kPayloadBytes = kSamples * 2; 1260 const int kPayloadBytes = kSamples * 2;
1259 const int kCngPeriodMs = 100; 1261 const int kCngPeriodMs = 100;
1260 const int kCngPeriodSamples = kCngPeriodMs * kSampleRateKhz; 1262 const int kCngPeriodSamples = kCngPeriodMs * kSampleRateKhz;
1261 size_t payload_len; 1263 size_t payload_len;
1262 1264
1263 uint8_t payload[kPayloadBytes] = {0}; 1265 uint8_t payload[kPayloadBytes] = {0};
1264 WebRtcRTPHeader rtp_info; 1266 WebRtcRTPHeader rtp_info;
1265 1267
1266 PopulateCng(seq_no, timestamp, &rtp_info, payload, &payload_len); 1268 PopulateCng(seq_no, timestamp, &rtp_info, payload, &payload_len);
1267 ASSERT_EQ( 1269 ASSERT_EQ(NetEq::kOK,
1268 NetEq::kOK, 1270 neteq_->InsertPacket(
1269 neteq_->InsertPacket( 1271 rtp_info.header,
1270 rtp_info, rtc::ArrayView<const uint8_t>(payload, payload_len), 0)); 1272 rtc::ArrayView<const uint8_t>(payload, payload_len), 0));
1271 ++seq_no; 1273 ++seq_no;
1272 timestamp += kCngPeriodSamples; 1274 timestamp += kCngPeriodSamples;
1273 1275
1274 // Pull audio once and make sure CNG is played. 1276 // Pull audio once and make sure CNG is played.
1275 bool muted; 1277 bool muted;
1276 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted)); 1278 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted));
1277 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_); 1279 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_);
1278 EXPECT_EQ(AudioFrame::kCNG, out_frame_.speech_type_); 1280 EXPECT_EQ(AudioFrame::kCNG, out_frame_.speech_type_);
1279 1281
1280 // Insert some speech packets. 1282 // Insert some speech packets.
1281 const uint32_t first_speech_timestamp = timestamp; 1283 const uint32_t first_speech_timestamp = timestamp;
1282 int timeout_counter = 0; 1284 int timeout_counter = 0;
1283 do { 1285 do {
1284 ASSERT_LT(timeout_counter++, 20) << "Test timed out"; 1286 ASSERT_LT(timeout_counter++, 20) << "Test timed out";
1285 PopulateRtpInfo(seq_no, timestamp, &rtp_info); 1287 PopulateRtpInfo(seq_no, timestamp, &rtp_info);
1286 ASSERT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0)); 1288 ASSERT_EQ(0, neteq_->InsertPacket(rtp_info.header, payload, 0));
1287 ++seq_no; 1289 ++seq_no;
1288 timestamp += kSamples; 1290 timestamp += kSamples;
1289 1291
1290 // Pull audio once. 1292 // Pull audio once.
1291 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted)); 1293 ASSERT_EQ(0, neteq_->GetAudio(&out_frame_, &muted));
1292 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_); 1294 ASSERT_EQ(kBlockSize16kHz, out_frame_.samples_per_channel_);
1293 } while (!IsNewerTimestamp(out_frame_.timestamp_, first_speech_timestamp)); 1295 } while (!IsNewerTimestamp(out_frame_.timestamp_, first_speech_timestamp));
1294 // Verify speech output. 1296 // Verify speech output.
1295 EXPECT_EQ(AudioFrame::kNormalSpeech, out_frame_.speech_type_); 1297 EXPECT_EQ(AudioFrame::kNormalSpeech, out_frame_.speech_type_);
1296 } 1298 }
1297 1299
1298 class NetEqDecodingTestWithMutedState : public NetEqDecodingTest { 1300 class NetEqDecodingTestWithMutedState : public NetEqDecodingTest {
1299 public: 1301 public:
1300 NetEqDecodingTestWithMutedState() : NetEqDecodingTest() { 1302 NetEqDecodingTestWithMutedState() : NetEqDecodingTest() {
1301 config_.enable_muted_state = true; 1303 config_.enable_muted_state = true;
1302 } 1304 }
1303 1305
1304 protected: 1306 protected:
1305 static constexpr size_t kSamples = 10 * 16; 1307 static constexpr size_t kSamples = 10 * 16;
1306 static constexpr size_t kPayloadBytes = kSamples * 2; 1308 static constexpr size_t kPayloadBytes = kSamples * 2;
1307 1309
1308 void InsertPacket(uint32_t rtp_timestamp) { 1310 void InsertPacket(uint32_t rtp_timestamp) {
1309 uint8_t payload[kPayloadBytes] = {0}; 1311 uint8_t payload[kPayloadBytes] = {0};
1310 WebRtcRTPHeader rtp_info; 1312 WebRtcRTPHeader rtp_info;
1311 PopulateRtpInfo(0, rtp_timestamp, &rtp_info); 1313 PopulateRtpInfo(0, rtp_timestamp, &rtp_info);
1312 EXPECT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0)); 1314 EXPECT_EQ(0, neteq_->InsertPacket(rtp_info.header, payload, 0));
1313 } 1315 }
1314 1316
1315 void InsertCngPacket(uint32_t rtp_timestamp) { 1317 void InsertCngPacket(uint32_t rtp_timestamp) {
1316 uint8_t payload[kPayloadBytes] = {0}; 1318 uint8_t payload[kPayloadBytes] = {0};
1317 WebRtcRTPHeader rtp_info; 1319 WebRtcRTPHeader rtp_info;
1318 size_t payload_len; 1320 size_t payload_len;
1319 PopulateCng(0, rtp_timestamp, &rtp_info, payload, &payload_len); 1321 PopulateCng(0, rtp_timestamp, &rtp_info, payload, &payload_len);
1320 EXPECT_EQ( 1322 EXPECT_EQ(NetEq::kOK,
1321 NetEq::kOK, 1323 neteq_->InsertPacket(
1322 neteq_->InsertPacket( 1324 rtp_info.header,
1323 rtp_info, rtc::ArrayView<const uint8_t>(payload, payload_len), 0)); 1325 rtc::ArrayView<const uint8_t>(payload, payload_len), 0));
1324 } 1326 }
1325 1327
1326 bool GetAudioReturnMuted() { 1328 bool GetAudioReturnMuted() {
1327 bool muted; 1329 bool muted;
1328 EXPECT_EQ(0, neteq_->GetAudio(&out_frame_, &muted)); 1330 EXPECT_EQ(0, neteq_->GetAudio(&out_frame_, &muted));
1329 return muted; 1331 return muted;
1330 } 1332 }
1331 1333
1332 void GetAudioUntilMuted() { 1334 void GetAudioUntilMuted() {
1333 while (!GetAudioReturnMuted()) { 1335 while (!GetAudioReturnMuted()) {
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
1538 ASSERT_FALSE(config_.enable_muted_state); 1540 ASSERT_FALSE(config_.enable_muted_state);
1539 config2_.enable_muted_state = true; 1541 config2_.enable_muted_state = true;
1540 CreateSecondInstance(); 1542 CreateSecondInstance();
1541 1543
1542 // Insert one speech packet into both NetEqs. 1544 // Insert one speech packet into both NetEqs.
1543 const size_t kSamples = 10 * 16; 1545 const size_t kSamples = 10 * 16;
1544 const size_t kPayloadBytes = kSamples * 2; 1546 const size_t kPayloadBytes = kSamples * 2;
1545 uint8_t payload[kPayloadBytes] = {0}; 1547 uint8_t payload[kPayloadBytes] = {0};
1546 WebRtcRTPHeader rtp_info; 1548 WebRtcRTPHeader rtp_info;
1547 PopulateRtpInfo(0, 0, &rtp_info); 1549 PopulateRtpInfo(0, 0, &rtp_info);
1548 EXPECT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0)); 1550 EXPECT_EQ(0, neteq_->InsertPacket(rtp_info.header, payload, 0));
1549 EXPECT_EQ(0, neteq2_->InsertPacket(rtp_info, payload, 0)); 1551 EXPECT_EQ(0, neteq2_->InsertPacket(rtp_info.header, payload, 0));
1550 1552
1551 AudioFrame out_frame1, out_frame2; 1553 AudioFrame out_frame1, out_frame2;
1552 bool muted; 1554 bool muted;
1553 for (int i = 0; i < 1000; ++i) { 1555 for (int i = 0; i < 1000; ++i) {
1554 std::ostringstream ss; 1556 std::ostringstream ss;
1555 ss << "i = " << i; 1557 ss << "i = " << i;
1556 SCOPED_TRACE(ss.str()); // Print out the loop iterator on failure. 1558 SCOPED_TRACE(ss.str()); // Print out the loop iterator on failure.
1557 EXPECT_EQ(0, neteq_->GetAudio(&out_frame1, &muted)); 1559 EXPECT_EQ(0, neteq_->GetAudio(&out_frame1, &muted));
1558 EXPECT_FALSE(muted); 1560 EXPECT_FALSE(muted);
1559 EXPECT_EQ(0, neteq2_->GetAudio(&out_frame2, &muted)); 1561 EXPECT_EQ(0, neteq2_->GetAudio(&out_frame2, &muted));
1560 if (muted) { 1562 if (muted) {
1561 EXPECT_TRUE(AudioFramesEqualExceptData(out_frame1, out_frame2)); 1563 EXPECT_TRUE(AudioFramesEqualExceptData(out_frame1, out_frame2));
1562 } else { 1564 } else {
1563 EXPECT_TRUE(AudioFramesEqual(out_frame1, out_frame2)); 1565 EXPECT_TRUE(AudioFramesEqual(out_frame1, out_frame2));
1564 } 1566 }
1565 } 1567 }
1566 EXPECT_TRUE(muted); 1568 EXPECT_TRUE(muted);
1567 1569
1568 // Insert new data. Timestamp is corrected for the time elapsed since the last 1570 // Insert new data. Timestamp is corrected for the time elapsed since the last
1569 // packet. 1571 // packet.
1570 PopulateRtpInfo(0, kSamples * 1000, &rtp_info); 1572 PopulateRtpInfo(0, kSamples * 1000, &rtp_info);
1571 EXPECT_EQ(0, neteq_->InsertPacket(rtp_info, payload, 0)); 1573 EXPECT_EQ(0, neteq_->InsertPacket(rtp_info.header, payload, 0));
1572 EXPECT_EQ(0, neteq2_->InsertPacket(rtp_info, payload, 0)); 1574 EXPECT_EQ(0, neteq2_->InsertPacket(rtp_info.header, payload, 0));
1573 1575
1574 int counter = 0; 1576 int counter = 0;
1575 while (out_frame1.speech_type_ != AudioFrame::kNormalSpeech) { 1577 while (out_frame1.speech_type_ != AudioFrame::kNormalSpeech) {
1576 ASSERT_LT(counter++, 1000) << "Test timed out"; 1578 ASSERT_LT(counter++, 1000) << "Test timed out";
1577 std::ostringstream ss; 1579 std::ostringstream ss;
1578 ss << "counter = " << counter; 1580 ss << "counter = " << counter;
1579 SCOPED_TRACE(ss.str()); // Print out the loop iterator on failure. 1581 SCOPED_TRACE(ss.str()); // Print out the loop iterator on failure.
1580 EXPECT_EQ(0, neteq_->GetAudio(&out_frame1, &muted)); 1582 EXPECT_EQ(0, neteq_->GetAudio(&out_frame1, &muted));
1581 EXPECT_FALSE(muted); 1583 EXPECT_FALSE(muted);
1582 EXPECT_EQ(0, neteq2_->GetAudio(&out_frame2, &muted)); 1584 EXPECT_EQ(0, neteq2_->GetAudio(&out_frame2, &muted));
1583 if (muted) { 1585 if (muted) {
1584 EXPECT_TRUE(AudioFramesEqualExceptData(out_frame1, out_frame2)); 1586 EXPECT_TRUE(AudioFramesEqualExceptData(out_frame1, out_frame2));
1585 } else { 1587 } else {
1586 EXPECT_TRUE(AudioFramesEqual(out_frame1, out_frame2)); 1588 EXPECT_TRUE(AudioFramesEqual(out_frame1, out_frame2));
1587 } 1589 }
1588 } 1590 }
1589 EXPECT_FALSE(muted); 1591 EXPECT_FALSE(muted);
1590 } 1592 }
1591 1593
1592 } // namespace webrtc 1594 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698