diff --git a/api/video/BUILD.gn b/api/video/BUILD.gn index b697b86283..1a832486a9 100644 --- a/api/video/BUILD.gn +++ b/api/video/BUILD.gn @@ -43,6 +43,8 @@ rtc_library("video_frame") { sources = [ "i420_buffer.cc", "i420_buffer.h", + "nv12_buffer.cc", + "nv12_buffer.h", "video_codec_type.h", "video_frame.cc", "video_frame.h", @@ -90,23 +92,6 @@ rtc_library("video_frame_i010") { ] } -rtc_library("video_frame_nv12") { - visibility = [ "*" ] - sources = [ - "nv12_buffer.cc", - "nv12_buffer.h", - ] - deps = [ - ":video_frame", - "..:scoped_refptr", - "../../rtc_base", - "../../rtc_base:checks", - "../../rtc_base/memory:aligned_malloc", - "../../rtc_base/system:rtc_export", - "//third_party/libyuv", - ] -} - rtc_source_set("recordable_encoded_frame") { visibility = [ "*" ] sources = [ "recordable_encoded_frame.h" ] diff --git a/api/video/test/BUILD.gn b/api/video/test/BUILD.gn index 72f50494bb..1573e7848f 100644 --- a/api/video/test/BUILD.gn +++ b/api/video/test/BUILD.gn @@ -20,7 +20,6 @@ rtc_library("rtc_api_video_unittests") { "..:video_adaptation", "..:video_bitrate_allocation", "..:video_frame", - "..:video_frame_nv12", "..:video_rtp_headers", "../../../test:frame_utils", "../../../test:test_support", diff --git a/api/video/video_frame_buffer.cc b/api/video/video_frame_buffer.cc index 64f339448b..7085010325 100644 --- a/api/video/video_frame_buffer.cc +++ b/api/video/video_frame_buffer.cc @@ -11,6 +11,7 @@ #include "api/video/video_frame_buffer.h" #include "api/video/i420_buffer.h" +#include "api/video/nv12_buffer.h" #include "rtc_base/checks.h" namespace webrtc { @@ -139,4 +140,18 @@ int NV12BufferInterface::ChromaWidth() const { int NV12BufferInterface::ChromaHeight() const { return (height() + 1) / 2; } + +rtc::scoped_refptr NV12BufferInterface::CropAndScale( + int offset_x, + int offset_y, + int crop_width, + int crop_height, + int scaled_width, + int scaled_height) { + rtc::scoped_refptr result = + NV12Buffer::Create(scaled_width, scaled_height); + result->CropAndScaleFrom(*this, offset_x, offset_y, crop_width, crop_height); + return result; +} + } // namespace webrtc diff --git a/api/video/video_frame_buffer.h b/api/video/video_frame_buffer.h index 67b8797325..62adc204f6 100644 --- a/api/video/video_frame_buffer.h +++ b/api/video/video_frame_buffer.h @@ -242,6 +242,13 @@ class RTC_EXPORT NV12BufferInterface : public BiplanarYuv8Buffer { int ChromaWidth() const final; int ChromaHeight() const final; + rtc::scoped_refptr CropAndScale(int offset_x, + int offset_y, + int crop_width, + int crop_height, + int scaled_width, + int scaled_height) override; + protected: ~NV12BufferInterface() override {} }; diff --git a/common_video/BUILD.gn b/common_video/BUILD.gn index 57c4158e7e..2503f7f77b 100644 --- a/common_video/BUILD.gn +++ b/common_video/BUILD.gn @@ -50,7 +50,6 @@ rtc_library("common_video") { "../api/video:video_bitrate_allocation", "../api/video:video_bitrate_allocator", "../api/video:video_frame", - "../api/video:video_frame_nv12", "../api/video:video_rtp_headers", "../api/video_codecs:bitstream_parser_api", "../media:rtc_h264_profile_id", @@ -105,7 +104,6 @@ if (rtc_include_tests && !build_with_chromium) { "../api/units:time_delta", "../api/video:video_frame", "../api/video:video_frame_i010", - "../api/video:video_frame_nv12", "../api/video:video_rtp_headers", "../media:rtc_h264_profile_id", "../rtc_base", diff --git a/test/BUILD.gn b/test/BUILD.gn index ed4eebefd5..db508ca71e 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -56,7 +56,6 @@ rtc_library("frame_generator_impl") { "../api/video:encoded_image", "../api/video:video_frame", "../api/video:video_frame_i010", - "../api/video:video_frame_nv12", "../api/video:video_rtp_headers", "../api/video_codecs:video_codecs_api", "../common_video", diff --git a/video/BUILD.gn b/video/BUILD.gn index e0399a1549..acf1ba2445 100644 --- a/video/BUILD.gn +++ b/video/BUILD.gn @@ -663,7 +663,6 @@ if (rtc_include_tests) { "../api/video:video_adaptation", "../api/video:video_bitrate_allocation", "../api/video:video_frame", - "../api/video:video_frame_nv12", "../api/video:video_frame_type", "../api/video:video_rtp_headers", "../api/video_codecs:video_codecs_api",