Move video video receiver transformable frame to modules/rtc_rtcp/source

Step 1 of combining the sender and receiver types

Also moved the RtpFrameObject to rtp_rtcp/source, as it's heavily used
by the transformable receiver frame, I couldn't work out a better way
of managing the dependencies, and everything else seemed to work fine.

Bug: chromium:1412687
Change-Id: I55e816a0d7aa2962560ff9ebaf30ad63ab0b9810
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/291710
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Tony Herre <herre@google.com>
Cr-Commit-Position: refs/heads/main@{#39255}
diff --git a/modules/video_coding/BUILD.gn b/modules/video_coding/BUILD.gn
index e2384bb..2e1990d 100644
--- a/modules/video_coding/BUILD.gn
+++ b/modules/video_coding/BUILD.gn
@@ -207,8 +207,6 @@
     "fec_controller_default.cc",
     "fec_controller_default.h",
     "fec_rate_table.h",
-    "frame_object.cc",
-    "frame_object.h",
     "generic_decoder.cc",
     "generic_decoder.h",
     "h264_sprop_parameter_sets.cc",
@@ -1311,6 +1309,7 @@
       "../../test:video_test_support",
       "../../test/time_controller:time_controller",
       "../../third_party/libyuv:libyuv",
+      "../rtp_rtcp",
       "../rtp_rtcp:rtp_rtcp_format",
       "../rtp_rtcp:rtp_video_header",
       "codecs/av1:video_coding_codecs_av1_tests",
diff --git a/modules/video_coding/frame_buffer2_unittest.cc b/modules/video_coding/frame_buffer2_unittest.cc
index 0fabd9b..a2e9614 100644
--- a/modules/video_coding/frame_buffer2_unittest.cc
+++ b/modules/video_coding/frame_buffer2_unittest.cc
@@ -19,7 +19,7 @@
 #include "api/task_queue/task_queue_base.h"
 #include "api/units/time_delta.h"
 #include "api/units/timestamp.h"
-#include "modules/video_coding/frame_object.h"
+#include "modules/rtp_rtcp/source/frame_object.h"
 #include "modules/video_coding/timing/jitter_estimator.h"
 #include "modules/video_coding/timing/timing.h"
 #include "rtc_base/numerics/sequence_number_util.h"
diff --git a/modules/video_coding/frame_object.cc b/modules/video_coding/frame_object.cc
deleted file mode 100644
index 2b391e3..0000000
--- a/modules/video_coding/frame_object.cc
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- *  Copyright (c) 2016 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.
- */
-
-#include "modules/video_coding/frame_object.h"
-
-#include <string.h>
-
-#include <utility>
-
-#include "api/video/encoded_image.h"
-#include "api/video/video_timing.h"
-#include "rtc_base/checks.h"
-
-namespace webrtc {
-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,
-    RtpPacketInfos packet_infos,
-    rtc::scoped_refptr<EncodedImageBuffer> image_buffer)
-    : image_buffer_(image_buffer),
-      first_seq_num_(first_seq_num),
-      last_seq_num_(last_seq_num),
-      last_packet_received_time_(last_packet_received_time),
-      times_nacked_(times_nacked) {
-  rtp_video_header_ = video_header;
-
-  // EncodedFrame members
-  codec_type_ = codec;
-
-  // TODO(philipel): Remove when encoded image is replaced by EncodedFrame.
-  // VCMEncodedFrame members
-  CopyCodecSpecific(&rtp_video_header_);
-  _payloadType = payload_type;
-  SetTimestamp(rtp_timestamp);
-  ntp_time_ms_ = ntp_time_ms;
-  _frameType = rtp_video_header_.frame_type;
-
-  // Setting frame's playout delays to the same values
-  // as of the first packet's.
-  SetPlayoutDelay(rtp_video_header_.playout_delay);
-
-  SetEncodedData(image_buffer_);
-  _encodedWidth = rtp_video_header_.width;
-  _encodedHeight = rtp_video_header_.height;
-
-  if (packet_infos.begin() != packet_infos.end()) {
-    csrcs_ = packet_infos.begin()->csrcs();
-  }
-
-  // EncodedFrame members
-  SetPacketInfos(std::move(packet_infos));
-
-  rotation_ = rotation;
-  SetColorSpace(color_space);
-  SetVideoFrameTrackingId(rtp_video_header_.video_frame_tracking_id);
-  content_type_ = content_type;
-  if (timing.flags != VideoSendTiming::kInvalid) {
-    // ntp_time_ms_ may be -1 if not estimated yet. This is not a problem,
-    // as this will be dealt with at the time of reporting.
-    timing_.encode_start_ms = ntp_time_ms_ + timing.encode_start_delta_ms;
-    timing_.encode_finish_ms = ntp_time_ms_ + timing.encode_finish_delta_ms;
-    timing_.packetization_finish_ms =
-        ntp_time_ms_ + timing.packetization_finish_delta_ms;
-    timing_.pacer_exit_ms = ntp_time_ms_ + timing.pacer_exit_delta_ms;
-    timing_.network_timestamp_ms =
-        ntp_time_ms_ + timing.network_timestamp_delta_ms;
-    timing_.network2_timestamp_ms =
-        ntp_time_ms_ + timing.network2_timestamp_delta_ms;
-  }
-  timing_.receive_start_ms = first_packet_received_time;
-  timing_.receive_finish_ms = last_packet_received_time;
-  timing_.flags = timing.flags;
-  is_last_spatial_layer = markerBit;
-}
-
-RtpFrameObject::~RtpFrameObject() {
-}
-
-uint16_t RtpFrameObject::first_seq_num() const {
-  return first_seq_num_;
-}
-
-uint16_t RtpFrameObject::last_seq_num() const {
-  return last_seq_num_;
-}
-
-int RtpFrameObject::times_nacked() const {
-  return times_nacked_;
-}
-
-VideoFrameType RtpFrameObject::frame_type() const {
-  return rtp_video_header_.frame_type;
-}
-
-VideoCodecType RtpFrameObject::codec_type() const {
-  return codec_type_;
-}
-
-int64_t RtpFrameObject::ReceivedTime() const {
-  return last_packet_received_time_;
-}
-
-int64_t RtpFrameObject::RenderTime() const {
-  return _renderTimeMs;
-}
-
-bool RtpFrameObject::delayed_by_retransmission() const {
-  return times_nacked() > 0;
-}
-
-const RTPVideoHeader& RtpFrameObject::GetRtpVideoHeader() const {
-  return rtp_video_header_;
-}
-
-}  // namespace webrtc
diff --git a/modules/video_coding/frame_object.h b/modules/video_coding/frame_object.h
deleted file mode 100644
index df5dae8..0000000
--- a/modules/video_coding/frame_object.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- *  Copyright (c) 2016 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 MODULES_VIDEO_CODING_FRAME_OBJECT_H_
-#define MODULES_VIDEO_CODING_FRAME_OBJECT_H_
-
-#include <vector>
-
-#include "absl/types/optional.h"
-#include "api/video/encoded_frame.h"
-
-namespace webrtc {
-
-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);
-
-  ~RtpFrameObject() override;
-  uint16_t first_seq_num() const;
-  uint16_t last_seq_num() const;
-  int times_nacked() const;
-  VideoFrameType frame_type() const;
-  VideoCodecType codec_type() const;
-  int64_t ReceivedTime() const override;
-  int64_t RenderTime() const override;
-  bool delayed_by_retransmission() const override;
-  const RTPVideoHeader& GetRtpVideoHeader() const;
-
-  uint8_t* mutable_data() { return image_buffer_->data(); }
-
-  const std::vector<uint32_t>& Csrcs() const { return csrcs_; }
-
- private:
-  // Reference for mutable access.
-  rtc::scoped_refptr<EncodedImageBuffer> image_buffer_;
-  RTPVideoHeader rtp_video_header_;
-  VideoCodecType codec_type_;
-  uint16_t first_seq_num_;
-  uint16_t last_seq_num_;
-  int64_t last_packet_received_time_;
-  std::vector<uint32_t> csrcs_;
-
-  // Equal to times nacked of the packet with the highet times nacked
-  // belonging to this frame.
-  int times_nacked_;
-};
-
-}  // namespace webrtc
-
-#endif  // MODULES_VIDEO_CODING_FRAME_OBJECT_H_
diff --git a/modules/video_coding/packet_buffer_unittest.cc b/modules/video_coding/packet_buffer_unittest.cc
index b147977..6969b02 100644
--- a/modules/video_coding/packet_buffer_unittest.cc
+++ b/modules/video_coding/packet_buffer_unittest.cc
@@ -17,7 +17,7 @@
 
 #include "api/array_view.h"
 #include "common_video/h264/h264_common.h"
-#include "modules/video_coding/frame_object.h"
+#include "modules/rtp_rtcp/source/frame_object.h"
 #include "rtc_base/numerics/sequence_number_unwrapper.h"
 #include "rtc_base/random.h"
 #include "test/field_trial.h"
diff --git a/modules/video_coding/rtp_frame_id_only_ref_finder.h b/modules/video_coding/rtp_frame_id_only_ref_finder.h
index 5c0bdc8..c842fb5 100644
--- a/modules/video_coding/rtp_frame_id_only_ref_finder.h
+++ b/modules/video_coding/rtp_frame_id_only_ref_finder.h
@@ -14,7 +14,7 @@
 #include <memory>
 
 #include "absl/container/inlined_vector.h"
-#include "modules/video_coding/frame_object.h"
+#include "modules/rtp_rtcp/source/frame_object.h"
 #include "modules/video_coding/rtp_frame_reference_finder.h"
 #include "rtc_base/numerics/sequence_number_unwrapper.h"
 
diff --git a/modules/video_coding/rtp_frame_reference_finder.cc b/modules/video_coding/rtp_frame_reference_finder.cc
index a44b76b..3d6543b 100644
--- a/modules/video_coding/rtp_frame_reference_finder.cc
+++ b/modules/video_coding/rtp_frame_reference_finder.cc
@@ -13,7 +13,7 @@
 #include <utility>
 
 #include "absl/types/variant.h"
-#include "modules/video_coding/frame_object.h"
+#include "modules/rtp_rtcp/source/frame_object.h"
 #include "modules/video_coding/rtp_frame_id_only_ref_finder.h"
 #include "modules/video_coding/rtp_generic_ref_finder.h"
 #include "modules/video_coding/rtp_seq_num_only_ref_finder.h"
diff --git a/modules/video_coding/rtp_frame_reference_finder.h b/modules/video_coding/rtp_frame_reference_finder.h
index 9ce63cd..6050513 100644
--- a/modules/video_coding/rtp_frame_reference_finder.h
+++ b/modules/video_coding/rtp_frame_reference_finder.h
@@ -13,7 +13,7 @@
 
 #include <memory>
 
-#include "modules/video_coding/frame_object.h"
+#include "modules/rtp_rtcp/source/frame_object.h"
 
 namespace webrtc {
 namespace internal {
diff --git a/modules/video_coding/rtp_frame_reference_finder_unittest.cc b/modules/video_coding/rtp_frame_reference_finder_unittest.cc
index c58f1a9..0ca2cf0 100644
--- a/modules/video_coding/rtp_frame_reference_finder_unittest.cc
+++ b/modules/video_coding/rtp_frame_reference_finder_unittest.cc
@@ -8,6 +8,8 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
+#include "modules/video_coding/rtp_frame_reference_finder.h"
+
 #include <cstring>
 #include <limits>
 #include <map>
@@ -15,9 +17,8 @@
 #include <utility>
 #include <vector>
 
-#include "modules/video_coding/frame_object.h"
+#include "modules/rtp_rtcp/source/frame_object.h"
 #include "modules/video_coding/packet_buffer.h"
-#include "modules/video_coding/rtp_frame_reference_finder.h"
 #include "rtc_base/random.h"
 #include "rtc_base/ref_count.h"
 #include "system_wrappers/include/clock.h"
diff --git a/modules/video_coding/rtp_generic_ref_finder.h b/modules/video_coding/rtp_generic_ref_finder.h
index 87d7b59..021e31a 100644
--- a/modules/video_coding/rtp_generic_ref_finder.h
+++ b/modules/video_coding/rtp_generic_ref_finder.h
@@ -13,7 +13,7 @@
 
 #include <memory>
 
-#include "modules/video_coding/frame_object.h"
+#include "modules/rtp_rtcp/source/frame_object.h"
 #include "modules/video_coding/rtp_frame_reference_finder.h"
 
 namespace webrtc {
diff --git a/modules/video_coding/rtp_seq_num_only_ref_finder.h b/modules/video_coding/rtp_seq_num_only_ref_finder.h
index c05655b..166b6a7 100644
--- a/modules/video_coding/rtp_seq_num_only_ref_finder.h
+++ b/modules/video_coding/rtp_seq_num_only_ref_finder.h
@@ -18,7 +18,7 @@
 #include <utility>
 
 #include "absl/container/inlined_vector.h"
-#include "modules/video_coding/frame_object.h"
+#include "modules/rtp_rtcp/source/frame_object.h"
 #include "modules/video_coding/rtp_frame_reference_finder.h"
 #include "rtc_base/numerics/sequence_number_unwrapper.h"
 
diff --git a/modules/video_coding/rtp_vp8_ref_finder.h b/modules/video_coding/rtp_vp8_ref_finder.h
index 26df658..82fdbd3 100644
--- a/modules/video_coding/rtp_vp8_ref_finder.h
+++ b/modules/video_coding/rtp_vp8_ref_finder.h
@@ -17,7 +17,7 @@
 #include <set>
 
 #include "absl/container/inlined_vector.h"
-#include "modules/video_coding/frame_object.h"
+#include "modules/rtp_rtcp/source/frame_object.h"
 #include "modules/video_coding/rtp_frame_reference_finder.h"
 #include "rtc_base/numerics/sequence_number_unwrapper.h"
 
diff --git a/modules/video_coding/rtp_vp8_ref_finder_unittest.cc b/modules/video_coding/rtp_vp8_ref_finder_unittest.cc
index 7dc6cd5..a27085e 100644
--- a/modules/video_coding/rtp_vp8_ref_finder_unittest.cc
+++ b/modules/video_coding/rtp_vp8_ref_finder_unittest.cc
@@ -13,7 +13,7 @@
 #include <utility>
 #include <vector>
 
-#include "modules/video_coding/frame_object.h"
+#include "modules/rtp_rtcp/source/frame_object.h"
 #include "test/gmock.h"
 #include "test/gtest.h"
 
diff --git a/modules/video_coding/rtp_vp9_ref_finder.h b/modules/video_coding/rtp_vp9_ref_finder.h
index ea5e319..fb14417 100644
--- a/modules/video_coding/rtp_vp9_ref_finder.h
+++ b/modules/video_coding/rtp_vp9_ref_finder.h
@@ -17,7 +17,7 @@
 #include <set>
 
 #include "absl/container/inlined_vector.h"
-#include "modules/video_coding/frame_object.h"
+#include "modules/rtp_rtcp/source/frame_object.h"
 #include "modules/video_coding/rtp_frame_reference_finder.h"
 #include "rtc_base/numerics/sequence_number_unwrapper.h"
 
diff --git a/modules/video_coding/rtp_vp9_ref_finder_unittest.cc b/modules/video_coding/rtp_vp9_ref_finder_unittest.cc
index 51fae50..72084a7 100644
--- a/modules/video_coding/rtp_vp9_ref_finder_unittest.cc
+++ b/modules/video_coding/rtp_vp9_ref_finder_unittest.cc
@@ -8,11 +8,12 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
+#include "modules/video_coding/rtp_vp9_ref_finder.h"
+
 #include <utility>
 #include <vector>
 
-#include "modules/video_coding/frame_object.h"
-#include "modules/video_coding/rtp_vp9_ref_finder.h"
+#include "modules/rtp_rtcp/source/frame_object.h"
 #include "test/gmock.h"
 #include "test/gtest.h"