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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtp_utility.cc

Issue 2954503002: Implement FrameMarking header extension support
Patch Set: Implement Frame Marking header extension Created 3 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 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 header->extension.videoRotation = kVideoRotation_0; 246 header->extension.videoRotation = kVideoRotation_0;
247 247
248 // May not be present in packet. 248 // May not be present in packet.
249 header->extension.playout_delay.min_ms = -1; 249 header->extension.playout_delay.min_ms = -1;
250 header->extension.playout_delay.max_ms = -1; 250 header->extension.playout_delay.max_ms = -1;
251 251
252 // May not be present in packet. 252 // May not be present in packet.
253 header->extension.hasVideoContentType = false; 253 header->extension.hasVideoContentType = false;
254 header->extension.videoContentType = VideoContentType::UNSPECIFIED; 254 header->extension.videoContentType = VideoContentType::UNSPECIFIED;
255 255
256 // May not be present in packet.
257 header->extension.hasFrameMarks = false;
258
256 if (X) { 259 if (X) {
257 /* RTP header extension, RFC 3550. 260 /* RTP header extension, RFC 3550.
258 0 1 2 3 261 0 1 2 3
259 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 262 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
260 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 263 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
261 | defined by profile | length | 264 | defined by profile | length |
262 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 265 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
263 | header extension | 266 | header extension |
264 | .... | 267 | .... |
265 */ 268 */
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 } 469 }
467 case kRtpExtensionRtpStreamId: { 470 case kRtpExtensionRtpStreamId: {
468 header->extension.stream_id.Set(rtc::MakeArrayView(ptr, len + 1)); 471 header->extension.stream_id.Set(rtc::MakeArrayView(ptr, len + 1));
469 break; 472 break;
470 } 473 }
471 case kRtpExtensionRepairedRtpStreamId: { 474 case kRtpExtensionRepairedRtpStreamId: {
472 header->extension.repaired_stream_id.Set( 475 header->extension.repaired_stream_id.Set(
473 rtc::MakeArrayView(ptr, len + 1)); 476 rtc::MakeArrayView(ptr, len + 1));
474 break; 477 break;
475 } 478 }
479 case kRtpExtensionFrameMarking: {
480 if (len != 0 && len != 2) {
481 LOG(LS_WARNING) << "Incorrect frame marking len: " << len;
482 return;
483 }
484 // For Frame Marking RTP Header Extension:
danilchap 2017/06/28 16:07:07 may be reuse parsing code: header->extension.has_f
sergio.garcia.murillo 2017/06/29 12:58:58 Acknowledged.
485 //
486 // https://tools.ietf.org/html/draft-ietf-avtext-framemarking-04
487 // This extensions provides meta-information about the RTP streams
488 // outside the encrypted media payload, an RTP switch can do
489 // codec-agnostic selective forwarding without decrypting the payload
490 //
491 // for Non-Scalable Streams
492 //
493 // 0 1
494 // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
495 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
496 // | ID=? | L=0 |S|E|I|D|0 0 0 0|
497 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
498 //
499 // for Scalable Streams
500 //
501 // 0 1 2 3
502 // 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
503 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
504 // | ID=? | L=2 |S|E|I|D|B| TID | LID | TL0PICIDX |
505 // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
506 //
507 // Set frame marking data
508 header->extension.frameMarks.startOfFrame = (ptr[0] & 0x80) != 0;
509 header->extension.frameMarks.endOfFrame = (ptr[0] & 0x40) != 0;
510 header->extension.frameMarks.independent = (ptr[0] & 0x20) != 0;
511 header->extension.frameMarks.discardable = (ptr[0] & 0x10) != 0;
512
513 // Check variable length
514 if (len==1) {
515 // We are non-scalable
516 header->extension.frameMarks.baseLayerSync = 0;
517 header->extension.frameMarks.temporalLayerId = 0;
518 header->extension.frameMarks.spatialLayerId = 0;
519 header->extension.frameMarks.tl0PicIdx = 0;
520 } else if (len==3) {
521 // Set scalable parts
522 header->extension.frameMarks.baseLayerSync = (ptr[0] & 0x08) != 0;
523 header->extension.frameMarks.temporalLayerId = (ptr[0] & 0x07) != 0;
524 header->extension.frameMarks.spatialLayerId = ptr[1];
525 header->extension.frameMarks.tl0PicIdx = ptr[2];
526 }
527 break;
528 }
476 case kRtpExtensionNone: 529 case kRtpExtensionNone:
477 case kRtpExtensionNumberOfExtensions: { 530 case kRtpExtensionNumberOfExtensions: {
478 RTC_NOTREACHED() << "Invalid extension type: " << type; 531 RTC_NOTREACHED() << "Invalid extension type: " << type;
479 return; 532 return;
480 } 533 }
481 } 534 }
482 } 535 }
483 ptr += (len + 1); 536 ptr += (len + 1);
484 } 537 }
485 } 538 }
486 539
487 } // namespace RtpUtility 540 } // namespace RtpUtility
488 } // namespace webrtc 541 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698