Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Unified Diff: webrtc/modules/rtp_rtcp/source/rtp_utility.cc

Issue 2007743003: Add sender controlled playout delay limits (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@cleanup_rtp_hdr_extensions
Patch Set: Rename OnReceivedRtcpReport to OnReceivedRtcpReportBlocks Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;

Powered by Google App Engine
This is Rietveld 408576698