| 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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 TEST(NetEq, CreateAndDestroy) { | 233 TEST(NetEq, CreateAndDestroy) { |
| 234 NetEq::Config config; | 234 NetEq::Config config; |
| 235 NetEq* neteq = NetEq::Create(config); | 235 NetEq* neteq = NetEq::Create(config); |
| 236 delete neteq; | 236 delete neteq; |
| 237 } | 237 } |
| 238 | 238 |
| 239 TEST_F(NetEqImplTest, RegisterPayloadType) { | 239 TEST_F(NetEqImplTest, RegisterPayloadType) { |
| 240 CreateInstance(); | 240 CreateInstance(); |
| 241 uint8_t rtp_payload_type = 0; | 241 uint8_t rtp_payload_type = 0; |
| 242 NetEqDecoder codec_type = NetEqDecoder::kDecoderPCMu; | 242 NetEqDecoder codec_type = NetEqDecoder::kDecoderPCMu; |
| 243 const std::string kCodecName = "Robert\'); DROP TABLE Students;"; |
| 243 EXPECT_CALL(*mock_decoder_database_, | 244 EXPECT_CALL(*mock_decoder_database_, |
| 244 RegisterPayload(rtp_payload_type, codec_type)); | 245 RegisterPayload(rtp_payload_type, codec_type, kCodecName)); |
| 245 neteq_->RegisterPayloadType(codec_type, rtp_payload_type); | 246 neteq_->RegisterPayloadType(codec_type, kCodecName, rtp_payload_type); |
| 246 } | 247 } |
| 247 | 248 |
| 248 TEST_F(NetEqImplTest, RemovePayloadType) { | 249 TEST_F(NetEqImplTest, RemovePayloadType) { |
| 249 CreateInstance(); | 250 CreateInstance(); |
| 250 uint8_t rtp_payload_type = 0; | 251 uint8_t rtp_payload_type = 0; |
| 251 EXPECT_CALL(*mock_decoder_database_, Remove(rtp_payload_type)) | 252 EXPECT_CALL(*mock_decoder_database_, Remove(rtp_payload_type)) |
| 252 .WillOnce(Return(DecoderDatabase::kDecoderNotFound)); | 253 .WillOnce(Return(DecoderDatabase::kDecoderNotFound)); |
| 253 // Check that kFail is returned when database returns kDecoderNotFound. | 254 // Check that kFail is returned when database returns kDecoderNotFound. |
| 254 EXPECT_EQ(NetEq::kFail, neteq_->RemovePayloadType(rtp_payload_type)); | 255 EXPECT_EQ(NetEq::kFail, neteq_->RemovePayloadType(rtp_payload_type)); |
| 255 } | 256 } |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 const uint8_t kPayloadType = 17; // Just an arbitrary number. | 377 const uint8_t kPayloadType = 17; // Just an arbitrary number. |
| 377 const uint32_t kReceiveTime = 17; // Value doesn't matter for this test. | 378 const uint32_t kReceiveTime = 17; // Value doesn't matter for this test. |
| 378 uint8_t payload[kPayloadLengthBytes] = {0}; | 379 uint8_t payload[kPayloadLengthBytes] = {0}; |
| 379 WebRtcRTPHeader rtp_header; | 380 WebRtcRTPHeader rtp_header; |
| 380 rtp_header.header.payloadType = kPayloadType; | 381 rtp_header.header.payloadType = kPayloadType; |
| 381 rtp_header.header.sequenceNumber = 0x1234; | 382 rtp_header.header.sequenceNumber = 0x1234; |
| 382 rtp_header.header.timestamp = 0x12345678; | 383 rtp_header.header.timestamp = 0x12345678; |
| 383 rtp_header.header.ssrc = 0x87654321; | 384 rtp_header.header.ssrc = 0x87654321; |
| 384 | 385 |
| 385 EXPECT_EQ(NetEq::kOK, neteq_->RegisterPayloadType( | 386 EXPECT_EQ(NetEq::kOK, neteq_->RegisterPayloadType( |
| 386 NetEqDecoder::kDecoderPCM16B, kPayloadType)); | 387 NetEqDecoder::kDecoderPCM16B, "", kPayloadType)); |
| 387 | 388 |
| 388 // Insert packets. The buffer should not flush. | 389 // Insert packets. The buffer should not flush. |
| 389 for (size_t i = 1; i <= config_.max_packets_in_buffer; ++i) { | 390 for (size_t i = 1; i <= config_.max_packets_in_buffer; ++i) { |
| 390 EXPECT_EQ(NetEq::kOK, | 391 EXPECT_EQ(NetEq::kOK, |
| 391 neteq_->InsertPacket(rtp_header, payload, kReceiveTime)); | 392 neteq_->InsertPacket(rtp_header, payload, kReceiveTime)); |
| 392 rtp_header.header.timestamp += kPayloadLengthSamples; | 393 rtp_header.header.timestamp += kPayloadLengthSamples; |
| 393 rtp_header.header.sequenceNumber += 1; | 394 rtp_header.header.sequenceNumber += 1; |
| 394 EXPECT_EQ(i, packet_buffer_->NumPacketsInBuffer()); | 395 EXPECT_EQ(i, packet_buffer_->NumPacketsInBuffer()); |
| 395 } | 396 } |
| 396 | 397 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 size_t Channels() const override { return 1; } | 449 size_t Channels() const override { return 1; } |
| 449 | 450 |
| 450 uint16_t next_value() const { return next_value_; } | 451 uint16_t next_value() const { return next_value_; } |
| 451 | 452 |
| 452 private: | 453 private: |
| 453 int16_t next_value_; | 454 int16_t next_value_; |
| 454 } decoder_; | 455 } decoder_; |
| 455 | 456 |
| 456 EXPECT_EQ(NetEq::kOK, neteq_->RegisterExternalDecoder( | 457 EXPECT_EQ(NetEq::kOK, neteq_->RegisterExternalDecoder( |
| 457 &decoder_, NetEqDecoder::kDecoderPCM16B, | 458 &decoder_, NetEqDecoder::kDecoderPCM16B, |
| 458 kPayloadType, kSampleRateHz)); | 459 "dummy name", kPayloadType, kSampleRateHz)); |
| 459 | 460 |
| 460 // Insert one packet. | 461 // Insert one packet. |
| 461 EXPECT_EQ(NetEq::kOK, | 462 EXPECT_EQ(NetEq::kOK, |
| 462 neteq_->InsertPacket(rtp_header, payload, kReceiveTime)); | 463 neteq_->InsertPacket(rtp_header, payload, kReceiveTime)); |
| 463 | 464 |
| 464 // Pull audio once. | 465 // Pull audio once. |
| 465 const size_t kMaxOutputSize = static_cast<size_t>(10 * kSampleRateHz / 1000); | 466 const size_t kMaxOutputSize = static_cast<size_t>(10 * kSampleRateHz / 1000); |
| 466 int16_t output[kMaxOutputSize]; | 467 int16_t output[kMaxOutputSize]; |
| 467 size_t samples_per_channel; | 468 size_t samples_per_channel; |
| 468 int num_channels; | 469 int num_channels; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 // The below expectation will make the mock decoder write | 528 // The below expectation will make the mock decoder write |
| 528 // |kPayloadLengthSamples| zeros to the output array, and mark it as speech. | 529 // |kPayloadLengthSamples| zeros to the output array, and mark it as speech. |
| 529 EXPECT_CALL(mock_decoder, DecodeInternal(Pointee(0), kPayloadLengthBytes, | 530 EXPECT_CALL(mock_decoder, DecodeInternal(Pointee(0), kPayloadLengthBytes, |
| 530 kSampleRateHz, _, _)) | 531 kSampleRateHz, _, _)) |
| 531 .WillOnce(DoAll(SetArrayArgument<3>(dummy_output, | 532 .WillOnce(DoAll(SetArrayArgument<3>(dummy_output, |
| 532 dummy_output + kPayloadLengthSamples), | 533 dummy_output + kPayloadLengthSamples), |
| 533 SetArgPointee<4>(AudioDecoder::kSpeech), | 534 SetArgPointee<4>(AudioDecoder::kSpeech), |
| 534 Return(kPayloadLengthSamples))); | 535 Return(kPayloadLengthSamples))); |
| 535 EXPECT_EQ(NetEq::kOK, neteq_->RegisterExternalDecoder( | 536 EXPECT_EQ(NetEq::kOK, neteq_->RegisterExternalDecoder( |
| 536 &mock_decoder, NetEqDecoder::kDecoderPCM16B, | 537 &mock_decoder, NetEqDecoder::kDecoderPCM16B, |
| 537 kPayloadType, kSampleRateHz)); | 538 "dummy name", kPayloadType, kSampleRateHz)); |
| 538 | 539 |
| 539 // Insert one packet. | 540 // Insert one packet. |
| 540 EXPECT_EQ(NetEq::kOK, | 541 EXPECT_EQ(NetEq::kOK, |
| 541 neteq_->InsertPacket(rtp_header, payload, kReceiveTime)); | 542 neteq_->InsertPacket(rtp_header, payload, kReceiveTime)); |
| 542 | 543 |
| 543 // Pull audio once. | 544 // Pull audio once. |
| 544 const size_t kMaxOutputSize = static_cast<size_t>(10 * kSampleRateHz / 1000); | 545 const size_t kMaxOutputSize = static_cast<size_t>(10 * kSampleRateHz / 1000); |
| 545 int16_t output[kMaxOutputSize]; | 546 int16_t output[kMaxOutputSize]; |
| 546 size_t samples_per_channel; | 547 size_t samples_per_channel; |
| 547 int num_channels; | 548 int num_channels; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 EXPECT_EQ(NetEq::kOK, | 627 EXPECT_EQ(NetEq::kOK, |
| 627 neteq_->GetAudio(kMaxOutputSize, output, &samples_per_channel, | 628 neteq_->GetAudio(kMaxOutputSize, output, &samples_per_channel, |
| 628 &num_channels, &type)); | 629 &num_channels, &type)); |
| 629 ASSERT_LE(samples_per_channel, kMaxOutputSize); | 630 ASSERT_LE(samples_per_channel, kMaxOutputSize); |
| 630 EXPECT_EQ(kMaxOutputSize, samples_per_channel); | 631 EXPECT_EQ(kMaxOutputSize, samples_per_channel); |
| 631 EXPECT_EQ(1, num_channels); | 632 EXPECT_EQ(1, num_channels); |
| 632 EXPECT_EQ(kOutputPLC, type); | 633 EXPECT_EQ(kOutputPLC, type); |
| 633 | 634 |
| 634 // Register the payload type. | 635 // Register the payload type. |
| 635 EXPECT_EQ(NetEq::kOK, neteq_->RegisterPayloadType( | 636 EXPECT_EQ(NetEq::kOK, neteq_->RegisterPayloadType( |
| 636 NetEqDecoder::kDecoderPCM16B, kPayloadType)); | 637 NetEqDecoder::kDecoderPCM16B, "", kPayloadType)); |
| 637 | 638 |
| 638 // Insert 10 packets. | 639 // Insert 10 packets. |
| 639 for (size_t i = 0; i < 10; ++i) { | 640 for (size_t i = 0; i < 10; ++i) { |
| 640 rtp_header.header.sequenceNumber++; | 641 rtp_header.header.sequenceNumber++; |
| 641 rtp_header.header.timestamp += kPayloadLengthSamples; | 642 rtp_header.header.timestamp += kPayloadLengthSamples; |
| 642 EXPECT_EQ(NetEq::kOK, | 643 EXPECT_EQ(NetEq::kOK, |
| 643 neteq_->InsertPacket(rtp_header, payload, kReceiveTime)); | 644 neteq_->InsertPacket(rtp_header, payload, kReceiveTime)); |
| 644 EXPECT_EQ(i + 1, packet_buffer_->NumPacketsInBuffer()); | 645 EXPECT_EQ(i + 1, packet_buffer_->NumPacketsInBuffer()); |
| 645 } | 646 } |
| 646 | 647 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 | 711 |
| 711 EXPECT_CALL(mock_decoder, DecodeInternal(Pointee(2), kPayloadLengthBytes, | 712 EXPECT_CALL(mock_decoder, DecodeInternal(Pointee(2), kPayloadLengthBytes, |
| 712 kSampleRateKhz * 1000, _, _)) | 713 kSampleRateKhz * 1000, _, _)) |
| 713 .WillOnce(DoAll(SetArrayArgument<3>(dummy_output, | 714 .WillOnce(DoAll(SetArrayArgument<3>(dummy_output, |
| 714 dummy_output + kPayloadLengthSamples), | 715 dummy_output + kPayloadLengthSamples), |
| 715 SetArgPointee<4>(AudioDecoder::kSpeech), | 716 SetArgPointee<4>(AudioDecoder::kSpeech), |
| 716 Return(kPayloadLengthSamples))); | 717 Return(kPayloadLengthSamples))); |
| 717 | 718 |
| 718 EXPECT_EQ(NetEq::kOK, neteq_->RegisterExternalDecoder( | 719 EXPECT_EQ(NetEq::kOK, neteq_->RegisterExternalDecoder( |
| 719 &mock_decoder, NetEqDecoder::kDecoderOpus, | 720 &mock_decoder, NetEqDecoder::kDecoderOpus, |
| 720 kPayloadType, kSampleRateKhz * 1000)); | 721 "dummy name", kPayloadType, kSampleRateKhz * 1000)); |
| 721 | 722 |
| 722 // Insert one packet (decoder will return speech). | 723 // Insert one packet (decoder will return speech). |
| 723 EXPECT_EQ(NetEq::kOK, | 724 EXPECT_EQ(NetEq::kOK, |
| 724 neteq_->InsertPacket(rtp_header, payload, kReceiveTime)); | 725 neteq_->InsertPacket(rtp_header, payload, kReceiveTime)); |
| 725 | 726 |
| 726 // Insert second packet (decoder will return CNG). | 727 // Insert second packet (decoder will return CNG). |
| 727 payload[0] = 1; | 728 payload[0] = 1; |
| 728 rtp_header.header.sequenceNumber++; | 729 rtp_header.header.sequenceNumber++; |
| 729 rtp_header.header.timestamp += kPayloadLengthSamples; | 730 rtp_header.header.timestamp += kPayloadLengthSamples; |
| 730 EXPECT_EQ(NetEq::kOK, | 731 EXPECT_EQ(NetEq::kOK, |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 847 Return(static_cast<int>( | 848 Return(static_cast<int>( |
| 848 kPayloadLengthSamples * kChannels)))); | 849 kPayloadLengthSamples * kChannels)))); |
| 849 | 850 |
| 850 EXPECT_CALL(decoder_, PacketDuration(Pointee(kSecondPayloadValue), | 851 EXPECT_CALL(decoder_, PacketDuration(Pointee(kSecondPayloadValue), |
| 851 kPayloadLengthBytes)) | 852 kPayloadLengthBytes)) |
| 852 .Times(AtLeast(1)) | 853 .Times(AtLeast(1)) |
| 853 .WillRepeatedly(Return(kNetEqMaxFrameSize)); | 854 .WillRepeatedly(Return(kNetEqMaxFrameSize)); |
| 854 | 855 |
| 855 EXPECT_EQ(NetEq::kOK, neteq_->RegisterExternalDecoder( | 856 EXPECT_EQ(NetEq::kOK, neteq_->RegisterExternalDecoder( |
| 856 &decoder_, NetEqDecoder::kDecoderPCM16B, | 857 &decoder_, NetEqDecoder::kDecoderPCM16B, |
| 857 kPayloadType, kSampleRateHz)); | 858 "dummy name", kPayloadType, kSampleRateHz)); |
| 858 | 859 |
| 859 // Insert one packet. | 860 // Insert one packet. |
| 860 payload[0] = kFirstPayloadValue; // This will make Decode() fail. | 861 payload[0] = kFirstPayloadValue; // This will make Decode() fail. |
| 861 EXPECT_EQ(NetEq::kOK, | 862 EXPECT_EQ(NetEq::kOK, |
| 862 neteq_->InsertPacket(rtp_header, payload, kReceiveTime)); | 863 neteq_->InsertPacket(rtp_header, payload, kReceiveTime)); |
| 863 | 864 |
| 864 // Insert another packet. | 865 // Insert another packet. |
| 865 payload[0] = kSecondPayloadValue; // This will make Decode() successful. | 866 payload[0] = kSecondPayloadValue; // This will make Decode() successful. |
| 866 rtp_header.header.sequenceNumber++; | 867 rtp_header.header.sequenceNumber++; |
| 867 // The second timestamp needs to be at least 30 ms after the first to make | 868 // The second timestamp needs to be at least 30 ms after the first to make |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 905 const uint8_t kPayloadType = 17; // Just an arbitrary number. | 906 const uint8_t kPayloadType = 17; // Just an arbitrary number. |
| 906 const uint32_t kReceiveTime = 17; // Value doesn't matter for this test. | 907 const uint32_t kReceiveTime = 17; // Value doesn't matter for this test. |
| 907 uint8_t payload[kPayloadLengthBytes] = {0}; | 908 uint8_t payload[kPayloadLengthBytes] = {0}; |
| 908 WebRtcRTPHeader rtp_header; | 909 WebRtcRTPHeader rtp_header; |
| 909 rtp_header.header.payloadType = kPayloadType; | 910 rtp_header.header.payloadType = kPayloadType; |
| 910 rtp_header.header.sequenceNumber = 0x1234; | 911 rtp_header.header.sequenceNumber = 0x1234; |
| 911 rtp_header.header.timestamp = 0x12345678; | 912 rtp_header.header.timestamp = 0x12345678; |
| 912 rtp_header.header.ssrc = 0x87654321; | 913 rtp_header.header.ssrc = 0x87654321; |
| 913 | 914 |
| 914 EXPECT_EQ(NetEq::kOK, neteq_->RegisterPayloadType( | 915 EXPECT_EQ(NetEq::kOK, neteq_->RegisterPayloadType( |
| 915 NetEqDecoder::kDecoderPCM16B, kPayloadType)); | 916 NetEqDecoder::kDecoderPCM16B, "", kPayloadType)); |
| 916 | 917 |
| 917 // Insert packets until the buffer flushes. | 918 // Insert packets until the buffer flushes. |
| 918 for (size_t i = 0; i <= config_.max_packets_in_buffer; ++i) { | 919 for (size_t i = 0; i <= config_.max_packets_in_buffer; ++i) { |
| 919 EXPECT_EQ(i, packet_buffer_->NumPacketsInBuffer()); | 920 EXPECT_EQ(i, packet_buffer_->NumPacketsInBuffer()); |
| 920 EXPECT_EQ(NetEq::kOK, | 921 EXPECT_EQ(NetEq::kOK, |
| 921 neteq_->InsertPacket(rtp_header, payload, kReceiveTime)); | 922 neteq_->InsertPacket(rtp_header, payload, kReceiveTime)); |
| 922 rtp_header.header.timestamp += | 923 rtp_header.header.timestamp += |
| 923 rtc::checked_cast<uint32_t>(kPayloadLengthSamples); | 924 rtc::checked_cast<uint32_t>(kPayloadLengthSamples); |
| 924 ++rtp_header.header.sequenceNumber; | 925 ++rtp_header.header.sequenceNumber; |
| 925 } | 926 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 961 // speech. That is, the decoded length is 5 samples shorter than the expected. | 962 // speech. That is, the decoded length is 5 samples shorter than the expected. |
| 962 EXPECT_CALL(mock_decoder, | 963 EXPECT_CALL(mock_decoder, |
| 963 DecodeInternal(_, kPayloadLengthBytes, kSampleRateHz, _, _)) | 964 DecodeInternal(_, kPayloadLengthBytes, kSampleRateHz, _, _)) |
| 964 .WillOnce( | 965 .WillOnce( |
| 965 DoAll(SetArrayArgument<3>(dummy_output, | 966 DoAll(SetArrayArgument<3>(dummy_output, |
| 966 dummy_output + kPayloadLengthSamples - 5), | 967 dummy_output + kPayloadLengthSamples - 5), |
| 967 SetArgPointee<4>(AudioDecoder::kSpeech), | 968 SetArgPointee<4>(AudioDecoder::kSpeech), |
| 968 Return(kPayloadLengthSamples - 5))); | 969 Return(kPayloadLengthSamples - 5))); |
| 969 EXPECT_EQ(NetEq::kOK, neteq_->RegisterExternalDecoder( | 970 EXPECT_EQ(NetEq::kOK, neteq_->RegisterExternalDecoder( |
| 970 &mock_decoder, NetEqDecoder::kDecoderPCM16B, | 971 &mock_decoder, NetEqDecoder::kDecoderPCM16B, |
| 971 kPayloadType, kSampleRateHz)); | 972 "dummy name", kPayloadType, kSampleRateHz)); |
| 972 | 973 |
| 973 // Insert one packet. | 974 // Insert one packet. |
| 974 EXPECT_EQ(NetEq::kOK, | 975 EXPECT_EQ(NetEq::kOK, |
| 975 neteq_->InsertPacket(rtp_header, payload, kReceiveTime)); | 976 neteq_->InsertPacket(rtp_header, payload, kReceiveTime)); |
| 976 | 977 |
| 977 EXPECT_EQ(5u, neteq_->sync_buffer_for_test()->FutureLength()); | 978 EXPECT_EQ(5u, neteq_->sync_buffer_for_test()->FutureLength()); |
| 978 | 979 |
| 979 // Pull audio once. | 980 // Pull audio once. |
| 980 const size_t kMaxOutputSize = static_cast<size_t>(10 * kSampleRateHz / 1000); | 981 const size_t kMaxOutputSize = static_cast<size_t>(10 * kSampleRateHz / 1000); |
| 981 int16_t output[kMaxOutputSize]; | 982 int16_t output[kMaxOutputSize]; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1056 .Times(2) | 1057 .Times(2) |
| 1057 .WillRepeatedly( | 1058 .WillRepeatedly( |
| 1058 DoAll(SetArrayArgument<3>(dummy_output, | 1059 DoAll(SetArrayArgument<3>(dummy_output, |
| 1059 dummy_output + kFrameLengthSamples), | 1060 dummy_output + kFrameLengthSamples), |
| 1060 SetArgPointee<4>(AudioDecoder::kSpeech), | 1061 SetArgPointee<4>(AudioDecoder::kSpeech), |
| 1061 Return(kFrameLengthSamples))); | 1062 Return(kFrameLengthSamples))); |
| 1062 } | 1063 } |
| 1063 | 1064 |
| 1064 EXPECT_EQ(NetEq::kOK, neteq_->RegisterExternalDecoder( | 1065 EXPECT_EQ(NetEq::kOK, neteq_->RegisterExternalDecoder( |
| 1065 &mock_decoder, NetEqDecoder::kDecoderPCM16B, | 1066 &mock_decoder, NetEqDecoder::kDecoderPCM16B, |
| 1066 kPayloadType, kSampleRateHz)); | 1067 "dummy name", kPayloadType, kSampleRateHz)); |
| 1067 | 1068 |
| 1068 // Insert packets. | 1069 // Insert packets. |
| 1069 for (int i = 0; i < 6; ++i) { | 1070 for (int i = 0; i < 6; ++i) { |
| 1070 rtp_header.header.sequenceNumber += 1; | 1071 rtp_header.header.sequenceNumber += 1; |
| 1071 rtp_header.header.timestamp += kFrameLengthSamples; | 1072 rtp_header.header.timestamp += kFrameLengthSamples; |
| 1072 EXPECT_EQ(NetEq::kOK, | 1073 EXPECT_EQ(NetEq::kOK, |
| 1073 neteq_->InsertPacket(rtp_header, payload, kReceiveTime)); | 1074 neteq_->InsertPacket(rtp_header, payload, kReceiveTime)); |
| 1074 } | 1075 } |
| 1075 | 1076 |
| 1076 // Pull audio. | 1077 // Pull audio. |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1177 .Times(2) | 1178 .Times(2) |
| 1178 .WillRepeatedly( | 1179 .WillRepeatedly( |
| 1179 DoAll(SetArrayArgument<3>(dummy_output, | 1180 DoAll(SetArrayArgument<3>(dummy_output, |
| 1180 dummy_output + kFrameLengthSamples), | 1181 dummy_output + kFrameLengthSamples), |
| 1181 SetArgPointee<4>(AudioDecoder::kComfortNoise), | 1182 SetArgPointee<4>(AudioDecoder::kComfortNoise), |
| 1182 Return(kFrameLengthSamples))); | 1183 Return(kFrameLengthSamples))); |
| 1183 } | 1184 } |
| 1184 | 1185 |
| 1185 EXPECT_EQ(NetEq::kOK, neteq_->RegisterExternalDecoder( | 1186 EXPECT_EQ(NetEq::kOK, neteq_->RegisterExternalDecoder( |
| 1186 &mock_decoder, NetEqDecoder::kDecoderPCM16B, | 1187 &mock_decoder, NetEqDecoder::kDecoderPCM16B, |
| 1187 kPayloadType, kSampleRateHz)); | 1188 "dummy name", kPayloadType, kSampleRateHz)); |
| 1188 | 1189 |
| 1189 // Insert 2 packets. This will make netEq into codec internal CNG mode. | 1190 // Insert 2 packets. This will make netEq into codec internal CNG mode. |
| 1190 for (int i = 0; i < 2; ++i) { | 1191 for (int i = 0; i < 2; ++i) { |
| 1191 rtp_header.header.sequenceNumber += 1; | 1192 rtp_header.header.sequenceNumber += 1; |
| 1192 rtp_header.header.timestamp += kFrameLengthSamples; | 1193 rtp_header.header.timestamp += kFrameLengthSamples; |
| 1193 EXPECT_EQ(NetEq::kOK, | 1194 EXPECT_EQ(NetEq::kOK, |
| 1194 neteq_->InsertPacket(rtp_header, payload, kReceiveTime)); | 1195 neteq_->InsertPacket(rtp_header, payload, kReceiveTime)); |
| 1195 } | 1196 } |
| 1196 | 1197 |
| 1197 // Pull audio. | 1198 // Pull audio. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1233 // Tests that the return value from last_output_sample_rate_hz() is equal to the | 1234 // Tests that the return value from last_output_sample_rate_hz() is equal to the |
| 1234 // configured inital sample rate. | 1235 // configured inital sample rate. |
| 1235 TEST_F(NetEqImplTest, InitialLastOutputSampleRate) { | 1236 TEST_F(NetEqImplTest, InitialLastOutputSampleRate) { |
| 1236 UseNoMocks(); | 1237 UseNoMocks(); |
| 1237 config_.sample_rate_hz = 48000; | 1238 config_.sample_rate_hz = 48000; |
| 1238 CreateInstance(); | 1239 CreateInstance(); |
| 1239 EXPECT_EQ(48000, neteq_->last_output_sample_rate_hz()); | 1240 EXPECT_EQ(48000, neteq_->last_output_sample_rate_hz()); |
| 1240 } | 1241 } |
| 1241 | 1242 |
| 1242 }// namespace webrtc | 1243 }// namespace webrtc |
| OLD | NEW |