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

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

Issue 1966273002: VideoAdapter: Add cropping based on OnOutputFormatRequest() (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Remove unused variable Created 4 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
« no previous file with comments | « webrtc/media/base/videoadapter_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/media/base/videocapturer.cc
diff --git a/webrtc/media/base/videocapturer.cc b/webrtc/media/base/videocapturer.cc
index b00cbfe8e320c3eeaad1bd4734bf0b8ecbed81ef..084a9b913c7912f00e18647725dcb13c237a160d 100644
--- a/webrtc/media/base/videocapturer.cc
+++ b/webrtc/media/base/videocapturer.cc
@@ -220,17 +220,19 @@ void VideoCapturer::OnFrameCaptured(VideoCapturer*,
return;
}
- int adapted_width = captured_frame->width;
- int adapted_height = captured_frame->height;
+ int cropped_width = captured_frame->width;
+ int cropped_height = captured_frame->height;
+ int out_width = captured_frame->width;
+ int out_height = captured_frame->height;
if (enable_video_adapter_ && !IsScreencast()) {
- const VideoFormat adapted_format =
- video_adapter_.AdaptFrameResolution(adapted_width, adapted_height);
- if (adapted_format.IsSize0x0()) {
+ video_adapter_.AdaptFrameResolution(
+ captured_frame->width, captured_frame->height,
+ &cropped_width, &cropped_height,
+ &out_width, &out_height);
+ if (out_width == 0 || out_height == 0) {
// VideoAdapter dropped the frame.
return;
}
- adapted_width = adapted_format.width;
- adapted_height = adapted_format.height;
}
if (!frame_factory_) {
@@ -238,17 +240,15 @@ void VideoCapturer::OnFrameCaptured(VideoCapturer*,
return;
}
- // TODO(nisse): Reorganize frame factory methods, deleting crop
- // support there too.
+ // TODO(nisse): Reorganize frame factory methods.
std::unique_ptr<VideoFrame> adapted_frame(frame_factory_->CreateAliasedFrame(
- captured_frame, captured_frame->width, captured_frame->height,
- adapted_width, adapted_height));
+ captured_frame, cropped_width, cropped_height, out_width, out_height));
if (!adapted_frame) {
// TODO(fbarchard): LOG more information about captured frame attributes.
LOG(LS_ERROR) << "Couldn't convert to I420! "
<< "From " << ToString(captured_frame) << " To "
- << adapted_width << " x " << adapted_height;
+ << out_width << " x " << out_height;
return;
}
« no previous file with comments | « webrtc/media/base/videoadapter_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698