Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1983)

Unified Diff: content/renderer/media/audio_renderer_mixer_manager_unittest.cc

Issue 2752323002: Support Opus Ambisonics playback (Closed)
Patch Set: +pipeline integration tests, +test media, minor fixes Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/audio_renderer_mixer_manager_unittest.cc
diff --git a/content/renderer/media/audio_renderer_mixer_manager_unittest.cc b/content/renderer/media/audio_renderer_mixer_manager_unittest.cc
index 8ef3738fd959ee138571669bb9d87c96a912096d..52f7255d36259a33f8850610530b609e1a3fd337 100644
--- a/content/renderer/media/audio_renderer_mixer_manager_unittest.cc
+++ b/content/renderer/media/audio_renderer_mixer_manager_unittest.cc
@@ -32,6 +32,8 @@ const int kHardwareSampleRate = 44100;
const int kHardwareBufferSize = 128;
const media::ChannelLayout kChannelLayout = media::CHANNEL_LAYOUT_STEREO;
const media::ChannelLayout kAnotherChannelLayout = media::CHANNEL_LAYOUT_2_1;
+const media::ChannelLayout kDiscreteChannelLayout =
+ media::CHANNEL_LAYOUT_DISCRETE;
const char* const kDefaultDeviceId =
media::AudioDeviceDescription::kDefaultDeviceId;
const char kAnotherDeviceId[] = "another-device-id";
@@ -176,13 +178,13 @@ class AudioRendererMixerManagerTest : public testing::Test {
// Verify GetMixer() and ReturnMixer() both work as expected; particularly with
// respect to the explicit ref counting done.
TEST_F(AudioRendererMixerManagerTest, GetReturnMixer) {
- // Since we're testing two different sets of parameters, we expect
- // AudioRendererMixerManager to call Start and Stop on our mock twice.
- EXPECT_CALL(*mock_sink_.get(), Start()).Times(2);
- EXPECT_CALL(*mock_sink_.get(), Stop()).Times(2);
+ // Since we're testing three different sets of parameters, we expect
+ // AudioRendererMixerManager to call Start and Stop on our mock three times.
+ EXPECT_CALL(*mock_sink_.get(), Start()).Times(3);
+ EXPECT_CALL(*mock_sink_.get(), Stop()).Times(3);
- // We expect 2 mixers to be created; each of them should release the sink.
- EXPECT_CALL(*this, ReleaseSinkPtr(mock_sink_.get())).Times(2);
+ // We expect 3 mixers to be created; each of them should release the sink.
+ EXPECT_CALL(*this, ReleaseSinkPtr(mock_sink_.get())).Times(3);
// There should be no mixers outstanding to start with.
EXPECT_EQ(0, mixer_count());
@@ -224,6 +226,23 @@ TEST_F(AudioRendererMixerManagerTest, GetReturnMixer) {
EXPECT_EQ(1, mixer_count());
ReturnMixer(mixer2);
EXPECT_EQ(0, mixer_count());
+
+ // An input with CHANNEL_LAYOUT_DISCRETE should yield a mixer that defaults
+ // to the hardware channel layout.
+ media::AudioParameters params3(AudioParameters::AUDIO_PCM_LINEAR,
+ kDiscreteChannelLayout, kSampleRate * 2,
+ kBitsPerChannel, kBufferSize * 2);
+ media::AudioRendererMixer* mixer3 =
+ GetMixer(kRenderFrameId, params3, AudioLatency::LATENCY_PLAYBACK,
+ kDefaultDeviceId, kSecurityOrigin, nullptr);
+ ASSERT_TRUE(mixer3);
+ EXPECT_EQ(1, mixer_count());
+ EXPECT_EQ(mock_sink_->GetOutputDeviceInfo().output_params().channel_layout(),
+ mixer3->GetOutputParamsForTesting().channel_layout());
+
+ // Return the final mixer.
+ ReturnMixer(mixer3);
+ EXPECT_EQ(0, mixer_count());
}
// Verify GetMixer() correctly deduplicates mixer with irrelevant AudioParameter

Powered by Google App Engine
This is Rietveld 408576698