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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/media/media_stream_audio_source.h" 5 #include "content/renderer/media/media_stream_audio_source.h"
6 6
7 namespace content { 7 namespace content {
8 8
9 MediaStreamAudioSource::MediaStreamAudioSource( 9 MediaStreamAudioSource::MediaStreamAudioSource(
10 int render_view_id, 10 int render_view_id,
(...skipping 16 matching lines...) Expand all
27 void MediaStreamAudioSource::DoStopSource() { 27 void MediaStreamAudioSource::DoStopSource() {
28 if (audio_capturer_.get()) 28 if (audio_capturer_.get())
29 audio_capturer_->Stop(); 29 audio_capturer_->Stop();
30 } 30 }
31 31
32 void MediaStreamAudioSource::AddTrack( 32 void MediaStreamAudioSource::AddTrack(
33 const blink::WebMediaStreamTrack& track, 33 const blink::WebMediaStreamTrack& track,
34 const blink::WebMediaConstraints& constraints, 34 const blink::WebMediaConstraints& constraints,
35 const ConstraintsCallback& callback) { 35 const ConstraintsCallback& callback) {
36 // TODO(xians): Properly implement for audio sources. 36 // TODO(xians): Properly implement for audio sources.
37 if (!factory_) 37 CHECK(factory_);
38 callback.Run(this, false);
39 38
40 bool result = true;
41 if (!local_audio_source_) { 39 if (!local_audio_source_) {
42 result = factory_->InitializeMediaStreamAudioSource(render_view_id_, 40 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.
43 constraints, 41 constraints,
44 this); 42 this)) {
43 // The source failed to start.
44 // MediaStreamImpl rely on the |stop_callback| to be triggered when the
45 // last track is removed from the source. But in this case, the source is
46 // is not even started. So we need to fail both adding the track and
47 // trigger |stop_callback|.
48 callback.Run(this, false);
49 StopSource();
50 return;
51 }
45 } 52 }
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.
46 if (result) 53 factory_->CreateLocalAudioTrack(track);
47 factory_->CreateLocalAudioTrack(track); 54 callback.Run(this, true);
48 callback.Run(this, result);
49 } 55 }
50 56
51 } // namespace content 57 } // namespace content
OLDNEW
« 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