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

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

Issue 2772033002: Add content type information to encoded images and corresponding rtp extension header (Closed)
Patch Set: Rebase Created 3 years, 8 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 def431f1709499993bac608a993aa0c49e33bc1b..7ee9107c4389d94f3b9b016c254d7fbbaa977cd6 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_utility.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_utility.cc
@@ -254,6 +254,10 @@ bool RtpHeaderParser::Parse(RTPHeader* header,
header->extension.playout_delay.min_ms = -1;
header->extension.playout_delay.max_ms = -1;
+ // May not be present in packet.
+ header->extension.hasVideoContentType = false;
+ header->extension.videoContentType = VideoContentType::kUnspecified;
+
if (X) {
/* RTP header extension, RFC 3550.
0 1 2 3
@@ -446,6 +450,25 @@ void RtpHeaderParser::ParseOneByteExtensionHeader(
max_playout_delay * PlayoutDelayLimits::kGranularityMs;
break;
}
+ case kRtpExtensionVideoContentType: {
+ if (len != 0) {
+ LOG(LS_WARNING) << "Incorrect video content type len: " << len;
+ return;
+ }
+ // 0 1
+ // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ // | ID | len=0 | Content type |
+ // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+ if (ptr[0] <
+ static_cast<uint8_t>(VideoContentType::kTotalContentTypes)) {
tommi 2017/04/10 10:59:18 safe cast?
ilnik 2017/04/10 12:47:42 It's safe now. VideoContentType underlying type is
+ header->extension.hasVideoContentType = true;
+ header->extension.videoContentType =
+ static_cast<VideoContentType>(ptr[0]);
+ }
+ break;
+ }
case kRtpExtensionNone:
case kRtpExtensionNumberOfExtensions: {
RTC_NOTREACHED() << "Invalid extension type: " << type;

Powered by Google App Engine
This is Rietveld 408576698