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

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

Issue 1863993002: Move setting of AudioFrame::timestamp_ into NetEq (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@neteq-empty-playout-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.cc
diff --git a/webrtc/modules/audio_coding/neteq/neteq_impl.cc b/webrtc/modules/audio_coding/neteq/neteq_impl.cc
index b4dfc9986dace2a1b94bf8545785ce83a83c12bd..40a031421eb96e2bcfed865408ca2c7b8dea9555 100644
--- a/webrtc/modules/audio_coding/neteq/neteq_impl.cc
+++ b/webrtc/modules/audio_coding/neteq/neteq_impl.cc
@@ -401,7 +401,7 @@ void NetEqImpl::DisableVad() {
vad_->Disable();
}
-rtc::Optional<uint32_t> NetEqImpl::GetPlayoutTimestamp() {
+rtc::Optional<uint32_t> NetEqImpl::GetPlayoutTimestamp() const {
rtc::CritScope lock(&crit_sect_);
if (first_packet_) {
// We don't have a valid RTP timestamp until we have decoded our first
@@ -966,6 +966,15 @@ int NetEqImpl::GetAudioInternal(AudioFrame* audio_frame) {
// Use dead reckoning to estimate the |playout_timestamp_|.
playout_timestamp_ += static_cast<uint32_t>(output_size_samples_);
}
+ // Set the timestamp in the audio frame to zero before the first packet has
+ // been inserted. Otherwise, subtract the frame size in samples to get the
+ // timestamp of the first sample in the frame (playout_timestamp_ is the
+ // last + 1).
+ audio_frame->timestamp_ =
minyue-webrtc 2016/04/06 11:16:26 maybe too many lines here
hlundin-webrtc 2016/04/06 11:18:21 This is what git cl format gave me, and I'd rather
+ first_packet_
+ ? 0
+ : timestamp_scaler_->ToExternal(playout_timestamp_) -
+ static_cast<uint32_t>(audio_frame->samples_per_channel_);
if (decode_return_value) return decode_return_value;
return return_value;

Powered by Google App Engine
This is Rietveld 408576698