| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 | 463 |
| 464 // Insert one packet. | 464 // Insert one packet. |
| 465 EXPECT_EQ(NetEq::kOK, | 465 EXPECT_EQ(NetEq::kOK, |
| 466 neteq_->InsertPacket( | 466 neteq_->InsertPacket( |
| 467 rtp_header, payload, kPayloadLengthBytes, kReceiveTime)); | 467 rtp_header, payload, kPayloadLengthBytes, kReceiveTime)); |
| 468 | 468 |
| 469 // Pull audio once. | 469 // Pull audio once. |
| 470 const size_t kMaxOutputSize = static_cast<size_t>(10 * kSampleRateHz / 1000); | 470 const size_t kMaxOutputSize = static_cast<size_t>(10 * kSampleRateHz / 1000); |
| 471 int16_t output[kMaxOutputSize]; | 471 int16_t output[kMaxOutputSize]; |
| 472 size_t samples_per_channel; | 472 size_t samples_per_channel; |
| 473 int num_channels; | 473 size_t num_channels; |
| 474 NetEqOutputType type; | 474 NetEqOutputType type; |
| 475 EXPECT_EQ( | 475 EXPECT_EQ( |
| 476 NetEq::kOK, | 476 NetEq::kOK, |
| 477 neteq_->GetAudio( | 477 neteq_->GetAudio( |
| 478 kMaxOutputSize, output, &samples_per_channel, &num_channels, &type)); | 478 kMaxOutputSize, output, &samples_per_channel, &num_channels, &type)); |
| 479 ASSERT_EQ(kMaxOutputSize, samples_per_channel); | 479 ASSERT_EQ(kMaxOutputSize, samples_per_channel); |
| 480 EXPECT_EQ(1, num_channels); | 480 EXPECT_EQ(1u, num_channels); |
| 481 EXPECT_EQ(kOutputNormal, type); | 481 EXPECT_EQ(kOutputNormal, type); |
| 482 | 482 |
| 483 // Start with a simple check that the fake decoder is behaving as expected. | 483 // Start with a simple check that the fake decoder is behaving as expected. |
| 484 EXPECT_EQ(kPayloadLengthSamples, | 484 EXPECT_EQ(kPayloadLengthSamples, |
| 485 static_cast<size_t>(decoder_.next_value() - 1)); | 485 static_cast<size_t>(decoder_.next_value() - 1)); |
| 486 | 486 |
| 487 // The value of the last of the output samples is the same as the number of | 487 // The value of the last of the output samples is the same as the number of |
| 488 // samples played from the decoded packet. Thus, this number + the RTP | 488 // samples played from the decoded packet. Thus, this number + the RTP |
| 489 // timestamp should match the playout timestamp. | 489 // timestamp should match the playout timestamp. |
| 490 uint32_t timestamp = 0; | 490 uint32_t timestamp = 0; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 | 543 |
| 544 // Insert one packet. | 544 // Insert one packet. |
| 545 EXPECT_EQ(NetEq::kOK, | 545 EXPECT_EQ(NetEq::kOK, |
| 546 neteq_->InsertPacket( | 546 neteq_->InsertPacket( |
| 547 rtp_header, payload, kPayloadLengthBytes, kReceiveTime)); | 547 rtp_header, payload, kPayloadLengthBytes, kReceiveTime)); |
| 548 | 548 |
| 549 // Pull audio once. | 549 // Pull audio once. |
| 550 const size_t kMaxOutputSize = static_cast<size_t>(10 * kSampleRateHz / 1000); | 550 const size_t kMaxOutputSize = static_cast<size_t>(10 * kSampleRateHz / 1000); |
| 551 int16_t output[kMaxOutputSize]; | 551 int16_t output[kMaxOutputSize]; |
| 552 size_t samples_per_channel; | 552 size_t samples_per_channel; |
| 553 int num_channels; | 553 size_t num_channels; |
| 554 NetEqOutputType type; | 554 NetEqOutputType type; |
| 555 EXPECT_EQ( | 555 EXPECT_EQ( |
| 556 NetEq::kOK, | 556 NetEq::kOK, |
| 557 neteq_->GetAudio( | 557 neteq_->GetAudio( |
| 558 kMaxOutputSize, output, &samples_per_channel, &num_channels, &type)); | 558 kMaxOutputSize, output, &samples_per_channel, &num_channels, &type)); |
| 559 ASSERT_EQ(kMaxOutputSize, samples_per_channel); | 559 ASSERT_EQ(kMaxOutputSize, samples_per_channel); |
| 560 EXPECT_EQ(1, num_channels); | 560 EXPECT_EQ(1u, num_channels); |
| 561 EXPECT_EQ(kOutputNormal, type); | 561 EXPECT_EQ(kOutputNormal, type); |
| 562 | 562 |
| 563 // Insert two more packets. The first one is out of order, and is already too | 563 // Insert two more packets. The first one is out of order, and is already too |
| 564 // old, the second one is the expected next packet. | 564 // old, the second one is the expected next packet. |
| 565 rtp_header.header.sequenceNumber -= 1; | 565 rtp_header.header.sequenceNumber -= 1; |
| 566 rtp_header.header.timestamp -= kPayloadLengthSamples; | 566 rtp_header.header.timestamp -= kPayloadLengthSamples; |
| 567 payload[0] = 1; | 567 payload[0] = 1; |
| 568 EXPECT_EQ(NetEq::kOK, | 568 EXPECT_EQ(NetEq::kOK, |
| 569 neteq_->InsertPacket( | 569 neteq_->InsertPacket( |
| 570 rtp_header, payload, kPayloadLengthBytes, kReceiveTime)); | 570 rtp_header, payload, kPayloadLengthBytes, kReceiveTime)); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 583 dummy_output + kPayloadLengthSamples), | 583 dummy_output + kPayloadLengthSamples), |
| 584 SetArgPointee<5>(AudioDecoder::kSpeech), | 584 SetArgPointee<5>(AudioDecoder::kSpeech), |
| 585 Return(kPayloadLengthSamples))); | 585 Return(kPayloadLengthSamples))); |
| 586 | 586 |
| 587 // Pull audio once. | 587 // Pull audio once. |
| 588 EXPECT_EQ( | 588 EXPECT_EQ( |
| 589 NetEq::kOK, | 589 NetEq::kOK, |
| 590 neteq_->GetAudio( | 590 neteq_->GetAudio( |
| 591 kMaxOutputSize, output, &samples_per_channel, &num_channels, &type)); | 591 kMaxOutputSize, output, &samples_per_channel, &num_channels, &type)); |
| 592 ASSERT_EQ(kMaxOutputSize, samples_per_channel); | 592 ASSERT_EQ(kMaxOutputSize, samples_per_channel); |
| 593 EXPECT_EQ(1, num_channels); | 593 EXPECT_EQ(1u, num_channels); |
| 594 EXPECT_EQ(kOutputNormal, type); | 594 EXPECT_EQ(kOutputNormal, type); |
| 595 | 595 |
| 596 // Now check the packet buffer, and make sure it is empty, since the | 596 // Now check the packet buffer, and make sure it is empty, since the |
| 597 // out-of-order packet should have been discarded. | 597 // out-of-order packet should have been discarded. |
| 598 EXPECT_TRUE(packet_buffer_->Empty()); | 598 EXPECT_TRUE(packet_buffer_->Empty()); |
| 599 | 599 |
| 600 EXPECT_CALL(mock_decoder, Die()); | 600 EXPECT_CALL(mock_decoder, Die()); |
| 601 } | 601 } |
| 602 | 602 |
| 603 // This test verifies that NetEq can handle the situation where the first | 603 // This test verifies that NetEq can handle the situation where the first |
| (...skipping 19 matching lines...) Expand all Loading... |
| 623 // this packet will be rejected. | 623 // this packet will be rejected. |
| 624 EXPECT_EQ(NetEq::kFail, | 624 EXPECT_EQ(NetEq::kFail, |
| 625 neteq_->InsertPacket(rtp_header, payload, kPayloadLengthBytes, | 625 neteq_->InsertPacket(rtp_header, payload, kPayloadLengthBytes, |
| 626 kReceiveTime)); | 626 kReceiveTime)); |
| 627 EXPECT_EQ(NetEq::kUnknownRtpPayloadType, neteq_->LastError()); | 627 EXPECT_EQ(NetEq::kUnknownRtpPayloadType, neteq_->LastError()); |
| 628 | 628 |
| 629 // Pull audio once. | 629 // Pull audio once. |
| 630 const size_t kMaxOutputSize = static_cast<size_t>(10 * kSampleRateHz / 1000); | 630 const size_t kMaxOutputSize = static_cast<size_t>(10 * kSampleRateHz / 1000); |
| 631 int16_t output[kMaxOutputSize]; | 631 int16_t output[kMaxOutputSize]; |
| 632 size_t samples_per_channel; | 632 size_t samples_per_channel; |
| 633 int num_channels; | 633 size_t num_channels; |
| 634 NetEqOutputType type; | 634 NetEqOutputType type; |
| 635 EXPECT_EQ(NetEq::kOK, | 635 EXPECT_EQ(NetEq::kOK, |
| 636 neteq_->GetAudio(kMaxOutputSize, output, &samples_per_channel, | 636 neteq_->GetAudio(kMaxOutputSize, output, &samples_per_channel, |
| 637 &num_channels, &type)); | 637 &num_channels, &type)); |
| 638 ASSERT_LE(samples_per_channel, kMaxOutputSize); | 638 ASSERT_LE(samples_per_channel, kMaxOutputSize); |
| 639 EXPECT_EQ(kMaxOutputSize, samples_per_channel); | 639 EXPECT_EQ(kMaxOutputSize, samples_per_channel); |
| 640 EXPECT_EQ(1, num_channels); | 640 EXPECT_EQ(1u, num_channels); |
| 641 EXPECT_EQ(kOutputPLC, type); | 641 EXPECT_EQ(kOutputPLC, type); |
| 642 | 642 |
| 643 // Register the payload type. | 643 // Register the payload type. |
| 644 EXPECT_EQ(NetEq::kOK, | 644 EXPECT_EQ(NetEq::kOK, |
| 645 neteq_->RegisterPayloadType(kDecoderPCM16B, kPayloadType)); | 645 neteq_->RegisterPayloadType(kDecoderPCM16B, kPayloadType)); |
| 646 | 646 |
| 647 // Insert 10 packets. | 647 // Insert 10 packets. |
| 648 for (size_t i = 0; i < 10; ++i) { | 648 for (size_t i = 0; i < 10; ++i) { |
| 649 rtp_header.header.sequenceNumber++; | 649 rtp_header.header.sequenceNumber++; |
| 650 rtp_header.header.timestamp += kPayloadLengthSamples; | 650 rtp_header.header.timestamp += kPayloadLengthSamples; |
| 651 EXPECT_EQ(NetEq::kOK, | 651 EXPECT_EQ(NetEq::kOK, |
| 652 neteq_->InsertPacket(rtp_header, payload, kPayloadLengthBytes, | 652 neteq_->InsertPacket(rtp_header, payload, kPayloadLengthBytes, |
| 653 kReceiveTime)); | 653 kReceiveTime)); |
| 654 EXPECT_EQ(i + 1, packet_buffer_->NumPacketsInBuffer()); | 654 EXPECT_EQ(i + 1, packet_buffer_->NumPacketsInBuffer()); |
| 655 } | 655 } |
| 656 | 656 |
| 657 // Pull audio repeatedly and make sure we get normal output, that is not PLC. | 657 // Pull audio repeatedly and make sure we get normal output, that is not PLC. |
| 658 for (size_t i = 0; i < 3; ++i) { | 658 for (size_t i = 0; i < 3; ++i) { |
| 659 EXPECT_EQ(NetEq::kOK, | 659 EXPECT_EQ(NetEq::kOK, |
| 660 neteq_->GetAudio(kMaxOutputSize, output, &samples_per_channel, | 660 neteq_->GetAudio(kMaxOutputSize, output, &samples_per_channel, |
| 661 &num_channels, &type)); | 661 &num_channels, &type)); |
| 662 ASSERT_LE(samples_per_channel, kMaxOutputSize); | 662 ASSERT_LE(samples_per_channel, kMaxOutputSize); |
| 663 EXPECT_EQ(kMaxOutputSize, samples_per_channel); | 663 EXPECT_EQ(kMaxOutputSize, samples_per_channel); |
| 664 EXPECT_EQ(1, num_channels); | 664 EXPECT_EQ(1u, num_channels); |
| 665 EXPECT_EQ(kOutputNormal, type) | 665 EXPECT_EQ(kOutputNormal, type) |
| 666 << "NetEq did not decode the packets as expected."; | 666 << "NetEq did not decode the packets as expected."; |
| 667 } | 667 } |
| 668 } | 668 } |
| 669 | 669 |
| 670 // This test verifies that NetEq can handle comfort noise and enters/quits codec | 670 // This test verifies that NetEq can handle comfort noise and enters/quits codec |
| 671 // internal CNG mode properly. | 671 // internal CNG mode properly. |
| 672 TEST_F(NetEqImplTest, CodecInternalCng) { | 672 TEST_F(NetEqImplTest, CodecInternalCng) { |
| 673 UseNoMocks(); | 673 UseNoMocks(); |
| 674 CreateInstance(); | 674 CreateInstance(); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 737 payload[0] = 1; | 737 payload[0] = 1; |
| 738 rtp_header.header.sequenceNumber++; | 738 rtp_header.header.sequenceNumber++; |
| 739 rtp_header.header.timestamp += kPayloadLengthSamples; | 739 rtp_header.header.timestamp += kPayloadLengthSamples; |
| 740 EXPECT_EQ(NetEq::kOK, | 740 EXPECT_EQ(NetEq::kOK, |
| 741 neteq_->InsertPacket( | 741 neteq_->InsertPacket( |
| 742 rtp_header, payload, kPayloadLengthBytes, kReceiveTime)); | 742 rtp_header, payload, kPayloadLengthBytes, kReceiveTime)); |
| 743 | 743 |
| 744 const size_t kMaxOutputSize = static_cast<size_t>(10 * kSampleRateKhz); | 744 const size_t kMaxOutputSize = static_cast<size_t>(10 * kSampleRateKhz); |
| 745 int16_t output[kMaxOutputSize]; | 745 int16_t output[kMaxOutputSize]; |
| 746 size_t samples_per_channel; | 746 size_t samples_per_channel; |
| 747 int num_channels; | 747 size_t num_channels; |
| 748 uint32_t timestamp; | 748 uint32_t timestamp; |
| 749 uint32_t last_timestamp; | 749 uint32_t last_timestamp; |
| 750 NetEqOutputType type; | 750 NetEqOutputType type; |
| 751 NetEqOutputType expected_type[8] = { | 751 NetEqOutputType expected_type[8] = { |
| 752 kOutputNormal, kOutputNormal, | 752 kOutputNormal, kOutputNormal, |
| 753 kOutputCNG, kOutputCNG, | 753 kOutputCNG, kOutputCNG, |
| 754 kOutputCNG, kOutputCNG, | 754 kOutputCNG, kOutputCNG, |
| 755 kOutputNormal, kOutputNormal | 755 kOutputNormal, kOutputNormal |
| 756 }; | 756 }; |
| 757 int expected_timestamp_increment[8] = { | 757 int expected_timestamp_increment[8] = { |
| 758 -1, // will not be used. | 758 -1, // will not be used. |
| 759 10 * kSampleRateKhz, | 759 10 * kSampleRateKhz, |
| 760 0, 0, // timestamp does not increase during CNG mode. | 760 0, 0, // timestamp does not increase during CNG mode. |
| 761 0, 0, | 761 0, 0, |
| 762 50 * kSampleRateKhz, 10 * kSampleRateKhz | 762 50 * kSampleRateKhz, 10 * kSampleRateKhz |
| 763 }; | 763 }; |
| 764 | 764 |
| 765 EXPECT_EQ(NetEq::kOK, | 765 EXPECT_EQ(NetEq::kOK, |
| 766 neteq_->GetAudio(kMaxOutputSize, output, &samples_per_channel, | 766 neteq_->GetAudio(kMaxOutputSize, output, &samples_per_channel, |
| 767 &num_channels, &type)); | 767 &num_channels, &type)); |
| 768 EXPECT_TRUE(neteq_->GetPlayoutTimestamp(&last_timestamp)); | 768 EXPECT_TRUE(neteq_->GetPlayoutTimestamp(&last_timestamp)); |
| 769 | 769 |
| 770 for (size_t i = 1; i < 6; ++i) { | 770 for (size_t i = 1; i < 6; ++i) { |
| 771 ASSERT_EQ(kMaxOutputSize, samples_per_channel); | 771 ASSERT_EQ(kMaxOutputSize, samples_per_channel); |
| 772 EXPECT_EQ(1, num_channels); | 772 EXPECT_EQ(1u, num_channels); |
| 773 EXPECT_EQ(expected_type[i - 1], type); | 773 EXPECT_EQ(expected_type[i - 1], type); |
| 774 EXPECT_TRUE(neteq_->GetPlayoutTimestamp(×tamp)); | 774 EXPECT_TRUE(neteq_->GetPlayoutTimestamp(×tamp)); |
| 775 EXPECT_EQ(NetEq::kOK, | 775 EXPECT_EQ(NetEq::kOK, |
| 776 neteq_->GetAudio(kMaxOutputSize, output, &samples_per_channel, | 776 neteq_->GetAudio(kMaxOutputSize, output, &samples_per_channel, |
| 777 &num_channels, &type)); | 777 &num_channels, &type)); |
| 778 EXPECT_TRUE(neteq_->GetPlayoutTimestamp(×tamp)); | 778 EXPECT_TRUE(neteq_->GetPlayoutTimestamp(×tamp)); |
| 779 EXPECT_EQ(timestamp, last_timestamp + expected_timestamp_increment[i]); | 779 EXPECT_EQ(timestamp, last_timestamp + expected_timestamp_increment[i]); |
| 780 last_timestamp = timestamp; | 780 last_timestamp = timestamp; |
| 781 } | 781 } |
| 782 | 782 |
| 783 // Insert third packet, which leaves a gap from last packet. | 783 // Insert third packet, which leaves a gap from last packet. |
| 784 payload[0] = 2; | 784 payload[0] = 2; |
| 785 rtp_header.header.sequenceNumber += 2; | 785 rtp_header.header.sequenceNumber += 2; |
| 786 rtp_header.header.timestamp += 2 * kPayloadLengthSamples; | 786 rtp_header.header.timestamp += 2 * kPayloadLengthSamples; |
| 787 EXPECT_EQ(NetEq::kOK, | 787 EXPECT_EQ(NetEq::kOK, |
| 788 neteq_->InsertPacket( | 788 neteq_->InsertPacket( |
| 789 rtp_header, payload, kPayloadLengthBytes, kReceiveTime)); | 789 rtp_header, payload, kPayloadLengthBytes, kReceiveTime)); |
| 790 | 790 |
| 791 for (size_t i = 6; i < 8; ++i) { | 791 for (size_t i = 6; i < 8; ++i) { |
| 792 ASSERT_EQ(kMaxOutputSize, samples_per_channel); | 792 ASSERT_EQ(kMaxOutputSize, samples_per_channel); |
| 793 EXPECT_EQ(1, num_channels); | 793 EXPECT_EQ(1u, num_channels); |
| 794 EXPECT_EQ(expected_type[i - 1], type); | 794 EXPECT_EQ(expected_type[i - 1], type); |
| 795 EXPECT_EQ(NetEq::kOK, | 795 EXPECT_EQ(NetEq::kOK, |
| 796 neteq_->GetAudio(kMaxOutputSize, output, &samples_per_channel, | 796 neteq_->GetAudio(kMaxOutputSize, output, &samples_per_channel, |
| 797 &num_channels, &type)); | 797 &num_channels, &type)); |
| 798 EXPECT_TRUE(neteq_->GetPlayoutTimestamp(×tamp)); | 798 EXPECT_TRUE(neteq_->GetPlayoutTimestamp(×tamp)); |
| 799 EXPECT_EQ(timestamp, last_timestamp + expected_timestamp_increment[i]); | 799 EXPECT_EQ(timestamp, last_timestamp + expected_timestamp_increment[i]); |
| 800 last_timestamp = timestamp; | 800 last_timestamp = timestamp; |
| 801 } | 801 } |
| 802 | 802 |
| 803 // Now check the packet buffer, and make sure it is empty. | 803 // Now check the packet buffer, and make sure it is empty. |
| 804 EXPECT_TRUE(packet_buffer_->Empty()); | 804 EXPECT_TRUE(packet_buffer_->Empty()); |
| 805 | 805 |
| 806 EXPECT_CALL(mock_decoder, Die()); | 806 EXPECT_CALL(mock_decoder, Die()); |
| 807 } | 807 } |
| 808 | 808 |
| 809 TEST_F(NetEqImplTest, UnsupportedDecoder) { | 809 TEST_F(NetEqImplTest, UnsupportedDecoder) { |
| 810 UseNoMocks(); | 810 UseNoMocks(); |
| 811 CreateInstance(); | 811 CreateInstance(); |
| 812 static const size_t kNetEqMaxFrameSize = 2880; // 60 ms @ 48 kHz. | 812 static const size_t kNetEqMaxFrameSize = 2880; // 60 ms @ 48 kHz. |
| 813 static const int kChannels = 2; | 813 static const size_t kChannels = 2; |
| 814 | 814 |
| 815 const uint8_t kPayloadType = 17; // Just an arbitrary number. | 815 const uint8_t kPayloadType = 17; // Just an arbitrary number. |
| 816 const uint32_t kReceiveTime = 17; // Value doesn't matter for this test. | 816 const uint32_t kReceiveTime = 17; // Value doesn't matter for this test. |
| 817 const int kSampleRateHz = 8000; | 817 const int kSampleRateHz = 8000; |
| 818 | 818 |
| 819 const size_t kPayloadLengthSamples = | 819 const size_t kPayloadLengthSamples = |
| 820 static_cast<size_t>(10 * kSampleRateHz / 1000); // 10 ms. | 820 static_cast<size_t>(10 * kSampleRateHz / 1000); // 10 ms. |
| 821 const size_t kPayloadLengthBytes = 1; | 821 const size_t kPayloadLengthBytes = 1; |
| 822 uint8_t payload[kPayloadLengthBytes]= {0}; | 822 uint8_t payload[kPayloadLengthBytes]= {0}; |
| 823 int16_t dummy_output[kPayloadLengthSamples * kChannels] = {0}; | 823 int16_t dummy_output[kPayloadLengthSamples * kChannels] = {0}; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 879 // Insert another packet. | 879 // Insert another packet. |
| 880 payload[0] = kSecondPayloadValue; // This will make Decode() successful. | 880 payload[0] = kSecondPayloadValue; // This will make Decode() successful. |
| 881 rtp_header.header.sequenceNumber++; | 881 rtp_header.header.sequenceNumber++; |
| 882 // The second timestamp needs to be at least 30 ms after the first to make | 882 // The second timestamp needs to be at least 30 ms after the first to make |
| 883 // the second packet get decoded. | 883 // the second packet get decoded. |
| 884 rtp_header.header.timestamp += 3 * kPayloadLengthSamples; | 884 rtp_header.header.timestamp += 3 * kPayloadLengthSamples; |
| 885 EXPECT_EQ(NetEq::kOK, | 885 EXPECT_EQ(NetEq::kOK, |
| 886 neteq_->InsertPacket( | 886 neteq_->InsertPacket( |
| 887 rtp_header, payload, kPayloadLengthBytes, kReceiveTime)); | 887 rtp_header, payload, kPayloadLengthBytes, kReceiveTime)); |
| 888 | 888 |
| 889 const size_t kMaxOutputSize = | 889 const size_t kMaxOutputSize = 10 * kSampleRateHz / 1000 * kChannels; |
| 890 static_cast<size_t>(10 * kSampleRateHz / 1000 * kChannels); | |
| 891 int16_t output[kMaxOutputSize]; | 890 int16_t output[kMaxOutputSize]; |
| 892 size_t samples_per_channel; | 891 size_t samples_per_channel; |
| 893 int num_channels; | 892 size_t num_channels; |
| 894 NetEqOutputType type; | 893 NetEqOutputType type; |
| 895 | 894 |
| 896 EXPECT_EQ(NetEq::kFail, neteq_->GetAudio(kMaxOutputSize, output, | 895 EXPECT_EQ(NetEq::kFail, neteq_->GetAudio(kMaxOutputSize, output, |
| 897 &samples_per_channel, &num_channels, | 896 &samples_per_channel, &num_channels, |
| 898 &type)); | 897 &type)); |
| 899 EXPECT_EQ(NetEq::kOtherDecoderError, neteq_->LastError()); | 898 EXPECT_EQ(NetEq::kOtherDecoderError, neteq_->LastError()); |
| 900 EXPECT_EQ(kMaxOutputSize, samples_per_channel * kChannels); | 899 EXPECT_EQ(kMaxOutputSize, samples_per_channel * kChannels); |
| 901 EXPECT_EQ(kChannels, num_channels); | 900 EXPECT_EQ(kChannels, num_channels); |
| 902 | 901 |
| 903 EXPECT_EQ(NetEq::kOK, neteq_->GetAudio(kMaxOutputSize, output, | 902 EXPECT_EQ(NetEq::kOK, neteq_->GetAudio(kMaxOutputSize, output, |
| 904 &samples_per_channel, &num_channels, | 903 &samples_per_channel, &num_channels, |
| 905 &type)); | 904 &type)); |
| 906 EXPECT_EQ(kMaxOutputSize, samples_per_channel * kChannels); | 905 EXPECT_EQ(kMaxOutputSize, samples_per_channel * kChannels); |
| 907 EXPECT_EQ(kChannels, num_channels); | 906 EXPECT_EQ(kChannels, num_channels); |
| 908 } | 907 } |
| 909 | 908 |
| 910 } // namespace webrtc | 909 } // namespace webrtc |
| OLD | NEW |