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

Unified Diff: content/browser/renderer_host/media/video_capture_device_impl.cc

Issue 103253003: Prevent upscaling in desktop capture. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/media/video_capture_device_impl.cc
diff --git a/content/browser/renderer_host/media/video_capture_device_impl.cc b/content/browser/renderer_host/media/video_capture_device_impl.cc
index f5a90d06632f863bb05c3abf60c2115b84aeca90..9b37b296c4f3aa43ebc21158b2193a505935ef89 100644
--- a/content/browser/renderer_host/media/video_capture_device_impl.cc
+++ b/content/browser/renderer_host/media/video_capture_device_impl.cc
@@ -138,10 +138,16 @@ void ThreadSafeCaptureOracle::UpdateCaptureSize(const gfx::Size& source_size) {
if (!capture_size_updated_ || params_.allow_resolution_change) {
// The capture resolution should not exceed the source frame size.
// In other words it should downscale the image but not upscale it.
- gfx::Rect capture_rect = media::ComputeLetterboxRegion(
- gfx::Rect(params_.requested_format.frame_size), source_size);
- capture_size_ = gfx::Size(MakeEven(capture_rect.width()),
- MakeEven(capture_rect.height()));
+ if (source_size.width() > params_.requested_format.frame_size.width() ||
+ source_size.height() > params_.requested_format.frame_size.height()) {
+ gfx::Rect capture_rect = media::ComputeLetterboxRegion(
+ gfx::Rect(params_.requested_format.frame_size), source_size);
+ capture_size_ = gfx::Size(MakeEven(capture_rect.width()),
+ MakeEven(capture_rect.height()));
+ } else {
+ capture_size_ = gfx::Size(MakeEven(source_size.width()),
+ MakeEven(source_size.height()));
+ }
capture_size_updated_ = true;
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698