diff options
author | xians@chromium.org <xians@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-07 13:04:43 +0000 |
---|---|---|
committer | xians@chromium.org <xians@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-07 13:04:43 +0000 |
commit | edd43f46f26e82e275d31b980f42953f521e46b7 (patch) | |
tree | 5f66be0286d73ea415d244080ab06375566e5c9a /media/audio/audio_manager_base.h | |
parent | 57354fdc1e76f6775e6cfd32fb2a6503932cb8b8 (diff) | |
download | chromium_src-edd43f46f26e82e275d31b980f42953f521e46b7.zip chromium_src-edd43f46f26e82e275d31b980f42953f521e46b7.tar.gz chromium_src-edd43f46f26e82e275d31b980f42953f521e46b7.tar.bz2 |
Reland r186180 after fixing the --audio-buffer-size flag and cras issue.
In addition to relanding r186180, this patch gets back the --audio-buffer-size flag support and also fixed the audio issue in cras.
The review for r186180 is https://codereview.chromium.org/12316131/
Moved AudioUtil static functions:
GetAudioHardwareSampleRate
GetAudioInputHardwareSampleRate
GetAudioHardwareBufferSize
GetAudioInputHardwareChannelLayout
to AudioManager interfaces:
GetDefaultOutputStreamParameters()
GetDefaultInputStreamParameters(const std::string& device_id)
By doing this, we remove the messy ifdef statements in AudioUtil, allow getting the native sample rate for Pulse, each AudioManager is responsible for providing the optimal audio params to achieve the best audio performance, for example, cras can raise the buffer size to reduce CPU consumption without affecting other Linux products.
TBR=dalecurtis@chromium.org
BUG=178142, 137326, 120319
TEST=media_unittests, content_unittests
Review URL: https://codereview.chromium.org/12602002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@186698 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/audio/audio_manager_base.h')
-rw-r--r-- | media/audio/audio_manager_base.h | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/media/audio/audio_manager_base.h b/media/audio/audio_manager_base.h index 22140cb..2275f9b 100644 --- a/media/audio/audio_manager_base.h +++ b/media/audio/audio_manager_base.h @@ -83,21 +83,16 @@ class MEDIA_EXPORT AudioManagerBase : public AudioManager { virtual AudioInputStream* MakeLowLatencyInputStream( const AudioParameters& params, const std::string& device_id) = 0; - // Returns the preferred hardware audio output parameters for opening output - // streams in the |AUDIO_PCM_LOW_LATENCY| format. - // TODO(dalecurtis): Retrieve the |channel_layout| value from hardware instead - // of accepting the value. - // TODO(dalecurtis): Each AudioManager should implement their own version, see - // http://crbug.com/137326 - virtual AudioParameters GetPreferredLowLatencyOutputStreamParameters( - const AudioParameters& input_params); - // Listeners will be notified on the AudioManager::GetMessageLoop() loop. virtual void AddOutputDeviceChangeListener( AudioDeviceListener* listener) OVERRIDE; virtual void RemoveOutputDeviceChangeListener( AudioDeviceListener* listener) OVERRIDE; + virtual AudioParameters GetDefaultOutputStreamParameters() OVERRIDE; + virtual AudioParameters GetInputStreamParameters( + const std::string& device_id) OVERRIDE; + protected: AudioManagerBase(); @@ -121,6 +116,14 @@ class MEDIA_EXPORT AudioManagerBase : public AudioManager { // thread. void NotifyAllOutputDeviceChangeListeners(); + // Returns the preferred hardware audio output parameters for opening output + // streams. If the users inject a valid |input_params|, each AudioManager + // will decide if they should return the values from |input_params| or the + // default hardware values. If the |input_params| is invalid, it will return + // the default hardware audio parameters. + virtual AudioParameters GetPreferredOutputStreamParameters( + const AudioParameters& input_params) = 0; + // Map of cached AudioOutputDispatcher instances. Must only be touched // from the audio thread (no locking). AudioOutputDispatchersMap output_dispatchers_; |