Add FrameInstrumentationData to RTPVideoHeader and CodecSpecificInfo

Bug: webrtc:358039777
Change-Id: If2659240047e1935f7666266bff25ed86a6a234c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/361420
Commit-Queue: Fanny Linderborg <linderborg@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42940}
diff --git a/call/rtp_payload_params.cc b/call/rtp_payload_params.cc
index edcf3f7..f61a99b 100644
--- a/call/rtp_payload_params.cc
+++ b/call/rtp_payload_params.cc
@@ -53,6 +53,7 @@
                                    RTPVideoHeader* rtp) {
   rtp->codec = info.codecType;
   rtp->is_last_frame_in_picture = info.end_of_picture;
+  rtp->frame_instrumentation_data = info.frame_instrumentation_data;
   switch (info.codecType) {
     case kVideoCodecVP8: {
       auto& vp8_header = rtp->video_type_header.emplace<RTPVideoHeaderVP8>();
diff --git a/modules/rtp_rtcp/BUILD.gn b/modules/rtp_rtcp/BUILD.gn
index 8b40171..9079291 100644
--- a/modules/rtp_rtcp/BUILD.gn
+++ b/modules/rtp_rtcp/BUILD.gn
@@ -464,6 +464,7 @@
     "../../api/video:video_frame_metadata",
     "../../api/video:video_frame_type",
     "../../api/video:video_rtp_headers",
+    "../../common_video:frame_instrumentation_data",
     "../../modules/video_coding:codec_globals_headers",
     "//third_party/abseil-cpp/absl/container:inlined_vector",
     "//third_party/abseil-cpp/absl/types:variant",
diff --git a/modules/rtp_rtcp/source/rtp_video_header.h b/modules/rtp_rtcp/source/rtp_video_header.h
index 20ad4b2..8bf17fc 100644
--- a/modules/rtp_rtcp/source/rtp_video_header.h
+++ b/modules/rtp_rtcp/source/rtp_video_header.h
@@ -25,6 +25,7 @@
 #include "api/video/video_frame_type.h"
 #include "api/video/video_rotation.h"
 #include "api/video/video_timing.h"
+#include "common_video/frame_instrumentation_data.h"
 #include "modules/video_coding/codecs/h264/include/h264_globals.h"
 #include "modules/video_coding/codecs/vp8/include/vp8_globals.h"
 #include "modules/video_coding/codecs/vp9/include/vp9_globals.h"
@@ -94,6 +95,11 @@
   // http://www.webrtc.org/experiments/rtp-hdrext/abs-capture-time.
   // Otherwise, it is derived from other relevant information.
   std::optional<AbsoluteCaptureTime> absolute_capture_time;
+
+  // Required for automatic corruption detection.
+  std::optional<
+      absl::variant<FrameInstrumentationSyncData, FrameInstrumentationData>>
+      frame_instrumentation_data;
 };
 
 }  // namespace webrtc
diff --git a/modules/video_coding/BUILD.gn b/modules/video_coding/BUILD.gn
index d734a9c..2b76470 100644
--- a/modules/video_coding/BUILD.gn
+++ b/modules/video_coding/BUILD.gn
@@ -291,8 +291,10 @@
     "../../api/video_codecs:scalability_mode",
     "../../api/video_codecs:video_codecs_api",
     "../../common_video",
+    "../../common_video:frame_instrumentation_data",
     "../../common_video/generic_frame_descriptor",
     "../../rtc_base/system:rtc_export",
+    "//third_party/abseil-cpp/absl/types:variant",
   ]
 }
 
diff --git a/modules/video_coding/include/video_codec_interface.h b/modules/video_coding/include/video_codec_interface.h
index 243ac07..69fb777 100644
--- a/modules/video_coding/include/video_codec_interface.h
+++ b/modules/video_coding/include/video_codec_interface.h
@@ -14,10 +14,12 @@
 #include <optional>
 #include <vector>
 
+#include "absl/types/variant.h"
 #include "api/video/video_frame.h"
 #include "api/video_codecs/scalability_mode.h"
 #include "api/video_codecs/video_decoder.h"
 #include "api/video_codecs/video_encoder.h"
+#include "common_video/frame_instrumentation_data.h"
 #include "common_video/generic_frame_descriptor/generic_frame_info.h"
 #include "modules/video_coding/codecs/h264/include/h264_globals.h"
 #include "modules/video_coding/codecs/vp9/include/vp9_globals.h"
@@ -119,6 +121,11 @@
   std::optional<GenericFrameInfo> generic_frame_info;
   std::optional<FrameDependencyStructure> template_structure;
   std::optional<ScalabilityMode> scalability_mode;
+
+  // Required for automatic corruption detection.
+  std::optional<
+      absl::variant<FrameInstrumentationSyncData, FrameInstrumentationData>>
+      frame_instrumentation_data;
 };
 
 }  // namespace webrtc