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); |
Sergey Ulanov
2013/12/03 00:01:52
There is allow_resolution_change flag in VideoCap
hshi1
2013/12/03 01:04:53
Thanks for the suggestion, I've made the following
|
+ capture_size_ = capture_size; |
+} |
+ |
void ThreadSafeCaptureOracle::Stop() { |
base::AutoLock guard(lock_); |
client_.reset(); |