Chromium Code Reviews| 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 |