Do not propagate generic descriptor on receiving frame

It was used only for the frame decryptor.
Decryptor needs only raw representation that it can recreate
in a way compatible with the new version of the descriptor.

This relands commit abf73de8eae90e9ac7e88ce1d52728e8102e824f.
with adjustments.

Change-Id: I935977179bef31d8e1023964b967658e9a7db92d
Bug: webrtc:10342
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/168489
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30532}
diff --git a/modules/video_coding/BUILD.gn b/modules/video_coding/BUILD.gn
index 77f6186..935151f 100644
--- a/modules/video_coding/BUILD.gn
+++ b/modules/video_coding/BUILD.gn
@@ -84,6 +84,7 @@
     "../../api/video:encoded_image",
     "../../api/video:video_bitrate_allocation",
     "../../api/video:video_bitrate_allocator_factory",
+    "../../rtc_base:deprecation",
     "../../system_wrappers:field_trial",
     "../../system_wrappers:metrics",
     "../rtp_rtcp:rtp_video_header",
diff --git a/modules/video_coding/frame_object.cc b/modules/video_coding/frame_object.cc
index 682ce17..7152c3b 100644
--- a/modules/video_coding/frame_object.cc
+++ b/modules/video_coding/frame_object.cc
@@ -37,7 +37,6 @@
     VideoContentType content_type,
     const RTPVideoHeader& video_header,
     const absl::optional<webrtc::ColorSpace>& color_space,
-    const absl::optional<RtpGenericFrameDescriptor>& generic_descriptor,
     RtpPacketInfos packet_infos,
     rtc::scoped_refptr<EncodedImageBuffer> image_buffer)
     : first_seq_num_(first_seq_num),
@@ -45,7 +44,6 @@
       last_packet_received_time_(last_packet_received_time),
       times_nacked_(times_nacked) {
   rtp_video_header_ = video_header;
-  rtp_generic_frame_descriptor_ = generic_descriptor;
 
   // EncodedFrame members
   codec_type_ = codec;
@@ -92,6 +90,43 @@
   is_last_spatial_layer = markerBit;
 }
 
+RtpFrameObject::RtpFrameObject(
+    uint16_t first_seq_num,
+    uint16_t last_seq_num,
+    bool markerBit,
+    int times_nacked,
+    int64_t first_packet_received_time,
+    int64_t last_packet_received_time,
+    uint32_t rtp_timestamp,
+    int64_t ntp_time_ms,
+    const VideoSendTiming& timing,
+    uint8_t payload_type,
+    VideoCodecType codec,
+    VideoRotation rotation,
+    VideoContentType content_type,
+    const RTPVideoHeader& video_header,
+    const absl::optional<webrtc::ColorSpace>& color_space,
+    const absl::optional<RtpGenericFrameDescriptor>& /*generic_descriptor*/,
+    RtpPacketInfos packet_infos,
+    rtc::scoped_refptr<EncodedImageBuffer> image_buffer)
+    : RtpFrameObject(first_seq_num,
+                     last_seq_num,
+                     markerBit,
+                     times_nacked,
+                     first_packet_received_time,
+                     last_packet_received_time,
+                     rtp_timestamp,
+                     ntp_time_ms,
+                     timing,
+                     payload_type,
+                     codec,
+                     rotation,
+                     content_type,
+                     video_header,
+                     color_space,
+                     std::move(packet_infos),
+                     std::move(image_buffer)) {}
+
 RtpFrameObject::~RtpFrameObject() {
 }
 
@@ -131,11 +166,6 @@
   return rtp_video_header_;
 }
 
-const absl::optional<RtpGenericFrameDescriptor>&
-RtpFrameObject::GetGenericFrameDescriptor() const {
-  return rtp_generic_frame_descriptor_;
-}
-
 const FrameMarking& RtpFrameObject::GetFrameMarking() const {
   return rtp_video_header_.frame_marking;
 }
diff --git a/modules/video_coding/frame_object.h b/modules/video_coding/frame_object.h
index b3cee20..f43fafd 100644
--- a/modules/video_coding/frame_object.h
+++ b/modules/video_coding/frame_object.h
@@ -14,12 +14,32 @@
 #include "absl/types/optional.h"
 #include "api/video/encoded_frame.h"
 #include "modules/rtp_rtcp/source/rtp_generic_frame_descriptor.h"
+#include "rtc_base/deprecation.h"
 
 namespace webrtc {
 namespace video_coding {
 
 class RtpFrameObject : public EncodedFrame {
  public:
+  RtpFrameObject(uint16_t first_seq_num,
+                 uint16_t last_seq_num,
+                 bool markerBit,
+                 int times_nacked,
+                 int64_t first_packet_received_time,
+                 int64_t last_packet_received_time,
+                 uint32_t rtp_timestamp,
+                 int64_t ntp_time_ms,
+                 const VideoSendTiming& timing,
+                 uint8_t payload_type,
+                 VideoCodecType codec,
+                 VideoRotation rotation,
+                 VideoContentType content_type,
+                 const RTPVideoHeader& video_header,
+                 const absl::optional<webrtc::ColorSpace>& color_space,
+                 RtpPacketInfos packet_infos,
+                 rtc::scoped_refptr<EncodedImageBuffer> image_buffer);
+
+  RTC_DEPRECATED
   RtpFrameObject(
       uint16_t first_seq_num,
       uint16_t last_seq_num,
@@ -50,13 +70,10 @@
   int64_t RenderTime() const override;
   bool delayed_by_retransmission() const override;
   const RTPVideoHeader& GetRtpVideoHeader() const;
-  const absl::optional<RtpGenericFrameDescriptor>& GetGenericFrameDescriptor()
-      const;
   const FrameMarking& GetFrameMarking() const;
 
  private:
   RTPVideoHeader rtp_video_header_;
-  absl::optional<RtpGenericFrameDescriptor> rtp_generic_frame_descriptor_;
   VideoCodecType codec_type_;
   uint16_t first_seq_num_;
   uint16_t last_seq_num_;
diff --git a/modules/video_coding/packet_buffer.cc b/modules/video_coding/packet_buffer.cc
index 6ebb9c4..73abbbe 100644
--- a/modules/video_coding/packet_buffer.cc
+++ b/modules/video_coding/packet_buffer.cc
@@ -473,7 +473,6 @@
       last_packet.video_header.content_type,    //
       first_packet.video_header,                //
       last_packet.video_header.color_space,     //
-      first_packet.generic_descriptor,          //
       RtpPacketInfos(std::move(packet_infos)),  //
       std::move(bitstream));
 }
diff --git a/modules/video_coding/packet_buffer.h b/modules/video_coding/packet_buffer.h
index f78147c..5ce67ba 100644
--- a/modules/video_coding/packet_buffer.h
+++ b/modules/video_coding/packet_buffer.h
@@ -19,7 +19,6 @@
 #include "absl/base/attributes.h"
 #include "api/rtp_packet_info.h"
 #include "api/video/encoded_image.h"
-#include "modules/rtp_rtcp/source/rtp_generic_frame_descriptor.h"
 #include "modules/rtp_rtcp/source/rtp_packet_received.h"
 #include "modules/rtp_rtcp/source/rtp_video_header.h"
 #include "modules/video_coding/frame_object.h"
@@ -67,7 +66,6 @@
 
     rtc::CopyOnWriteBuffer video_payload;
     RTPVideoHeader video_header;
-    absl::optional<RtpGenericFrameDescriptor> generic_descriptor;
 
     RtpPacketInfo packet_info;
   };
diff --git a/modules/video_coding/rtp_frame_reference_finder_unittest.cc b/modules/video_coding/rtp_frame_reference_finder_unittest.cc
index 29fdba5..e103023 100644
--- a/modules/video_coding/rtp_frame_reference_finder_unittest.cc
+++ b/modules/video_coding/rtp_frame_reference_finder_unittest.cc
@@ -57,7 +57,6 @@
       VideoContentType::UNSPECIFIED,
       video_header,
       /*color_space=*/absl::nullopt,
-      /*generic_descriptor=*/absl::nullopt,
       RtpPacketInfos(),
       EncodedImageBuffer::Create(/*size=*/0));
   // clang-format on