Calculate capture ntp timestamp in local timebase for decoded audio frame.

BUG=3111
R=stefan@webrtc.org, xians@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/19449005

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6205 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
wu@webrtc.org
2014-05-20 22:55:01 +00:00
parent 48438c2c90
commit 82c4b8531c
2 changed files with 9 additions and 2 deletions

View File

@ -15,6 +15,7 @@
#include "webrtc/modules/audio_processing/include/audio_processing.h"
#include "webrtc/modules/interface/module_common_types.h"
#include "webrtc/modules/rtp_rtcp/interface/receive_statistics.h"
#include "webrtc/modules/rtp_rtcp/interface/remote_ntp_time_estimator.h"
#include "webrtc/modules/rtp_rtcp/interface/rtp_payload_registry.h"
#include "webrtc/modules/rtp_rtcp/interface/rtp_receiver.h"
#include "webrtc/modules/rtp_rtcp/source/rtp_receiver_strategy.h"
@ -664,8 +665,7 @@ int32_t Channel::GetAudioFrame(int32_t id, AudioFrame& audioFrame)
// Measure audio level (0-9)
_outputAudioLevel.ComputeLevel(audioFrame);
// TODO(wu): Calculate capture NTP time based on RTP timestamp and RTCP SR.
audioFrame.ntp_time_ms_ = 0;
audioFrame.ntp_time_ms_ = ntp_estimator_->Estimate(audioFrame.timestamp_);
if (!first_frame_arrived_) {
first_frame_arrived_ = true;
@ -849,6 +849,7 @@ Channel::Channel(int32_t channelId,
_outputExternalMediaCallbackPtr(NULL),
_timeStamp(0), // This is just an offset, RTP module will add it's own random offset
_sendTelephoneEventPayloadType(106),
ntp_estimator_(new RemoteNtpTimeEstimator(Clock::GetRealTimeClock())),
jitter_buffer_playout_timestamp_(0),
playout_timestamp_rtp_(0),
playout_timestamp_rtcp_(0),
@ -1875,6 +1876,9 @@ int32_t Channel::ReceivedRTCPPacket(const int8_t* data, int32_t length) {
VE_SOCKET_TRANSPORT_MODULE_ERROR, kTraceWarning,
"Channel::IncomingRTPPacket() RTCP packet is invalid");
}
ntp_estimator_->UpdateRtcpTimestamp(rtp_receiver_->SSRC(),
_rtpRtcpModule.get());
return 0;
}

View File

@ -42,6 +42,7 @@ class CriticalSectionWrapper;
class FileWrapper;
class ProcessThread;
class ReceiveStatistics;
class RemoteNtpTimeEstimator;
class RtpDump;
class RTPPayloadRegistry;
class RtpReceiver;
@ -531,6 +532,8 @@ private:
uint32_t _timeStamp;
uint8_t _sendTelephoneEventPayloadType;
scoped_ptr<RemoteNtpTimeEstimator> ntp_estimator_;
// Timestamp of the audio pulled from NetEq.
uint32_t jitter_buffer_playout_timestamp_;
uint32_t playout_timestamp_rtp_;