summaryrefslogtreecommitdiffstats
path: root/media/audio/audio_parameters_unittest.cc
diff options
context:
space:
mode:
authorajm <ajm@chromium.org>2015-09-08 13:32:55 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-08 20:33:40 +0000
commit2e2f1c71bec505f3ae9d718dd8e875fedd4962e7 (patch)
treecbe6ef8143ddcef8dacf9fc1506dc9323c267e2c /media/audio/audio_parameters_unittest.cc
parent4b000195a8d27e9c3c4bfdd77113674840286a48 (diff)
downloadchromium_src-2e2f1c71bec505f3ae9d718dd8e875fedd4962e7.zip
chromium_src-2e2f1c71bec505f3ae9d718dd8e875fedd4962e7.tar.gz
chromium_src-2e2f1c71bec505f3ae9d718dd8e875fedd4962e7.tar.bz2
Refactor AudioParameters member setting.
Permit AudioParameters members to be set individually. Allows us to: - Cut back to the one non-default constructor which is frequently used. - Remove a bunch of boilerplate in the common case of updating one member. - Make adding future optional members (e.g. mic_positions) transparent to most callers. Maintain the Reset method but remove the channels parameter to have it mirror the constructor. Make it clear that channels_ is only required to be set explicitly with CHANNEL_LAYOUT_DISCRETE. BUG=497001 Review URL: https://codereview.chromium.org/1304973005 Cr-Commit-Position: refs/heads/master@{#347781}
Diffstat (limited to 'media/audio/audio_parameters_unittest.cc')
-rw-r--r--media/audio/audio_parameters_unittest.cc15
1 files changed, 3 insertions, 12 deletions
diff --git a/media/audio/audio_parameters_unittest.cc b/media/audio/audio_parameters_unittest.cc
index 92677eb..2cf541d 100644
--- a/media/audio/audio_parameters_unittest.cc
+++ b/media/audio/audio_parameters_unittest.cc
@@ -205,20 +205,11 @@ TEST(AudioParameters, Compare) {
TEST(AudioParameters, Constructor_ValidChannelCounts) {
int expected_channels = 8;
- ChannelLayout expected_layout = CHANNEL_LAYOUT_5_1;
+ ChannelLayout expected_layout = CHANNEL_LAYOUT_DISCRETE;
AudioParameters params(AudioParameters::AUDIO_PCM_LOW_LATENCY,
- expected_layout, expected_channels, 44100, 16, 880,
- AudioParameters::NO_EFFECTS);
-
- EXPECT_EQ(expected_channels, params.channels());
- EXPECT_EQ(expected_layout, params.channel_layout());
- EXPECT_FALSE(params.IsValid());
-
- expected_layout = CHANNEL_LAYOUT_DISCRETE;
- params.Reset(AudioParameters::AUDIO_PCM_LOW_LATENCY, expected_layout,
- expected_channels, 44100, 16, 880);
-
+ expected_layout, 44100, 16, 880);
+ params.set_channels_for_discrete(expected_channels);
EXPECT_EQ(expected_channels, params.channels());
EXPECT_EQ(expected_layout, params.channel_layout());
EXPECT_TRUE(params.IsValid());