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

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

Issue 218763007: Update MediaStreamTrack::Stop to latest draft. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make sure audio source stop is triggered if initialization fail. Created 6 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/media_stream.cc ('k') | content/renderer/media/media_stream_center.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/media_stream_audio_source.cc
diff --git a/content/renderer/media/media_stream_audio_source.cc b/content/renderer/media/media_stream_audio_source.cc
index 34f3087d47bb7770cabc487b441c1241a8545ead..cc0758c5ae30a090ec24e9a229d15a9bb1b109e1 100644
--- a/content/renderer/media/media_stream_audio_source.cc
+++ b/content/renderer/media/media_stream_audio_source.cc
@@ -34,18 +34,24 @@ void MediaStreamAudioSource::AddTrack(
const blink::WebMediaConstraints& constraints,
const ConstraintsCallback& callback) {
// TODO(xians): Properly implement for audio sources.
- if (!factory_)
- callback.Run(this, false);
+ CHECK(factory_);
- bool result = true;
if (!local_audio_source_) {
- result = factory_->InitializeMediaStreamAudioSource(render_view_id_,
- constraints,
- this);
+ if(!factory_->InitializeMediaStreamAudioSource(render_view_id_,
no longer working on chromium 2014/04/15 10:33:28 nit, add an empty space.
perkj_chrome 2014/04/15 11:00:44 Done.
+ constraints,
+ this)) {
+ // The source failed to start.
+ // MediaStreamImpl rely on the |stop_callback| to be triggered when the
+ // last track is removed from the source. But in this case, the source is
+ // is not even started. So we need to fail both adding the track and
+ // trigger |stop_callback|.
+ callback.Run(this, false);
+ StopSource();
+ return;
+ }
}
no longer working on chromium 2014/04/15 10:33:28 add, add an empty line.
perkj_chrome 2014/04/15 11:00:44 Done.
- if (result)
- factory_->CreateLocalAudioTrack(track);
- callback.Run(this, result);
+ factory_->CreateLocalAudioTrack(track);
+ callback.Run(this, true);
}
} // namespace content
« no previous file with comments | « content/renderer/media/media_stream.cc ('k') | content/renderer/media/media_stream_center.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698