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

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

Issue 100313002: Fix screen capture slowness in Chrome OS feedback report. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add OWNERS for video_capture_device_impl* which got refactored from web_contents_*. 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
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 54af30f71b461e6ad74bfa760c18c8dcc832cb45..7896fb19f2681c50d6ed1bdedca1b07a12dc4090 100644
--- a/content/browser/renderer_host/media/video_capture_device_impl.cc
+++ b/content/browser/renderer_host/media/video_capture_device_impl.cc
@@ -44,12 +44,15 @@ void DeleteCaptureMachineOnUIThread(
ThreadSafeCaptureOracle::ThreadSafeCaptureOracle(
scoped_ptr<media::VideoCaptureDevice::Client> client,
scoped_ptr<VideoCaptureOracle> oracle,
- const gfx::Size& capture_size,
+ const gfx::Size& max_frame_size,
int frame_rate)
: client_(client.Pass()),
oracle_(oracle.Pass()),
- capture_size_(capture_size),
- frame_rate_(frame_rate) {}
+ max_frame_size_(max_frame_size),
+ frame_rate_(frame_rate) {
+ // Set initial capture size to maximum frame size.
+ capture_size_ = max_frame_size_;
+}
ThreadSafeCaptureOracle::~ThreadSafeCaptureOracle() {}
@@ -122,6 +125,16 @@ bool ThreadSafeCaptureOracle::ObserveEventAndDecideCapture(
return true;
}
+void ThreadSafeCaptureOracle::UpdateCaptureSize(const gfx::Size& source_size) {
+ base::AutoLock guard(lock_);
+
+ // The capture resolution should not exceed the source frame size.
+ // In other words it should downscale the image but not upscale it.
+ gfx::Size capture_size = max_frame_size_;
+ capture_size.SetToMin(source_size);
+ capture_size_ = capture_size;
+}
+
void ThreadSafeCaptureOracle::Stop() {
base::AutoLock guard(lock_);
client_.reset();

Powered by Google App Engine
This is Rietveld 408576698