Break out RtpClock to system_wrappers and make it more generic.

The goal with this new clock interface is to have something which is used all
over WebRTC to make it easier to switch clock implementation depending on where
the components are used. This is a first step in that direction.

Next steps will be to, step by step, move all modules, video engine and voice
engine over to the new interface, effectively deprecating the old clock
interfaces. Long-term my vision is that we should be able to deprecate the clock
of WebRTC and rely on the user providing the implementation.

TEST=vie_auto_test, rtp_rtcp_unittests, trybots

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3381 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
stefan@webrtc.org
2013-01-17 14:01:20 +00:00
parent 3b7feb2a5d
commit 20ed36dada
31 changed files with 468 additions and 379 deletions

View File

@ -22,7 +22,7 @@
namespace webrtc {
RTPSender::RTPSender(const WebRtc_Word32 id,
const bool audio,
RtpRtcpClock* clock,
Clock* clock,
Transport* transport,
RtpAudioFeedback* audio_feedback,
PacedSender* paced_sender)
@ -75,7 +75,7 @@ RTPSender::RTPSender(const WebRtc_Word32 id,
memset(_nackByteCount, 0, sizeof(_nackByteCount));
memset(_CSRC, 0, sizeof(_CSRC));
// We need to seed the random generator.
srand( (WebRtc_UWord32)clock_.GetTimeInMS() );
srand( (WebRtc_UWord32)clock_.TimeInMilliseconds() );
_ssrc = _ssrcDB.CreateSSRC(); // Can't be 0.
if (audio) {
@ -576,7 +576,7 @@ int RTPSender::SetSelectiveRetransmissions(uint8_t settings) {
void RTPSender::OnReceivedNACK(const WebRtc_UWord16 nackSequenceNumbersLength,
const WebRtc_UWord16* nackSequenceNumbers,
const WebRtc_UWord16 avgRTT) {
const WebRtc_Word64 now = clock_.GetTimeInMS();
const WebRtc_Word64 now = clock_.TimeInMilliseconds();
WebRtc_UWord32 bytesReSent = 0;
// Enough bandwidth to send NACK?
@ -700,7 +700,7 @@ void RTPSender::TimeToSendPacket(uint16_t sequence_number,
WebRtcRTPHeader rtp_header;
rtpParser.Parse(rtp_header);
int64_t diff_ms = clock_.GetTimeInMS() - capture_time_ms;
int64_t diff_ms = clock_.TimeInMilliseconds() - capture_time_ms;
if (UpdateTransmissionTimeOffset(data_buffer, length, rtp_header, diff_ms)) {
// Update stored packet in case of receiving a re-transmission request.
_packetHistory->ReplaceRTPHeader(data_buffer,
@ -738,7 +738,7 @@ WebRtc_Word32 RTPSender::SendToNetwork(uint8_t* buffer,
// TODO(holmer): This should be changed all over Video Engine so that negative
// time is consider invalid, while 0 is considered a valid time.
if (capture_time_ms > 0) {
int64_t time_now = clock_.GetTimeInMS();
int64_t time_now = clock_.TimeInMilliseconds();
UpdateTransmissionTimeOffset(buffer, payload_length + rtp_header_length,
rtp_header, time_now - capture_time_ms);
}