Chromium Code Reviews| Index: webrtc/modules/audio_coding/neteq/neteq_impl_unittest.cc |
| diff --git a/webrtc/modules/audio_coding/neteq/neteq_impl_unittest.cc b/webrtc/modules/audio_coding/neteq/neteq_impl_unittest.cc |
| index 1859e566e7d2cb4d728d69effea09932619d8c34..777a05c1c40421031d9c8d47f8d65a3fb556dc05 100644 |
| --- a/webrtc/modules/audio_coding/neteq/neteq_impl_unittest.cc |
| +++ b/webrtc/modules/audio_coding/neteq/neteq_impl_unittest.cc |
| @@ -173,6 +173,40 @@ class NetEqImplTest : public ::testing::Test { |
| } |
| } |
| + void TestDtmfPacket(NetEqDecoder decoder_type) { |
| + UseNoMocks(); |
| + CreateInstance(); |
| + const size_t kPayloadLength = 4; |
| + const uint8_t kPayloadType = 110; |
| + const uint32_t kReceiveTime = 17; |
| + const int kSampleRateHz = 8000; |
|
ossu
2016/10/11 17:56:17
So DTMF sample rate doesn't depend on clock rate,
the sun
2016/10/11 19:17:17
The sample rate is set when NetEq is constructed a
|
| + // Event: 2, E bit, Volume: 0x3F, Length: 0x10F0. |
| + uint8_t payload[kPayloadLength] = { 0x02, 0x80 + 0x3F, 0x10, 0xF0 }; |
| + WebRtcRTPHeader rtp_header; |
| + rtp_header.header.payloadType = kPayloadType; |
| + rtp_header.header.sequenceNumber = 0x1234; |
| + rtp_header.header.timestamp = 0x12345678; |
| + rtp_header.header.ssrc = 0x87654321; |
| + |
| + EXPECT_EQ(NetEq::kOK, neteq_->RegisterPayloadType( |
| + decoder_type, "telephone-event", kPayloadType)); |
| + |
| + // Insert first packet. |
| + EXPECT_EQ(NetEq::kOK, |
| + neteq_->InsertPacket(rtp_header, payload, kReceiveTime)); |
| + |
| + // Pull audio once. |
| + const size_t kMaxOutputSize = |
| + static_cast<size_t>(10 * kSampleRateHz / 1000); |
| + AudioFrame output; |
| + bool muted; |
| + EXPECT_EQ(NetEq::kOK, neteq_->GetAudio(&output, &muted)); |
| + ASSERT_FALSE(muted); |
| + ASSERT_EQ(kMaxOutputSize, output.samples_per_channel_); |
| + EXPECT_EQ(1u, output.num_channels_); |
| + EXPECT_EQ(AudioFrame::kNormalSpeech, output.speech_type_); |
|
ossu
2016/10/11 17:56:18
Do you want to check that there is actually audio
the sun
2016/10/11 19:17:17
Done.
|
| + } |
| + |
| std::unique_ptr<NetEqImpl> neteq_; |
| NetEq::Config config_; |
| TickTimer* tick_timer_ = nullptr; |
| @@ -381,6 +415,22 @@ TEST_F(NetEqImplTest, InsertPacketsUntilBufferIsFull) { |
| EXPECT_EQ(rtp_header.header.sequenceNumber, test_header->sequenceNumber); |
| } |
| +TEST_F(NetEqImplTest, TestDtmfPacketAVT) { |
| + TestDtmfPacket(NetEqDecoder::kDecoderAVT); |
| +} |
| + |
| +TEST_F(NetEqImplTest, TestDtmfPacketAVT16kHz) { |
| + TestDtmfPacket(NetEqDecoder::kDecoderAVT16kHz); |
| +} |
| + |
| +TEST_F(NetEqImplTest, TestDtmfPacketAVT32kHz) { |
| + TestDtmfPacket(NetEqDecoder::kDecoderAVT32kHz); |
| +} |
| + |
| +TEST_F(NetEqImplTest, TestDtmfPacketAVT48kHz) { |
| + TestDtmfPacket(NetEqDecoder::kDecoderAVT48kHz); |
| +} |
| + |
| // This test verifies that timestamps propagate from the incoming packets |
| // through to the sync buffer and to the playout timestamp. |
| TEST_F(NetEqImplTest, VerifyTimestampPropagation) { |