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

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

Issue 15979027: start/stop the source of the capturer when 1st audiotrack/last audiotrack is added/removed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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/media_stream_dependency_factory.cc
diff --git a/content/renderer/media/media_stream_dependency_factory.cc b/content/renderer/media/media_stream_dependency_factory.cc
index fc0cc0dc80b80c74b11d7050a857a626d1cec1e2..f88f112b77edb7d18793e32650fc2a9a27247657 100644
--- a/content/renderer/media/media_stream_dependency_factory.cc
+++ b/content/renderer/media/media_stream_dependency_factory.cc
@@ -413,11 +413,9 @@ bool MediaStreamDependencyFactory::AddNativeMediaStreamTrack(
scoped_refptr<webrtc::AudioTrackInterface> audio_track(
CreateLocalAudioTrack(track_id, source_data->local_audio_source()));
audio_track->set_enabled(track.isEnabled());
- if (GetWebRtcAudioDevice()) {
- WebRtcAudioCapturer* capturer = GetWebRtcAudioDevice()->capturer().get();
- if (!capturer->is_recording())
- capturer->Start();
- }
+ if (GetWebRtcAudioDevice() && GetWebRtcAudioDevice()->capturer().get())
henrika (OOO until Aug 14) 2013/06/05 09:09:20 It is now a bit unclear why this if-statement is n
no longer working on chromium 2013/06/05 16:29:45 Good catch, it is because we were using MockLocalA
+ static_cast<WebRtcLocalAudioTrack*>(audio_track.get())->Start();
henrika (OOO until Aug 14) 2013/06/05 09:09:20 Can you add some comments here to explain what act
no longer working on chromium 2013/06/05 16:29:45 Done.
+
return native_stream->AddTrack(audio_track.get());
} else {
scoped_refptr<webrtc::VideoTrackInterface> video_track(
@@ -690,13 +688,11 @@ void MediaStreamDependencyFactory::StopLocalAudioSource(
MediaStreamExtraData* extra_data = static_cast<MediaStreamExtraData*>(
description.extraData());
if (extra_data && extra_data->is_local() && extra_data->stream().get() &&
- !extra_data->stream()->GetAudioTracks().empty()) {
- if (GetWebRtcAudioDevice()) {
- scoped_refptr<WebRtcAudioCapturer> capturer =
- GetWebRtcAudioDevice()->capturer();
- if (capturer.get())
- capturer->Stop();
- }
+ !extra_data->stream()->GetAudioTracks().empty() &&
+ GetWebRtcAudioDevice() &&
henrika (OOO until Aug 14) 2013/06/05 09:09:20 Same comment as above. It is not clear why you mus
no longer working on chromium 2013/06/05 16:29:45 Removed.
+ GetWebRtcAudioDevice()->capturer().get()) {
+ static_cast<WebRtcLocalAudioTrack*>(
henrika (OOO until Aug 14) 2013/06/05 09:09:20 You call start when a track is added and stop when
no longer working on chromium 2013/06/05 16:29:45 StopLocalAudioSource is the wrong name, it should
+ extra_data->stream()->GetAudioTracks()[0].get())->Stop();
}
}
« no previous file with comments | « no previous file | content/renderer/media/webaudio_capturer_source.cc » ('j') | content/renderer/media/webaudio_capturer_source.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698