Index: content/renderer/media/video_capture_impl.cc |
=================================================================== |
--- content/renderer/media/video_capture_impl.cc (revision 193973) |
+++ content/renderer/media/video_capture_impl.cc (working copy) |
@@ -56,6 +56,7 @@ |
device_id_(0), |
video_type_(media::VideoCaptureCapability::kI420), |
device_info_available_(false), |
+ suspended_(false), |
state_(VIDEO_CAPTURE_STATE_STOPPED) { |
DCHECK(filter); |
memset(¤t_params_, 0, sizeof(current_params_)); |
@@ -138,6 +139,12 @@ |
base::Unretained(this), device_id)); |
} |
+void VideoCaptureImpl::SuspendCapture(bool suspend) { |
+ capture_message_loop_proxy_->PostTask(FROM_HERE, |
+ base::Bind(&VideoCaptureImpl::DoSuspendCaptureOnCaptureThread, |
+ base::Unretained(this), suspend)); |
+} |
+ |
void VideoCaptureImpl::DoDeInitOnCaptureThread(base::Closure task) { |
if (state_ == VIDEO_CAPTURE_STATE_STARTED) |
Send(new VideoCaptureHostMsg_Stop(device_id_)); |
@@ -275,7 +282,7 @@ |
int buffer_id, base::Time timestamp) { |
DCHECK(capture_message_loop_proxy_->BelongsToCurrentThread()); |
- if (state_ != VIDEO_CAPTURE_STATE_STARTED) { |
+ if (state_ != VIDEO_CAPTURE_STATE_STARTED || suspended_) { |
Send(new VideoCaptureHostMsg_BufferReady(device_id_, buffer_id)); |
return; |
} |
@@ -364,6 +371,13 @@ |
} |
} |
+void VideoCaptureImpl::DoSuspendCaptureOnCaptureThread(bool suspend) { |
+ DVLOG(1) << "DoSuspendCapture: suspend " << (suspend ? "yes" : "no"); |
+ DCHECK(capture_message_loop_proxy_->BelongsToCurrentThread()); |
+ |
+ suspended_ = suspend; |
+} |
+ |
void VideoCaptureImpl::StopDevice() { |
DCHECK(capture_message_loop_proxy_->BelongsToCurrentThread()); |