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

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

Issue 295483002: Make sure ReadyStateEnded is fired when video stream stops (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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/media_stream_video_capturer_source.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/media_stream_video_capturer_source.cc
diff --git a/content/renderer/media/media_stream_video_capturer_source.cc b/content/renderer/media/media_stream_video_capturer_source.cc
index 4bcab47e9f294d60bb59c6cdbe2f1410b0a9e532..25bb59deee3a027f8e6e0cd56c511fef69ace7f2 100644
--- a/content/renderer/media/media_stream_video_capturer_source.cc
+++ b/content/renderer/media/media_stream_video_capturer_source.cc
@@ -98,10 +98,10 @@ void VideoCapturerDelegate::GetCurrentSupportedFormats(
void VideoCapturerDelegate::StartCapture(
const media::VideoCaptureParams& params,
const VideoCaptureDeliverFrameCB& new_frame_callback,
- const StartedCallback& started_callback) {
+ const RunningCallback& running_callback) {
DCHECK(params.requested_format.IsValid());
DCHECK(thread_checker_.CalledOnValidThread());
- started_callback_ = started_callback;
+ running_callback_ = running_callback;
got_first_frame_ = false;
// NULL in unit test.
@@ -127,7 +127,7 @@ void VideoCapturerDelegate::StopCapture() {
if (!stop_capture_cb_.is_null()) {
base::ResetAndReturn(&stop_capture_cb_).Run();
}
- started_callback_.Reset();
+ running_callback_.Reset();
source_formats_callback_.Reset();
}
@@ -135,9 +135,12 @@ void VideoCapturerDelegate::OnStateUpdateOnRenderThread(
VideoCaptureState state) {
DCHECK(thread_checker_.CalledOnValidThread());
DVLOG(3) << "OnStateUpdateOnRenderThread state = " << state;
- if (state > VIDEO_CAPTURE_STATE_STARTING && !started_callback_.is_null()) {
- base::ResetAndReturn(&started_callback_).Run(
- state == VIDEO_CAPTURE_STATE_STARTED);
+ if (state == VIDEO_CAPTURE_STATE_STARTED && !running_callback_.is_null()) {
+ running_callback_.Run(true);
+ return;
+ }
+ if (state > VIDEO_CAPTURE_STATE_STARTED && !running_callback_.is_null()) {
+ base::ResetAndReturn(&running_callback_).Run(false);
}
}
« no previous file with comments | « content/renderer/media/media_stream_video_capturer_source.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698