NetEq::GetPlayoutTimestamp returns empty during CNG
With this change, the return value from NetEq::GetPlayoutTimestamp is
empty if the latest call to NetEq::GetAudio resulted in comfort noise
(codec-internal or external) being played out. This is because the
playout timestamp is not updated during CNG, and can therefore not be
trusted.
A few unit tests were updated to reflect the change.
BUG=webrtc:5669
Review URL: https://codereview.webrtc.org/1861303002
Cr-Commit-Position: refs/heads/master@{#12268}
diff --git a/webrtc/modules/audio_coding/neteq/neteq_impl.cc b/webrtc/modules/audio_coding/neteq/neteq_impl.cc
index 40a0314..db37e71 100644
--- a/webrtc/modules/audio_coding/neteq/neteq_impl.cc
+++ b/webrtc/modules/audio_coding/neteq/neteq_impl.cc
@@ -403,9 +403,11 @@
rtc::Optional<uint32_t> NetEqImpl::GetPlayoutTimestamp() const {
rtc::CritScope lock(&crit_sect_);
- if (first_packet_) {
+ if (first_packet_ || last_mode_ == kModeRfc3389Cng ||
+ last_mode_ == kModeCodecInternalCng) {
// We don't have a valid RTP timestamp until we have decoded our first
- // RTP packet.
+ // RTP packet. Also, the RTP timestamp is not accurate while playing CNG,
+ // which is indicated by returning an empty value.
return rtc::Optional<uint32_t>();
}
return rtc::Optional<uint32_t>(