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

Unified Diff: media/renderers/audio_renderer_impl_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: 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..db67faf974193df20523e6ea0533e3e5b586e067 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,60 @@ 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;
DaleCurtis 2017/03/31 19:06:53 Should be impossible to get discrete + 6 channels
flim-chromium 2017/04/05 18:19:34 Thanks for spotting this. It looks like UpmixDiscr
+ AudioDecoderConfig audio_config(
+ kCodecOpus, kSampleFormat, CHANNEL_LAYOUT_DISCRETE,
+ kInputSamplesPerSecond, EmptyExtraData(), Unencrypted());
+ audio_config.SetChannelsForDiscrete(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.SetChannelsForDiscrete(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();

Powered by Google App Engine
This is Rietveld 408576698