diff options
author | cpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-13 03:53:19 +0000 |
---|---|---|
committer | cpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-13 03:53:19 +0000 |
commit | 143a3873e13984a9aad1950de50f5a68e8e2f49b (patch) | |
tree | 4951fd20eede1173c12bb6aa7f25f1c7c2230c17 /media/audio/audio_output.h | |
parent | 7c79dac6238718b3f8fa9354a68035791aecbde1 (diff) | |
download | chromium_src-143a3873e13984a9aad1950de50f5a68e8e2f49b.zip chromium_src-143a3873e13984a9aad1950de50f5a68e8e2f49b.tar.gz chromium_src-143a3873e13984a9aad1950de50f5a68e8e2f49b.tar.bz2 |
More plumbing of the low latency mode
- added flag to factory to request low latency mode
- implemented switch from triple buffered to double buffer on windows (mac is already double buffered all the time)
- added tests
BUG=28292
TEST=ut included
Review URL: http://codereview.chromium.org/523073
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36090 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/audio/audio_output.h')
-rw-r--r-- | media/audio/audio_output.h | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/media/audio/audio_output.h b/media/audio/audio_output.h index 29712bf..2d249d7 100644 --- a/media/audio/audio_output.h +++ b/media/audio/audio_output.h @@ -72,9 +72,11 @@ class AudioOutputStream { // Open the stream. |packet_size| is the requested buffer allocation which // the audio source thinks it can usually fill without blocking. Internally - // two buffers of |packet_size| size are created, one will be locked for - // playback and one will be ready to be filled in the call to + // two or three buffers of |packet_size| size are created, one will be + // locked for playback and one will be ready to be filled in the call to // AudioSourceCallback::OnMoreData(). + // The number of buffers is controlled by AUDIO_PCM_LOW_LATENCY. See more + // information below. // // TODO(ajwong): Streams are not reusable, so try to move packet_size into the // constructor. @@ -111,11 +113,10 @@ class AudioOutputStream { class AudioManager { public: enum Format { - AUDIO_PCM_LINEAR = 0, // Pulse code modulation means 'raw' amplitude - // samples. - AUDIO_PCM_DELTA, // Delta-encoded pulse code modulation. - AUDIO_MOCK, // Creates a dummy AudioOutputStream object. - AUDIO_LAST_FORMAT // Only used for validation of format. + AUDIO_PCM_LINEAR = 0, // PCM is 'raw' amplitude samples. + AUDIO_PCM_LOW_LATENCY, // Linear PCM, low latency requested. + AUDIO_MOCK, // Creates a dummy AudioOutputStream object. + AUDIO_LAST_FORMAT // Only used for validation of format. }; // Telephone quality sample rate, mostly for speech-only audio. @@ -129,13 +130,18 @@ class AudioManager { // guarantee that the existing devices support all formats and sample rates. virtual bool HasAudioDevices() = 0; - // Factory for all the supported stream formats. At this moment |channels| - // can be 1 (mono) or 2 (stereo). The |sample_rate| is in hertz and can be - // any value supported by the underlying platform. For some future formats - // the |sample_rate| and |bits_per_sample| can take special values. + // Factory for all the supported stream formats. The |channels| can be 1 to 5. + // The |sample_rate| is in hertz and can be any value supported by the + // platform. For some future formats the |sample_rate| and |bits_per_sample| + // can take special values. // Returns NULL if the combination of the parameters is not supported, or if // we have reached some other platform specific limit. // + // AUDIO_PCM_LOW_LATENCY can be passed to this method and it has two effects: + // 1- Instead of triple buffered the audio will be double buffered. + // 2- A low latency driver or alternative audio subsystem will be used when + // available. + // // Do not free the returned AudioOutputStream. It is owned by AudioManager. virtual AudioOutputStream* MakeAudioStream(Format format, int channels, int sample_rate, |