From ba853c9970588fc1451eaf4489c8309809b414df Mon Sep 17 00:00:00 2001 From: "mflodman@webrtc.org" Date: Fri, 10 Aug 2012 14:30:53 +0000 Subject: [PATCH] Fixes for RTP extension time offset. Review URL: https://webrtc-codereview.appspot.com/720008 git-svn-id: http://webrtc.googlecode.com/svn/trunk@2592 4adac7df-926f-26a2-2b94-8c16560cd09d --- src/modules/rtp_rtcp/source/rtp_sender.cc | 9 +++++---- src/modules/rtp_rtcp/source/rtp_sender.h | 2 +- src/modules/rtp_rtcp/source/rtp_utility.cc | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/modules/rtp_rtcp/source/rtp_sender.cc b/src/modules/rtp_rtcp/source/rtp_sender.cc index 5bfb76aa1..8652ff812 100644 --- a/src/modules/rtp_rtcp/source/rtp_sender.cc +++ b/src/modules/rtp_rtcp/source/rtp_sender.cc @@ -917,7 +917,7 @@ RTPSender::SendToNetwork(WebRtc_UWord8* buffer, if (capture_time_ms >= 0) { ModuleRTPUtility::RTPHeaderParser rtpParser(buffer, length); WebRtcRTPHeader rtp_header; - rtpParser.Parse(rtp_header); + rtpParser.Parse(rtp_header, &_rtpHeaderExtensionMap); int64_t time_now = _clock.GetTimeInMS(); UpdateTransmissionTimeOffset(buffer, length, rtp_header, time_now - capture_time_ms); @@ -1172,7 +1172,7 @@ void RTPSender::UpdateTransmissionTimeOffset( WebRtc_UWord8* rtp_packet, const WebRtc_UWord16 rtp_packet_length, const WebRtcRTPHeader& rtp_header, - const WebRtc_Word64 time_ms) const { + const WebRtc_Word64 time_diff_ms) const { CriticalSectionScoped cs(_sendCritsect); // Get length until start of transmission block. @@ -1186,7 +1186,8 @@ void RTPSender::UpdateTransmissionTimeOffset( } int block_pos = 12 + rtp_header.header.numCSRCs + transmission_block_pos; - if ((rtp_packet_length < block_pos + 4)) { + if (rtp_packet_length < block_pos + 4 || + rtp_header.header.headerLength < block_pos + 4) { WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, _id, "Failed to update transmission time offset, invalid length."); return; @@ -1219,7 +1220,7 @@ void RTPSender::UpdateTransmissionTimeOffset( // Update transmission offset field. ModuleRTPUtility::AssignUWord24ToBuffer(rtp_packet + block_pos + 1, - time_ms * 90); // RTP timestamp + time_diff_ms * 90); // RTP timestamp. } WebRtc_Word32 diff --git a/src/modules/rtp_rtcp/source/rtp_sender.h b/src/modules/rtp_rtcp/source/rtp_sender.h index eadfca33b..4c843a710 100644 --- a/src/modules/rtp_rtcp/source/rtp_sender.h +++ b/src/modules/rtp_rtcp/source/rtp_sender.h @@ -166,7 +166,7 @@ public: void UpdateTransmissionTimeOffset(WebRtc_UWord8* rtp_packet, const WebRtc_UWord16 rtp_packet_length, const WebRtcRTPHeader& rtp_header, - const WebRtc_Word64 time_ms) const; + const WebRtc_Word64 time_diff_ms) const; void SetTransmissionSmoothingStatus(const bool enable); diff --git a/src/modules/rtp_rtcp/source/rtp_utility.cc b/src/modules/rtp_rtcp/source/rtp_utility.cc index 5123278b3..67d53afd5 100644 --- a/src/modules/rtp_rtcp/source/rtp_utility.cc +++ b/src/modules/rtp_rtcp/source/rtp_utility.cc @@ -608,7 +608,7 @@ void RTPHeaderParser::ParseOneByteExtensionHeader( const WebRtc_UWord8* ptrRTPDataExtensionEnd, const WebRtc_UWord8* ptr) const { if (!ptrExtensionMap) { - WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, -1, "No extension map."); + WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, -1, "No extension map."); return; } @@ -676,7 +676,7 @@ void RTPHeaderParser::ParseOneByteExtensionHeader( break; } default: { - WEBRTC_TRACE(kTraceWarning, kTraceRtpRtcp, -1, + WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, -1, "Extension type not implemented."); return; }