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

Unified Diff: media/renderers/audio_renderer_impl_unittest.cc

Issue 2752323002: Support Opus Ambisonics playback (Closed)
Patch Set: +tests 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: 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 b67788937980f81c26a5bbb9f2069170838140ae..b2a3433d68a6c6ed8c6409511382b9206a46b5af 100644
--- a/media/renderers/audio_renderer_impl_unittest.cc
+++ b/media/renderers/audio_renderer_impl_unittest.cc
@@ -153,6 +153,13 @@ 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);
+ ConfigureDecoder();
+ ConfigureDemuxerStream(true);
+ }
+
void ExpectUnsupportedAudioDecoder() {
EXPECT_CALL(*decoder_, Initialize(_, _, _, _))
.WillOnce(DoAll(SaveArg<3>(&output_cb_), RunCallback<2>(false)));
@@ -648,6 +655,62 @@ TEST_F(AudioRendererImplTest, ChannelMask) {
ASSERT_TRUE(mask[ch]);
}
+// Verify that the proper reduced search space is configured for playback rate
+// changes when downmixing is applied to the input with discrete layout.
+// The default hardware layout is stereo.
+TEST_F(AudioRendererImplTest, ChannelMask_DownmixDiscreteLayout) {
+ int audio_channels = 6;
+ AudioDecoderConfig audio_config(kCodecOpus, kSampleFormat,
+ CHANNEL_LAYOUT_DISCRETE,
+ kInputSamplesPerSecond, EmptyExtraData(),
+ Unencrypted());
+ audio_config.set_channels_for_discrete(audio_channels);
+ ConfigureChangeDemuxerStream(audio_config);
+
+ 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]);
+
+ // TODO (flim): channel configuration change?
+}
+
+// Verify that the proper reduced search space is configured for playback rate
+// changes when upmixing is applied to the input with discrete layout.
+TEST_F(AudioRendererImplTest, ChannelMask_UpmixDiscreteLayout) {
+ AudioParameters hw_params(AudioParameters::AUDIO_PCM_LOW_LATENCY,
+ CHANNEL_LAYOUT_7_1, kOutputSamplesPerSecond,
+ SampleFormatToBytesPerChannel(kSampleFormat) * 8,
+ 1024);
+ ConfigureConfigChangeRenderer(
+ AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY,
+ CHANNEL_LAYOUT_DISCRETE, kOutputSamplesPerSecond,
+ SampleFormatToBytesPerChannel(kSampleFormat) * 8, 1024),
+ hw_params);
+
+ AudioDecoderConfig audio_config(kCodecOpus, kSampleFormat,
+ CHANNEL_LAYOUT_DISCRETE,
+ kInputSamplesPerSecond, EmptyExtraData(),
+ Unencrypted());
+ audio_config.set_channels_for_discrete(4);
+ ConfigureChangeDemuxerStream(audio_config);
+
+ Initialize();
+ std::vector<bool> mask = channel_mask();
+ EXPECT_FALSE(mask.empty());
+ ASSERT_EQ(mask.size(), static_cast<size_t>(hw_params.channels()));
+ for (int ch = 0; ch < hw_params.channels(); ++ch) {
+ if (ch > 3)
+ ASSERT_FALSE(mask[ch]);
+ else
+ ASSERT_TRUE(mask[ch]);
+ }
+
+ // TODO (flim): channel configuration change?
+}
+
TEST_F(AudioRendererImplTest, Underflow_Flush) {
Initialize();
Preroll();
« media/renderers/audio_renderer_impl.cc ('K') | « media/renderers/audio_renderer_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698