From 167b6dfc73fc2f4c47713bcbd89b58c52612983b Mon Sep 17 00:00:00 2001 From: "turaj@webrtc.org" Date: Fri, 13 Dec 2013 21:05:07 +0000 Subject: [PATCH] Fix jitter buffer delay estimate. BUG=b/12099925 R=niklas.enbom@webrtc.org, niklase@google.com, stefan@webrtc.org Review URL: https://webrtc-codereview.appspot.com/5739004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5289 4adac7df-926f-26a2-2b94-8c16560cd09d --- webrtc/voice_engine/channel.cc | 11 +++++++---- webrtc/voice_engine/channel.h | 3 +++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/webrtc/voice_engine/channel.cc b/webrtc/voice_engine/channel.cc index 4e1913dc35..1eb55afa24 100644 --- a/webrtc/voice_engine/channel.cc +++ b/webrtc/voice_engine/channel.cc @@ -906,6 +906,7 @@ Channel::Channel(int32_t channelId, _decryptionRTCPBufferPtr(NULL), _timeStamp(0), // This is just an offset, RTP module will add it's own random offset _sendTelephoneEventPayloadType(106), + jitter_buffer_playout_timestamp_(0), playout_timestamp_rtp_(0), playout_timestamp_rtcp_(0), _numberOfDiscardedPackets(0), @@ -4718,6 +4719,8 @@ void Channel::UpdatePlayoutTimestamp(bool rtcp) { } } + jitter_buffer_playout_timestamp_ = playout_timestamp; + // Remove the playout delay. playout_timestamp -= (delay_ms * (playout_frequency / 1000)); @@ -5071,10 +5074,10 @@ void Channel::UpdatePacketDelay(uint32_t rtp_timestamp, rtp_receive_frequency = 48000; } - // playout_timestamp_rtp_ updated in UpdatePlayoutTimestamp for every incoming - // packet. - uint32_t timestamp_diff_ms = (rtp_timestamp - playout_timestamp_rtp_) / - (rtp_receive_frequency / 1000); + // |jitter_buffer_playout_timestamp_| updated in UpdatePlayoutTimestamp for + // every incoming packet. + uint32_t timestamp_diff_ms = (rtp_timestamp - + jitter_buffer_playout_timestamp_) / (rtp_receive_frequency / 1000); uint16_t packet_delay_ms = (rtp_timestamp - _previousTimestamp) / (rtp_receive_frequency / 1000); diff --git a/webrtc/voice_engine/channel.h b/webrtc/voice_engine/channel.h index da55e9d765..f8b04fdd18 100644 --- a/webrtc/voice_engine/channel.h +++ b/webrtc/voice_engine/channel.h @@ -489,6 +489,9 @@ private: uint8_t* _decryptionRTCPBufferPtr; uint32_t _timeStamp; uint8_t _sendTelephoneEventPayloadType; + + // Timestamp of the audio pulled from NetEq. + uint32_t jitter_buffer_playout_timestamp_; uint32_t playout_timestamp_rtp_; uint32_t playout_timestamp_rtcp_; uint32_t playout_delay_ms_;