Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(374)

Unified Diff: webrtc/api/video/i420_buffer.cc

Issue 2906053002: Update I420Buffer to new VideoFrameBuffer interface (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/api/video/i420_buffer.cc
diff --git a/webrtc/api/video/i420_buffer.cc b/webrtc/api/video/i420_buffer.cc
index 51d83c9df58ba90508bb263434ebfca3c78d8e4e..c4afdba45bbf64ab10560bf540b2d9076914ceb1 100644
--- a/webrtc/api/video/i420_buffer.cc
+++ b/webrtc/api/video/i420_buffer.cc
@@ -76,8 +76,8 @@ rtc::scoped_refptr<I420Buffer> I420Buffer::Create(int width,
}
// static
-rtc::scoped_refptr<I420Buffer> I420Buffer::Copy(
- const VideoFrameBuffer& source) {
+rtc::scoped_refptr<I420Buffer> I420Buffer::Copy(const PlanarYuvBuffer& source) {
+ RTC_CHECK(source.type() == Type::kI420);
return Copy(source.width(), source.height(),
source.DataY(), source.StrideY(),
source.DataU(), source.StrideU(),
@@ -103,8 +103,9 @@ rtc::scoped_refptr<I420Buffer> I420Buffer::Copy(
}
// static
-rtc::scoped_refptr<I420Buffer> I420Buffer::Rotate(
- const VideoFrameBuffer& src, VideoRotation rotation) {
+rtc::scoped_refptr<I420Buffer> I420Buffer::Rotate(const PlanarYuvBuffer& src,
+ VideoRotation rotation) {
+ RTC_CHECK(src.type() == Type::kI420);
nisse-webrtc 2017/05/29 08:22:22 Hmm. To get better compile time type-checking, cou
magjed_webrtc 2017/05/29 12:12:06 Yeah, this is something I thought about when I did
nisse-webrtc 2017/05/29 12:37:17 Maybe we have to prepare some experimental cl to f
magjed_webrtc 2017/05/29 13:57:02 It's feasible, I uploaded a CL here: https://coder
nisse-webrtc 2017/05/29 14:35:55 I420BufferInterface is good enough, I think. And I
RTC_CHECK(src.DataY());
RTC_CHECK(src.DataU());
RTC_CHECK(src.DataV());
@@ -187,12 +188,12 @@ void I420Buffer::SetBlack(I420Buffer* buffer) {
0, 128, 128) == 0);
}
-void I420Buffer::CropAndScaleFrom(
- const VideoFrameBuffer& src,
- int offset_x,
- int offset_y,
- int crop_width,
- int crop_height) {
+void I420Buffer::CropAndScaleFrom(const PlanarYuvBuffer& src,
+ int offset_x,
+ int offset_y,
+ int crop_width,
+ int crop_height) {
+ RTC_CHECK(src.type() == Type::kI420);
RTC_CHECK_LE(crop_width, src.width());
RTC_CHECK_LE(crop_height, src.height());
RTC_CHECK_LE(crop_width + offset_x, src.width());
@@ -224,8 +225,7 @@ void I420Buffer::CropAndScaleFrom(
RTC_DCHECK_EQ(res, 0);
}
-void I420Buffer::CropAndScaleFrom(
- const VideoFrameBuffer& src) {
+void I420Buffer::CropAndScaleFrom(const PlanarYuvBuffer& src) {
const int crop_width =
std::min(src.width(), width() * src.height() / height());
const int crop_height =
@@ -237,7 +237,7 @@ void I420Buffer::CropAndScaleFrom(
crop_width, crop_height);
}
-void I420Buffer::ScaleFrom(const VideoFrameBuffer& src) {
+void I420Buffer::ScaleFrom(const PlanarYuvBuffer& src) {
CropAndScaleFrom(src, 0, 0, src.width(), src.height());
}

Powered by Google App Engine
This is Rietveld 408576698