summaryrefslogtreecommitdiffstats
path: root/media/audio/audio_parameters.h
diff options
context:
space:
mode:
authorcrogers@google.com <crogers@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-07 00:54:10 +0000
committercrogers@google.com <crogers@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-07 00:54:10 +0000
commitc158a30079b86c411ff72e0925755b1c6873fbbd (patch)
treedcd9aad135b0bb18926a57066e3efe6ba6a8d895 /media/audio/audio_parameters.h
parente876248ed8d704fc22a58e0b77fb96e01467558b (diff)
downloadchromium_src-c158a30079b86c411ff72e0925755b1c6873fbbd.zip
chromium_src-c158a30079b86c411ff72e0925755b1c6873fbbd.tar.gz
chromium_src-c158a30079b86c411ff72e0925755b1c6873fbbd.tar.bz2
Plumb |input_channels| all the way to AudioManager
to support synchronized audio I/O without requiring use of the "Web Audio Input" enable flag. The approach taken is to include |input_channels| as part of the AudioParameters class so that we can represent synchronized I/O streams directly without needing to separately pass |input_channels| through-out the callstack. Please note that we're still not yet removing the "Web Audio Input" flag until we more properly verify the input device selection from getUserMedia(). BUG=none TEST=manual test: http://chromium.googlecode.com/svn/trunk/samples/audio/visualizer-live.html Review URL: https://codereview.chromium.org/11878032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@181126 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/audio/audio_parameters.h')
-rw-r--r--media/audio/audio_parameters.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/media/audio/audio_parameters.h b/media/audio/audio_parameters.h
index 0225468..6f3c525 100644
--- a/media/audio/audio_parameters.h
+++ b/media/audio/audio_parameters.h
@@ -46,7 +46,12 @@ class MEDIA_EXPORT AudioParameters {
AudioParameters(Format format, ChannelLayout channel_layout,
int sample_rate, int bits_per_sample,
int frames_per_buffer);
+ AudioParameters(Format format, ChannelLayout channel_layout,
+ int input_channels,
+ int sample_rate, int bits_per_sample,
+ int frames_per_buffer);
void Reset(Format format, ChannelLayout channel_layout,
+ int input_channels,
int sample_rate, int bits_per_sample,
int frames_per_buffer);
@@ -69,6 +74,7 @@ class MEDIA_EXPORT AudioParameters {
int bits_per_sample() const { return bits_per_sample_; }
int frames_per_buffer() const { return frames_per_buffer_; }
int channels() const { return channels_; }
+ int input_channels() const { return input_channels_; }
private:
Format format_; // Format of the stream.
@@ -79,6 +85,9 @@ class MEDIA_EXPORT AudioParameters {
int channels_; // Number of channels. Value set based on
// |channel_layout|.
+ int input_channels_; // Optional number of input channels.
+ // Normally 0, but can be set to specify
+ // synchronized I/O.
};
// Comparison is useful when AudioParameters is used with std structures.
@@ -87,6 +96,8 @@ inline bool operator<(const AudioParameters& a, const AudioParameters& b) {
return a.format() < b.format();
if (a.channels() != b.channels())
return a.channels() < b.channels();
+ if (a.input_channels() != b.input_channels())
+ return a.input_channels() < b.input_channels();
if (a.sample_rate() != b.sample_rate())
return a.sample_rate() < b.sample_rate();
if (a.bits_per_sample() != b.bits_per_sample())