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

Unified Diff: content/renderer/media/video_capture_impl.cc

Issue 14175015: Allow VideoCaptureImpl to suspend/resume frame delivery to its client. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: code review Created 7 years, 8 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 | « content/renderer/media/video_capture_impl.h ('k') | content/renderer/media/video_capture_impl_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(&current_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());
« no previous file with comments | « content/renderer/media/video_capture_impl.h ('k') | content/renderer/media/video_capture_impl_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698