diff options
author | xians@chromium.org <xians@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-03 11:09:05 +0000 |
---|---|---|
committer | xians@chromium.org <xians@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-03 11:09:05 +0000 |
commit | 2372e96427d128a67ada47547bd1826276a0e62a (patch) | |
tree | 7b19533629dc2188b186e14a54f592168d994df7 /media/audio/pulse | |
parent | c5ab76dfd2e6fd9e84f67e7223fa5dad80919853 (diff) | |
download | chromium_src-2372e96427d128a67ada47547bd1826276a0e62a.zip chromium_src-2372e96427d128a67ada47547bd1826276a0e62a.tar.gz chromium_src-2372e96427d128a67ada47547bd1826276a0e62a.tar.bz2 |
Try relanding this CL, the original CL passed the try bots but failed the mac 10.7 bot because the oroginal CL queried the device info while there is no device on the bot.
Hook up the device selection to the WebAudio live audio.
WebAudio live audio needs to pass the session_id to the browser process so that Chrome can open the correct input device for unitfied IO.
This CL looks big because it touches quite some interfaces from the render to the browser. But the change is simple and basically adding a session_id/device_id to the classes. All the changes some together and it is very hard to break it down.
It also makes the media output code more similar to the media input code as well, and it will be easier to merge them for the future.
TBR=henrika@chormium.org
BUG=147327
TEST=http://chromium.googlecode.com/svn/trunk/samples/audio/visualizer-live.html
Change the device using the camera icon on the right of the omnibox, then reload. Verify the sound is coming from the correct input device.
Review URL: https://codereview.chromium.org/15979015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203695 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/audio/pulse')
-rw-r--r-- | media/audio/pulse/audio_manager_pulse.cc | 10 | ||||
-rw-r--r-- | media/audio/pulse/audio_manager_pulse.h | 6 | ||||
-rw-r--r-- | media/audio/pulse/pulse_unified.cc | 10 | ||||
-rw-r--r-- | media/audio/pulse/pulse_unified.h | 5 |
4 files changed, 20 insertions, 11 deletions
diff --git a/media/audio/pulse/audio_manager_pulse.cc b/media/audio/pulse/audio_manager_pulse.cc index fed919a..3dcdd89 100644 --- a/media/audio/pulse/audio_manager_pulse.cc +++ b/media/audio/pulse/audio_manager_pulse.cc @@ -112,13 +112,13 @@ AudioParameters AudioManagerPulse::GetInputStreamParameters( AudioOutputStream* AudioManagerPulse::MakeLinearOutputStream( const AudioParameters& params) { DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format()); - return MakeOutputStream(params); + return MakeOutputStream(params, std::string()); } AudioOutputStream* AudioManagerPulse::MakeLowLatencyOutputStream( - const AudioParameters& params) { + const AudioParameters& params, const std::string& input_device_id) { DCHECK_EQ(AudioParameters::AUDIO_PCM_LOW_LATENCY, params.format()); - return MakeOutputStream(params); + return MakeOutputStream(params, input_device_id); } AudioInputStream* AudioManagerPulse::MakeLinearInputStream( @@ -162,9 +162,9 @@ AudioParameters AudioManagerPulse::GetPreferredOutputStreamParameters( } AudioOutputStream* AudioManagerPulse::MakeOutputStream( - const AudioParameters& params) { + const AudioParameters& params, const std::string& input_device_id) { if (params.input_channels()) { - return new PulseAudioUnifiedStream(params, this); + return new PulseAudioUnifiedStream(params, input_device_id, this); } return new PulseAudioOutputStream(params, this); diff --git a/media/audio/pulse/audio_manager_pulse.h b/media/audio/pulse/audio_manager_pulse.h index 9dacb9c..d5cb93e 100644 --- a/media/audio/pulse/audio_manager_pulse.h +++ b/media/audio/pulse/audio_manager_pulse.h @@ -34,7 +34,8 @@ class MEDIA_EXPORT AudioManagerPulse : public AudioManagerBase { virtual AudioOutputStream* MakeLinearOutputStream( const AudioParameters& params) OVERRIDE; virtual AudioOutputStream* MakeLowLatencyOutputStream( - const AudioParameters& params) OVERRIDE; + const AudioParameters& params, + const std::string& input_device_id) OVERRIDE; virtual AudioInputStream* MakeLinearInputStream( const AudioParameters& params, const std::string& device_id) OVERRIDE; virtual AudioInputStream* MakeLowLatencyInputStream( @@ -60,7 +61,8 @@ class MEDIA_EXPORT AudioManagerPulse : public AudioManagerBase { void* user_data); // Called by MakeLinearOutputStream and MakeLowLatencyOutputStream. - AudioOutputStream* MakeOutputStream(const AudioParameters& params); + AudioOutputStream* MakeOutputStream(const AudioParameters& params, + const std::string& input_device_id); // Called by MakeLinearInputStream and MakeLowLatencyInputStream. AudioInputStream* MakeInputStream(const AudioParameters& params, diff --git a/media/audio/pulse/pulse_unified.cc b/media/audio/pulse/pulse_unified.cc index 87bb6ae..ee14341 100644 --- a/media/audio/pulse/pulse_unified.cc +++ b/media/audio/pulse/pulse_unified.cc @@ -41,9 +41,12 @@ void PulseAudioUnifiedStream::ReadCallback(pa_stream* handle, size_t length, static_cast<PulseAudioUnifiedStream*>(user_data)->ReadData(); } -PulseAudioUnifiedStream::PulseAudioUnifiedStream(const AudioParameters& params, - AudioManagerBase* manager) +PulseAudioUnifiedStream::PulseAudioUnifiedStream( + const AudioParameters& params, + const std::string& input_device_id, + AudioManagerBase* manager) : params_(params), + input_device_id_(input_device_id), manager_(manager), pa_context_(NULL), pa_mainloop_(NULL), @@ -77,9 +80,8 @@ bool PulseAudioUnifiedStream::Open() { params_, &StreamNotifyCallback, NULL, this)) return false; - // TODO(xians): Add support for non-default device. if (!pulse::CreateInputStream(pa_mainloop_, pa_context_, &input_stream_, - params_, AudioManagerBase::kDefaultDeviceId, + params_, input_device_id_, &StreamNotifyCallback, this)) return false; diff --git a/media/audio/pulse/pulse_unified.h b/media/audio/pulse/pulse_unified.h index d7476a8..a800d09 100644 --- a/media/audio/pulse/pulse_unified.h +++ b/media/audio/pulse/pulse_unified.h @@ -6,6 +6,7 @@ #define MEDIA_AUDIO_PULSE_PULSE_UNIFIED_H_ #include <pulse/pulseaudio.h> +#include <string> #include "base/memory/scoped_ptr.h" #include "media/audio/audio_io.h" @@ -20,6 +21,7 @@ class SeekableBuffer; class PulseAudioUnifiedStream : public AudioOutputStream { public: PulseAudioUnifiedStream(const AudioParameters& params, + const std::string& input_device_id, AudioManagerBase* manager); virtual ~PulseAudioUnifiedStream(); @@ -51,6 +53,9 @@ class PulseAudioUnifiedStream : public AudioOutputStream { // AudioParameters from the constructor. const AudioParameters params_; + // Device unique ID of the input device. + const std::string input_device_id_; + // Audio manager that created us. Used to report that we've closed. AudioManagerBase* manager_; |