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

Side by Side 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: Fix typo, leading to failed video catpure test 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 header->extension.audioLevel = 0; 247 header->extension.audioLevel = 0;
248 248
249 // May not be present in packet. 249 // May not be present in packet.
250 header->extension.hasVideoRotation = false; 250 header->extension.hasVideoRotation = false;
251 header->extension.videoRotation = kVideoRotation_0; 251 header->extension.videoRotation = kVideoRotation_0;
252 252
253 // May not be present in packet. 253 // May not be present in packet.
254 header->extension.playout_delay.min_ms = -1; 254 header->extension.playout_delay.min_ms = -1;
255 header->extension.playout_delay.max_ms = -1; 255 header->extension.playout_delay.max_ms = -1;
256 256
257 // May not be present in packet.
258 header->extension.hasVideoContentType = false;
259 header->extension.videoContentType = VideoContentType::UNSPECIFIED;
260
257 if (X) { 261 if (X) {
258 /* RTP header extension, RFC 3550. 262 /* RTP header extension, RFC 3550.
259 0 1 2 3 263 0 1 2 3
260 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 264 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
261 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 265 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
262 | defined by profile | length | 266 | defined by profile | length |
263 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 267 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
264 | header extension | 268 | header extension |
265 | .... | 269 | .... |
266 */ 270 */
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 443 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
440 444
441 int min_playout_delay = (ptr[0] << 4) | ((ptr[1] >> 4) & 0xf); 445 int min_playout_delay = (ptr[0] << 4) | ((ptr[1] >> 4) & 0xf);
442 int max_playout_delay = ((ptr[1] & 0xf) << 8) | ptr[2]; 446 int max_playout_delay = ((ptr[1] & 0xf) << 8) | ptr[2];
443 header->extension.playout_delay.min_ms = 447 header->extension.playout_delay.min_ms =
444 min_playout_delay * PlayoutDelayLimits::kGranularityMs; 448 min_playout_delay * PlayoutDelayLimits::kGranularityMs;
445 header->extension.playout_delay.max_ms = 449 header->extension.playout_delay.max_ms =
446 max_playout_delay * PlayoutDelayLimits::kGranularityMs; 450 max_playout_delay * PlayoutDelayLimits::kGranularityMs;
447 break; 451 break;
448 } 452 }
453 case kRtpExtensionVideoContentType: {
454 if (len != 0) {
455 LOG(LS_WARNING) << "Incorrect video content type len: " << len;
456 return;
457 }
458 // 0 1
459 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
460 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
461 // | ID | len=0 | Content type |
462 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
463
464 if (ptr[0] <
465 static_cast<uint8_t>(VideoContentType::TOTAL_CONTENT_TYPES)) {
466 header->extension.hasVideoContentType = true;
467 header->extension.videoContentType =
468 static_cast<VideoContentType>(ptr[0]);
469 }
470 break;
471 }
449 case kRtpExtensionNone: 472 case kRtpExtensionNone:
450 case kRtpExtensionNumberOfExtensions: { 473 case kRtpExtensionNumberOfExtensions: {
451 RTC_NOTREACHED() << "Invalid extension type: " << type; 474 RTC_NOTREACHED() << "Invalid extension type: " << type;
452 return; 475 return;
453 } 476 }
454 } 477 }
455 } 478 }
456 ptr += (len + 1); 479 ptr += (len + 1);
457 } 480 }
458 } 481 }
459 482
460 } // namespace RtpUtility 483 } // namespace RtpUtility
461 } // namespace webrtc 484 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_sender_video.cc ('k') | webrtc/modules/video_capture/video_capture_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698