Chromium Code Reviews (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out

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

Issue 12440027: Do not pass the string device_id via IPC message to create an audio input stream (Closed) Base URL: svn://
Patch Set: addressed palmer's comments Created 7 years, 9 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/webrtc_audio_capturer.h
diff --git a/content/renderer/media/webrtc_audio_capturer.h b/content/renderer/media/webrtc_audio_capturer.h
index 960b4e02c4db8104028ad8161fff7312781f97a8..5df8d7e04047a84613488e69930d6af6014dd8b3 100644
--- a/content/renderer/media/webrtc_audio_capturer.h
+++ b/content/renderer/media/webrtc_audio_capturer.h
@@ -33,23 +33,22 @@ class WebRtcLocalAudioRenderer;
// created on the main render thread, captured data is provided on a dedicated
// AudioInputDevice thread, and methods can be called either on the Libjingle
// thread or on the main render thread but also other client threads
-// if an alternative AudioCapturerSource has been set. In addition, the
-// AudioCapturerSource::CaptureEventHandler methods are called on the IO thread
-// and requests for data to render is done on the AudioOutputDevice thread.
+// if an alternative AudioCapturerSource has been set.
class CONTENT_EXPORT WebRtcAudioCapturer
: public base::RefCountedThreadSafe<WebRtcAudioCapturer>,
- NON_EXPORTED_BASE(public media::AudioCapturerSource::CaptureCallback),
- public media::AudioCapturerSource::CaptureEventHandler) {
+ NON_EXPORTED_BASE(public media::AudioCapturerSource::CaptureCallback) {
// Use to construct the audio capturer.
// Called on the main render thread.
static scoped_refptr<WebRtcAudioCapturer> CreateCapturer();
// Creates and configures the default audio capturing source using the
- // provided audio parameters.
+ // provided audio parameters, |session_id| is used to be passed to the
+ // browser to decide which device to use.
// Called on the main render thread.
- bool Initialize(media::ChannelLayout channel_layout, int sample_rate);
+ bool Initialize(media::ChannelLayout channel_layout,
+ int sample_rate,
+ int session_id);
// Called by the client on the sink side to add a sink.
// WebRtcAudioDeviceImpl calls this method on the main render thread but
@@ -84,10 +83,6 @@ class CONTENT_EXPORT WebRtcAudioCapturer
// Called on the AudioInputDevice audio thread.
void SetVolume(double volume);
- // Specifies the |session_id| to query which device to use.
- // Called on the main render thread.
- void SetDevice(int session_id);
// Enables or disables the WebRtc AGC control.
// Called from a Libjingle working thread.
void SetAutomaticGainControl(bool enable);
@@ -109,11 +104,6 @@ class CONTENT_EXPORT WebRtcAudioCapturer
double volume) OVERRIDE;
virtual void OnCaptureError() OVERRIDE;
- // AudioCapturerSource::CaptureEventHandler implementation.
- // Called on the IO thread.
- virtual void OnDeviceStarted(const std::string& device_id) OVERRIDE;
- virtual void OnDeviceStopped() OVERRIDE;
friend class base::RefCountedThreadSafe<WebRtcAudioCapturer>;
virtual ~WebRtcAudioCapturer();
@@ -127,21 +117,11 @@ class CONTENT_EXPORT WebRtcAudioCapturer
// Must be called without holding the lock. Returns true on success.
bool Reconfigure(int sample_rate, media::ChannelLayout channel_layout);
- // Distributes information about a stopped capture device to all registered
- // capture sinks.
- // Runs on the main render thread.
- void DoOnDeviceStopped();
// Used to DCHECK that we are called on the correct thread.
base::ThreadChecker thread_checker_;
- // Message loop for the main render thread. Utilized in OnDeviceStopped() to
- // ensure that OnSourceCaptureDeviceStopped() is called on the main thread
- // instead of the originating IO thread.
- scoped_refptr<base::MessageLoopProxy> main_loop_;
- // Protects |source_|, |sinks_|, |running_|, |on_device_stopped_cb_|,
- // |loopback_fifo_|, |params_|, |buffering_| and |agc_is_enabled_|.
+ // Protects |source_|, |sinks_|, |running_|, |loopback_fifo_|, |params_|,
+ // |buffering_| and |agc_is_enabled_|.
mutable base::Lock lock_;
// A list of sinks that the audio data is fed to.
@@ -154,12 +134,14 @@ class CONTENT_EXPORT WebRtcAudioCapturer
// Allocated during initialization.
class ConfiguredBuffer;
scoped_refptr<ConfiguredBuffer> buffer_;
- std::string device_id_;
bool running_;
// True when automatic gain control is enabled, false otherwise.
bool agc_is_enabled_;
+ // The media session ID used to identify which input device to be started.
+ int session_id_;

Powered by Google App Engine
This is Rietveld 408576698