Frame marking RTP header extension (PART 1: implement extension)

Bug: webrtc:7765
Change-Id: I23896d121afd6be4bce5ff4deaf736149efebcdb
Reviewed-on: https://webrtc-review.googlesource.com/85200
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Stefan Holmer <stefan@webrtc.org>
Reviewed-by: Sergey Silkin <ssilkin@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24695}
diff --git a/api/rtp_headers.cc b/api/rtp_headers.cc
index a0b1a15..da7f1ea 100644
--- a/api/rtp_headers.cc
+++ b/api/rtp_headers.cc
@@ -34,7 +34,9 @@
       videoRotation(kVideoRotation_0),
       hasVideoContentType(false),
       videoContentType(VideoContentType::UNSPECIFIED),
-      has_video_timing(false) {}
+      has_video_timing(false),
+      has_frame_marking(false),
+      frame_marking({false, false, false, false, false, 0xFF, 0, 0}) {}
 
 RTPHeaderExtension::RTPHeaderExtension(const RTPHeaderExtension& other) =
     default;
diff --git a/api/rtp_headers.h b/api/rtp_headers.h
index c762534..41f3988 100644
--- a/api/rtp_headers.h
+++ b/api/rtp_headers.h
@@ -19,6 +19,7 @@
 #include "absl/types/optional.h"
 #include "api/array_view.h"
 #include "api/video/video_content_type.h"
+#include "api/video/video_frame_marking.h"
 #include "api/video/video_rotation.h"
 #include "api/video/video_timing.h"
 
@@ -116,6 +117,9 @@
   bool has_video_timing;
   VideoSendTiming video_timing;
 
+  bool has_frame_marking;
+  FrameMarking frame_marking;
+
   PlayoutDelay playout_delay = {-1, -1};
 
   // For identification of a stream when ssrc is not signaled. See
diff --git a/api/rtpparameters.cc b/api/rtpparameters.cc
index 62ca3fc..9beae82 100644
--- a/api/rtpparameters.cc
+++ b/api/rtpparameters.cc
@@ -129,6 +129,10 @@
 const char RtpExtension::kMidUri[] = "urn:ietf:params:rtp-hdrext:sdes:mid";
 const int RtpExtension::kMidDefaultId = 9;
 
+const char RtpExtension::kFrameMarkingUri[] =
+    "http://tools.ietf.org/html/draft-ietf-avtext-framemarking-07";
+const int RtpExtension::kFrameMarkingDefaultId = 10;
+
 const char RtpExtension::kEncryptHeaderExtensionsUri[] =
     "urn:ietf:params:rtp-hdrext:encrypt";
 
@@ -149,7 +153,8 @@
          uri == webrtc::RtpExtension::kPlayoutDelayUri ||
          uri == webrtc::RtpExtension::kVideoContentTypeUri ||
          uri == webrtc::RtpExtension::kVideoTimingUri ||
-         uri == webrtc::RtpExtension::kMidUri;
+         uri == webrtc::RtpExtension::kMidUri ||
+         uri == webrtc::RtpExtension::kFrameMarkingUri;
 }
 
 bool RtpExtension::IsEncryptionSupported(const std::string& uri) {
diff --git a/api/rtpparameters.h b/api/rtpparameters.h
index 9a29c08..aa9b09e 100644
--- a/api/rtpparameters.h
+++ b/api/rtpparameters.h
@@ -282,6 +282,10 @@
   static const char kVideoTimingUri[];
   static const int kVideoTimingDefaultId;
 
+  // Header extension for video frame marking.
+  static const char kFrameMarkingUri[];
+  static const int kFrameMarkingDefaultId;
+
   // Header extension for transport sequence number, see url for details:
   // http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions
   static const char kTransportSequenceNumberUri[];
diff --git a/api/video/BUILD.gn b/api/video/BUILD.gn
index dfc4f27..d041260 100644
--- a/api/video/BUILD.gn
+++ b/api/video/BUILD.gn
@@ -19,6 +19,7 @@
     "video_frame.h",
     "video_frame_buffer.cc",
     "video_frame_buffer.h",
+    "video_frame_marking.h",
     "video_rotation.h",
     "video_sink_interface.h",
     "video_source_interface.cc",
diff --git a/api/video/video_frame_marking.h b/api/video/video_frame_marking.h
new file mode 100644
index 0000000..2a34852
--- /dev/null
+++ b/api/video/video_frame_marking.h
@@ -0,0 +1,29 @@
+/*
+ *  Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
+ *
+ *  Use of this source code is governed by a BSD-style license
+ *  that can be found in the LICENSE file in the root of the source
+ *  tree. An additional intellectual property rights grant can be found
+ *  in the file PATENTS.  All contributing project authors may
+ *  be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef API_VIDEO_VIDEO_FRAME_MARKING_H_
+#define API_VIDEO_VIDEO_FRAME_MARKING_H_
+
+namespace webrtc {
+
+struct FrameMarking {
+  bool start_of_frame;
+  bool end_of_frame;
+  bool independent_frame;
+  bool discardable_frame;
+  bool base_layer_sync;
+  uint8_t temporal_id;
+  uint8_t layer_id;
+  uint8_t tl0_pic_idx;
+};
+
+}  // namespace webrtc
+
+#endif  // API_VIDEO_VIDEO_FRAME_MARKING_H_