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

Unified Diff: media/renderers/audio_renderer_impl_unittest.cc

Issue 2752323002: Support Opus Ambisonics playback (Closed)
Patch Set: Fix issues from rebase Created 3 years, 7 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: media/renderers/audio_renderer_impl_unittest.cc
diff --git a/media/renderers/audio_renderer_impl_unittest.cc b/media/renderers/audio_renderer_impl_unittest.cc
index 123ec32059c372d56e0e560a3b1eae754bfe0119..b60516db024feb0d4823f30f0b709ea7522cb532 100644
--- a/media/renderers/audio_renderer_impl_unittest.cc
+++ b/media/renderers/audio_renderer_impl_unittest.cc
@@ -163,6 +163,12 @@ class AudioRendererImplTest : public ::testing::Test, public RendererClient {
ConfigureDemuxerStream(true);
}
+ // Reconfigures a demuxer stream using a given config.
+ void ConfigureChangeDemuxerStream(const AudioDecoderConfig& audio_config) {
+ demuxer_stream_.set_audio_decoder_config(audio_config);
+ ConfigureDemuxerStream(true);
+ }
+
// RendererClient implementation.
MOCK_METHOD1(OnError, void(PipelineStatus));
void OnEnded() override {
@@ -679,6 +685,34 @@ TEST_F(AudioRendererImplTest, ChannelMask) {
ASSERT_TRUE(mask[ch]);
}
+// Verify that the proper channel mask is configured when downmixing is applied
+// to the input with discrete layout. The default hardware layout is stereo.
+TEST_F(AudioRendererImplTest, ChannelMask_DownmixDiscreteLayout) {
+ int audio_channels = 9;
+
+ AudioDecoderConfig audio_config(
+ kCodecOpus, kSampleFormat, CHANNEL_LAYOUT_DISCRETE,
+ kInputSamplesPerSecond, EmptyExtraData(), Unencrypted());
+ audio_config.SetChannelsForDiscrete(audio_channels);
+ ConfigureChangeDemuxerStream(audio_config);
+
+ // Renderer supports discrete layout only if the sink_ is a web audio source
+ // with discrete layout as well.
+ AudioParameters sink_params(AudioParameters::AUDIO_PCM_LOW_LATENCY,
+ CHANNEL_LAYOUT_DISCRETE, kOutputSamplesPerSecond,
+ SampleFormatToBytesPerChannel(kSampleFormat) * 8,
+ 1024);
+ sink_params.set_channels_for_discrete(audio_channels);
+ ConfigureBasicRenderer(sink_params);
+
+ Initialize();
+ std::vector<bool> mask = channel_mask();
+ EXPECT_FALSE(mask.empty());
+ ASSERT_EQ(mask.size(), static_cast<size_t>(audio_channels));
+ for (int ch = 0; ch < audio_channels; ++ch)
+ ASSERT_TRUE(mask[ch]);
+}
+
TEST_F(AudioRendererImplTest, Underflow_Flush) {
Initialize();
Preroll();

Powered by Google App Engine
This is Rietveld 408576698