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

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

Issue 13616004: Switch event type when a capture device has been stopped from the render process. This make sure th… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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
Index: content/renderer/media/rtc_video_capture_delegate.cc
diff --git a/content/renderer/media/rtc_video_capture_delegate.cc b/content/renderer/media/rtc_video_capture_delegate.cc
index 33a1917fc2d1b672818663813a2a8d479c3afa67..4dbbc027eae038b36365c7c42b188fd3b096fb24 100644
--- a/content/renderer/media/rtc_video_capture_delegate.cc
+++ b/content/renderer/media/rtc_video_capture_delegate.cc
@@ -67,6 +67,11 @@ void RtcVideoCaptureDelegate::OnError(media::VideoCapture* capture,
void RtcVideoCaptureDelegate::OnRemoved(media::VideoCapture* capture) {
DVLOG(3) << " RtcVideoCaptureDelegate::OnRemoved";
+ message_loop_proxy_->PostTask(
+ FROM_HERE,
+ base::Bind(&RtcVideoCaptureDelegate::OnRemovedOnCaptureThread,
+ this, capture));
+
// Balance the AddRef in StartCapture.
// This means we are no longer registered as an event handler and can safely
// be deleted.
@@ -103,6 +108,12 @@ void RtcVideoCaptureDelegate::OnBufferReadyOnCaptureThread(
capture->FeedBuffer(buf);
}
+void RtcVideoCaptureDelegate::OnRemovedOnCaptureThread(
+ media::VideoCapture* capture) {
+ if (!state_callback_.is_null())
+ state_callback_.Run(got_first_frame_ ? CAPTURE_STOPPED : CAPTURE_FAILED);
wjia(left Chromium) 2013/04/04 17:05:11 OnRemoved could be called after either OnError or
perkj_chrome 2013/04/05 09:19:35 right - removed onerror and only listen to OnRemov
+}
+
void RtcVideoCaptureDelegate::OnErrorOnCaptureThread(
media::VideoCapture* capture, int error_code) {
if (!state_callback_.is_null())

Powered by Google App Engine
This is Rietveld 408576698