diff --git a/api/video/BUILD.gn b/api/video/BUILD.gn index 0124d10c2e..4070f0ba84 100644 --- a/api/video/BUILD.gn +++ b/api/video/BUILD.gn @@ -47,7 +47,6 @@ rtc_library("video_frame") { deps = [ ":video_rtp_headers", "..:array_view", - "..:refcountedbase", "..:rtp_packet_info", "..:scoped_refptr", "../../rtc_base:checks", diff --git a/api/video/DEPS b/api/video/DEPS index 85a4c01d2e..3af594cd8a 100644 --- a/api/video/DEPS +++ b/api/video/DEPS @@ -23,7 +23,6 @@ specific_include_rules = { ], "video_frame\.h": [ - "+rtc_base/ref_count.h", ], "video_frame_buffer\.h": [ diff --git a/api/video/video_frame.cc b/api/video/video_frame.cc index 4f6bd86530..ccd92adc4a 100644 --- a/api/video/video_frame.cc +++ b/api/video/video_frame.cc @@ -165,7 +165,7 @@ VideoFrame VideoFrame::Builder::build() { RTC_CHECK(video_frame_buffer_ != nullptr); return VideoFrame(id_, video_frame_buffer_, timestamp_us_, timestamp_rtp_, ntp_time_ms_, rotation_, color_space_, update_rect_, - packet_infos_, encoded_frame_buffer_); + packet_infos_); } VideoFrame::Builder& VideoFrame::Builder::set_video_frame_buffer( @@ -232,13 +232,6 @@ VideoFrame::Builder& VideoFrame::Builder::set_packet_infos( return *this; } -VideoFrame::Builder& VideoFrame::Builder::set_encoded_video_frame_buffer( - rtc::scoped_refptr - encoded_frame_buffer) { - encoded_frame_buffer_ = std::move(encoded_frame_buffer); - return *this; -} - VideoFrame::VideoFrame(const rtc::scoped_refptr& buffer, webrtc::VideoRotation rotation, int64_t timestamp_us) @@ -260,20 +253,17 @@ VideoFrame::VideoFrame(const rtc::scoped_refptr& buffer, RTC_DCHECK(buffer); } -VideoFrame::VideoFrame( - uint16_t id, - const rtc::scoped_refptr& buffer, - int64_t timestamp_us, - uint32_t timestamp_rtp, - int64_t ntp_time_ms, - VideoRotation rotation, - const absl::optional& color_space, - const absl::optional& update_rect, - RtpPacketInfos packet_infos, - const rtc::scoped_refptr& encoded_frame_buffer) +VideoFrame::VideoFrame(uint16_t id, + const rtc::scoped_refptr& buffer, + int64_t timestamp_us, + uint32_t timestamp_rtp, + int64_t ntp_time_ms, + VideoRotation rotation, + const absl::optional& color_space, + const absl::optional& update_rect, + RtpPacketInfos packet_infos) : id_(id), video_frame_buffer_(buffer), - encoded_frame_buffer_(encoded_frame_buffer), timestamp_rtp_(timestamp_rtp), ntp_time_ms_(ntp_time_ms), timestamp_us_(timestamp_us), @@ -322,14 +312,4 @@ int64_t VideoFrame::render_time_ms() const { return timestamp_us() / rtc::kNumMicrosecsPerMillisec; } -void VideoFrame::set_encoded_video_frame_buffer( - rtc::scoped_refptr encoded_frame_buffer) { - encoded_frame_buffer_ = std::move(encoded_frame_buffer); -} - -rtc::scoped_refptr -VideoFrame::encoded_video_frame_buffer() const { - return encoded_frame_buffer_; -} - } // namespace webrtc diff --git a/api/video/video_frame.h b/api/video/video_frame.h index d16ef8ce24..9b3761e96d 100644 --- a/api/video/video_frame.h +++ b/api/video/video_frame.h @@ -13,20 +13,16 @@ #include -#include #include #include "absl/types/optional.h" -#include "api/array_view.h" #include "api/rtp_packet_infos.h" #include "api/scoped_refptr.h" #include "api/video/color_space.h" #include "api/video/hdr_metadata.h" -#include "api/video/video_codec_type.h" #include "api/video/video_frame_buffer.h" #include "api/video/video_rotation.h" #include "rtc_base/checks.h" -#include "rtc_base/ref_count.h" #include "rtc_base/system/rtc_export.h" namespace webrtc { @@ -76,23 +72,6 @@ class RTC_EXPORT VideoFrame { int scaled_height) const; }; - // Interface for accessing elements of the encoded frame that was the base for - // the rest of the VideoFrame. - class EncodedVideoFrameBuffer : public rtc::RefCountInterface { - public: - // Returns a span of the bitstream data. - virtual rtc::ArrayView data() const = 0; - - // Returns the colorspace of the encoded frame, or nullptr if not present - virtual const webrtc::ColorSpace* color_space() const = 0; - - // Returns the codec of the encoded frame - virtual VideoCodecType codec() const = 0; - - // Returns wether the encoded frame is a keyframe - virtual bool is_key_frame() const = 0; - }; - // Preferred way of building VideoFrame objects. class RTC_EXPORT Builder { public: @@ -112,8 +91,6 @@ class RTC_EXPORT VideoFrame { Builder& set_id(uint16_t id); Builder& set_update_rect(const UpdateRect& update_rect); Builder& set_packet_infos(RtpPacketInfos packet_infos); - Builder& set_encoded_video_frame_buffer( - rtc::scoped_refptr encoded_frame_buffer); private: uint16_t id_ = 0; @@ -125,7 +102,6 @@ class RTC_EXPORT VideoFrame { absl::optional color_space_; absl::optional update_rect_; RtpPacketInfos packet_infos_; - rtc::scoped_refptr encoded_frame_buffer_; }; // To be deprecated. Migrate all use to Builder. @@ -215,12 +191,6 @@ class RTC_EXPORT VideoFrame { void set_video_frame_buffer( const rtc::scoped_refptr& buffer); - void set_encoded_video_frame_buffer( - rtc::scoped_refptr encoded_frame_buffer); - - rtc::scoped_refptr encoded_video_frame_buffer() - const; - // TODO(nisse): Deprecated. // Return true if the frame is stored in a texture. bool is_texture() const { @@ -262,14 +232,11 @@ class RTC_EXPORT VideoFrame { VideoRotation rotation, const absl::optional& color_space, const absl::optional& update_rect, - RtpPacketInfos packet_infos, - const rtc::scoped_refptr& encoded_frame); + RtpPacketInfos packet_infos); uint16_t id_; - // A reference counted handle that stores the pixel data. + // An opaque reference counted handle that stores the pixel data. rtc::scoped_refptr video_frame_buffer_; - // A reference counted handle that points to an encoded frame - rtc::scoped_refptr encoded_frame_buffer_; uint32_t timestamp_rtp_; int64_t ntp_time_ms_; int64_t timestamp_us_; diff --git a/common_video/BUILD.gn b/common_video/BUILD.gn index bd440efa94..d22e4fddea 100644 --- a/common_video/BUILD.gn +++ b/common_video/BUILD.gn @@ -99,7 +99,6 @@ if (rtc_include_tests) { "../:webrtc_common", "../api:scoped_refptr", "../api/units:time_delta", - "../api/video:encoded_frame", "../api/video:video_frame", "../api/video:video_frame_i010", "../api/video:video_frame_i420", diff --git a/common_video/video_frame_unittest.cc b/common_video/video_frame_unittest.cc index 6b2c97b1df..225a7d3089 100644 --- a/common_video/video_frame_unittest.cc +++ b/common_video/video_frame_unittest.cc @@ -362,39 +362,6 @@ TEST(TestVideoFrame, TextureInitialValues) { EXPECT_EQ(20, frame.timestamp_us()); } -class TestEncodedFrame : public VideoFrame::EncodedVideoFrameBuffer { - public: - rtc::ArrayView data() const override { - return rtc::ArrayView(); - } - webrtc::ColorSpace* color_space() const override { return nullptr; } - VideoCodecType codec() const override { return kVideoCodecGeneric; } - bool is_key_frame() const { return false; } -}; - -TEST(TestVideoFrame, AcceptsEncodedFrameSource) { - VideoFrame frame = - VideoFrame::Builder() - .set_video_frame_buffer(I420Buffer::Create(10, 10, 10, 14, 90)) - .build(); - EXPECT_EQ(frame.encoded_video_frame_buffer(), nullptr); - auto encoded_frame = new rtc::RefCountedObject(); - frame.set_encoded_video_frame_buffer(encoded_frame); - EXPECT_EQ(frame.encoded_video_frame_buffer(), encoded_frame); -} - -TEST(TestVideoFrame, CopiesWithSameEncodedFrameSource) { - VideoFrame frame = - VideoFrame::Builder() - .set_video_frame_buffer(I420Buffer::Create(10, 10, 10, 14, 90)) - .set_encoded_video_frame_buffer( - new rtc::RefCountedObject()) - .build(); - VideoFrame frame2 = frame; - EXPECT_EQ(frame.encoded_video_frame_buffer().get(), - frame2.encoded_video_frame_buffer().get()); -} - class TestPlanarYuvBuffer : public ::testing::TestWithParam {};