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

Unified Diff: content/renderer/media/webrtc_audio_capturer.h

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: addressed Henrik's comments. 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
« no previous file with comments | « content/renderer/media/webaudio_capturer_source.cc ('k') | content/renderer/media/webrtc_audio_capturer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/webrtc_audio_capturer.h
diff --git a/content/renderer/media/webrtc_audio_capturer.h b/content/renderer/media/webrtc_audio_capturer.h
index 12e0a346890b4695480e87ca810821a322f63db9..dfadb56074ee9bb85c628b6d4cc5e1cb55683735 100644
--- a/content/renderer/media/webrtc_audio_capturer.h
+++ b/content/renderer/media/webrtc_audio_capturer.h
@@ -52,15 +52,24 @@ class CONTENT_EXPORT WebRtcAudioCapturer
int sample_rate,
int session_id);
+ // Called by the WebRtcAudioDeviceImpl to add the ADM as the default sink to
+ // the capturer. This function is needed since WebRTC supports only one ADM
+ // but multiple audio tracks, so the ADM can't be the sink of certain audio
+ // track now. And we also need to distinguish the WebRtcAudioDeviceImpl from
+ // the audio track in order to start/stop the source of the capturer
+ // correctly.
+ // TODO(xians): Remove this function after WebRtc supports multiple ADMs.
+ void SetDefaultSink(WebRtcAudioCapturerSink* sink);
+
// Add a audio track to the sinks of the capturer.
// WebRtcAudioDeviceImpl calls this method on the main render thread but
// other clients may call it from other threads. The current implementation
// does not support multi-thread calling.
- // Called on the main render thread.
+ // Called on the main render thread or libjingle working thread.
void AddSink(WebRtcAudioCapturerSink* track);
// Remove a audio track from the sinks of the capturer.
- // Called on the main render thread.
+ // Called on the main render thread or libjingle working thread.
void RemoveSink(WebRtcAudioCapturerSink* track);
// SetCapturerSource() is called if the client on the source side desires to
@@ -72,14 +81,6 @@ class CONTENT_EXPORT WebRtcAudioCapturer
media::ChannelLayout channel_layout,
float sample_rate);
- // Starts recording audio.
- // Called on the main render thread or a Libjingle working thread.
- void Start();
-
- // Stops recording audio.
- // Called on the main render thread or a Libjingle working thread.
- void Stop();
-
// Sets the microphone volume.
// Called on the AudioInputDevice audio thread.
void SetVolume(double volume);
@@ -117,6 +118,17 @@ class CONTENT_EXPORT WebRtcAudioCapturer
// Must be called without holding the lock. Returns true on success.
bool Reconfigure(int sample_rate, media::ChannelLayout channel_layout);
+ // Starts recording audio.
+ // Triggered by AddSink() on the main render thread or a Libjingle working
+ // thread. It should NOT be called under |lock_|.
+ void Start();
+
+ // Stops recording audio.
+ // Triggered by RemoveSink() on the main render thread or a Libjingle working
+ // thread. It should NOT be called under |lock_|.
+ void Stop();
+
+
// Used to DCHECK that we are called on the correct thread.
base::ThreadChecker thread_checker_;
@@ -127,6 +139,10 @@ class CONTENT_EXPORT WebRtcAudioCapturer
// A list of audio tracks that the audio data is fed to.
TrackList tracks_;
+ // A pointer to WebRtcAudioDeviceImpl which is the default destination of
+ // all the audio tracks data flow.
+ WebRtcAudioCapturerSink* default_sink_;
+
// The audio data source from the browser process.
scoped_refptr<media::AudioCapturerSource> source_;
« no previous file with comments | « content/renderer/media/webaudio_capturer_source.cc ('k') | content/renderer/media/webrtc_audio_capturer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698