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

Unified Diff: webrtc/modules/audio_coding/neteq/neteq_impl_unittest.cc

Issue 1861303002: NetEq::GetPlayoutTimestamp returns empty during CNG (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@neteq-set-audio-frame-ts
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
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 1353d108eab941100a7fc14051b5235c1d840326..3a2710fde6e4579de3f489327d44d561eb10f7ce 100644
--- a/webrtc/modules/audio_coding/neteq/neteq_impl_unittest.cc
+++ b/webrtc/modules/audio_coding/neteq/neteq_impl_unittest.cc
@@ -666,6 +666,12 @@ TEST_F(NetEqImplTest, CodecInternalCng) {
EXPECT_CALL(mock_decoder, Channels()).WillRepeatedly(Return(1));
EXPECT_CALL(mock_decoder, IncomingPacket(_, kPayloadLengthBytes, _, _, _))
.WillRepeatedly(Return(0));
+ EXPECT_CALL(mock_decoder, PacketDuration(_, kPayloadLengthBytes))
hlundin-webrtc 2016/04/06 11:13:58 These new EXPEC_CALLs are unrelated to this CL, bu
+ .WillRepeatedly(Return(kPayloadLengthSamples));
+ // Packed duration when asking the decoder for more CNG data (without a new
+ // packet).
+ EXPECT_CALL(mock_decoder, PacketDuration(nullptr, 0))
+ .WillRepeatedly(Return(kPayloadLengthSamples));
// Pointee(x) verifies that first byte of the payload equals x, this makes it
// possible to verify that the correct payload is fed to Decode().
@@ -736,13 +742,16 @@ TEST_F(NetEqImplTest, CodecInternalCng) {
ASSERT_EQ(kMaxOutputSize, output.samples_per_channel_);
EXPECT_EQ(1u, output.num_channels_);
EXPECT_EQ(expected_type[i - 1], output.speech_type_);
- rtc::Optional<uint32_t> timestamp = neteq_->GetPlayoutTimestamp();
- EXPECT_TRUE(timestamp);
EXPECT_EQ(NetEq::kOK, neteq_->GetAudio(&output));
- timestamp = neteq_->GetPlayoutTimestamp();
- ASSERT_TRUE(timestamp);
- EXPECT_EQ(*timestamp, *last_timestamp + expected_timestamp_increment[i]);
- last_timestamp = timestamp;
+ rtc::Optional<uint32_t> timestamp = neteq_->GetPlayoutTimestamp();
+ if (output.speech_type_ == AudioFrame::kNormalSpeech) {
+ ASSERT_TRUE(timestamp);
+ EXPECT_EQ(*timestamp, *last_timestamp + expected_timestamp_increment[i]);
+ last_timestamp = timestamp;
+ } else {
+ // Expect to get an empty timestamp value during CNG and PLC.
+ EXPECT_FALSE(timestamp);
+ }
}
// Insert third packet, which leaves a gap from last packet.

Powered by Google App Engine
This is Rietveld 408576698