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

Unified Diff: webrtc/media/base/videoframefactory.cc

Issue 2020593002: Refactor scaling. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Address Per's comments. Add I420Buffer::Scale helper method. Created 4 years, 6 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/media/base/videoframefactory.cc
diff --git a/webrtc/media/base/videoframefactory.cc b/webrtc/media/base/videoframefactory.cc
index 0a7dfc22d494a674c70899e425dc7ce1d55acc43..41063cd72654436dac96c910ff97d120703b3905 100644
--- a/webrtc/media/base/videoframefactory.cc
+++ b/webrtc/media/base/videoframefactory.cc
@@ -39,13 +39,12 @@ VideoFrame* VideoFrameFactory::CreateAliasedFrame(
std::swap(output_width, output_height);
}
- std::unique_ptr<VideoFrame> output_frame(new WebRtcVideoFrame(
- pool_.CreateBuffer(output_width, output_height),
- cropped_input_frame->rotation(),
- cropped_input_frame->timestamp_us()));
+ rtc::scoped_refptr<webrtc::I420Buffer> scaled =
+ pool_.CreateBuffer(output_width, output_height);
+ scaled->CropAndScale(cropped_input_frame->video_frame_buffer());
- cropped_input_frame->StretchToFrame(output_frame.get(), true, true);
- return output_frame.release();
+ return new WebRtcVideoFrame(scaled, cropped_input_frame->rotation(),
+ cropped_input_frame->timestamp_us());
}
} // namespace cricket

Powered by Google App Engine
This is Rietveld 408576698