Index: webrtc/modules/rtp_rtcp/source/rtp_utility.cc |
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_utility.cc b/webrtc/modules/rtp_rtcp/source/rtp_utility.cc |
index bdae3c4806fc24d0a55814f57747d1f80df6d86c..131b54ad50ee47f4bf9bded80dbc3aba864200d5 100644 |
--- a/webrtc/modules/rtp_rtcp/source/rtp_utility.cc |
+++ b/webrtc/modules/rtp_rtcp/source/rtp_utility.cc |
@@ -248,6 +248,10 @@ bool RtpHeaderParser::Parse(RTPHeader* header, |
header->extension.hasVideoRotation = false; |
header->extension.videoRotation = 0; |
+ // May not be present in packet. |
+ header->extension.playout_delay.min_ms = -1; |
+ header->extension.playout_delay.max_ms = -1; |
+ |
if (X) { |
/* RTP header extension, RFC 3550. |
0 1 2 3 |
@@ -407,6 +411,25 @@ void RtpHeaderParser::ParseOneByteExtensionHeader( |
header->extension.hasTransportSequenceNumber = true; |
break; |
} |
+ case kRtpExtensionPlayoutDelay: { |
+ if (len != 2) { |
+ LOG(LS_WARNING) << "Incorrect playout delay len: " << len; |
+ return; |
+ } |
+ // 0 1 2 3 |
+ // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
+ // | ID | len=2 | MIN delay | MAX delay | |
+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
+ |
+ int min_playout_delay = (ptr[0] << 4) | ((ptr[1] >> 4) & 0xf); |
+ int max_playout_delay = ((ptr[1] & 0xf) << 8) | ptr[2]; |
+ header->extension.playout_delay.min_ms = |
+ min_playout_delay * kPlayoutDelayGranularityMs; |
+ header->extension.playout_delay.max_ms = |
+ max_playout_delay * kPlayoutDelayGranularityMs; |
+ break; |
+ } |
default: { |
LOG(LS_WARNING) << "Extension type not implemented: " << type; |
return; |