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

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

Issue 10391065: handle the case when device is closed before media pipeline is fully initialized. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: code review Created 8 years, 7 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/capture_video_decoder.h ('k') | media/video/capture/video_capture_device.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/capture_video_decoder.cc
===================================================================
--- content/renderer/media/capture_video_decoder.cc (revision 138673)
+++ content/renderer/media/capture_video_decoder.cc (working copy)
@@ -76,12 +76,18 @@
}
void CaptureVideoDecoder::OnPaused(media::VideoCapture* capture) {
- NOTIMPLEMENTED();
+ message_loop_proxy_->PostTask(
+ FROM_HERE,
+ base::Bind(&CaptureVideoDecoder::OnPausedOnDecoderThread,
+ this, capture));
}
void CaptureVideoDecoder::OnError(media::VideoCapture* capture,
int error_code) {
- NOTIMPLEMENTED();
+ message_loop_proxy_->PostTask(
+ FROM_HERE,
+ base::Bind(&CaptureVideoDecoder::OnPausedOnDecoderThread,
+ this, capture));
}
void CaptureVideoDecoder::OnRemoved(media::VideoCapture* capture) {
@@ -128,6 +134,9 @@
DCHECK(message_loop_proxy_->BelongsToCurrentThread());
CHECK(read_cb_.is_null());
read_cb_ = read_cb;
+ if (state_ == kPaused) {
+ DeliverFrame(media::VideoFrame::CreateEmptyFrame());
+ }
}
void CaptureVideoDecoder::ResetOnDecoderThread(const base::Closure& closure) {
@@ -159,9 +168,20 @@
vc_manager_->RemoveDevice(video_stream_id_, this);
}
+void CaptureVideoDecoder::OnPausedOnDecoderThread(
+ media::VideoCapture* capture) {
+ DVLOG(1) << "OnPausedOnDecoderThread";
+ DCHECK(message_loop_proxy_->BelongsToCurrentThread());
+ state_ = kPaused;
+ if (!read_cb_.is_null()) {
+ DeliverFrame(media::VideoFrame::CreateEmptyFrame());
+ }
+}
+
void CaptureVideoDecoder::OnDeviceInfoReceivedOnDecoderThread(
media::VideoCapture* capture,
const media::VideoCaptureParams& device_info) {
+ DVLOG(1) << "OnDeviceInfoReceivedOnDecoderThread";
DCHECK(message_loop_proxy_->BelongsToCurrentThread());
if (device_info.width != natural_size_.width() ||
device_info.height != natural_size_.height()) {
« no previous file with comments | « content/renderer/media/capture_video_decoder.h ('k') | media/video/capture/video_capture_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698