Decoder for multistream Opus.

See https://webrtc-review.googlesource.com/c/src/+/121764 for the
overall vision.

This CL adds a multistream Opus decoder. It's a new code-path to not
interfere with the standard Opus decoder. We introduce new SDP syntax,
which uses terminology of RFC 7845. We also set up the decoder side to
parse it. The encoder part will come in a later CL.

E.g. this is the new SDP syntax for 6.1 surround sound:
"multiopus/48000/6 channel_mapping=0,4,1,2,3,5 num_streams=4 coupled_streams=2"

Bug: webrtc:8649
Change-Id: Ifbc584cbb6d07aed373f223512a20d6d72cec5ec
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/129768
Commit-Queue: Alex Loiko <aleloi@webrtc.org>
Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27493}
This commit is contained in:
Alex Loiko
2019-04-08 17:19:41 +02:00
committed by Commit Bot
parent e9d2b4efdd
commit e5b94160b5
20 changed files with 918 additions and 96 deletions

View File

@ -17,6 +17,7 @@
#include "api/audio_codecs/audio_encoder.h"
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
#include "api/audio_codecs/opus/audio_decoder_multi_channel_opus.h"
#include "api/audio_codecs/opus/audio_decoder_opus.h"
#include "api/audio_codecs/opus/audio_encoder_opus.h"
#include "modules/audio_coding/acm2/acm_receive_test.h"
@ -1522,20 +1523,31 @@ TEST_F(AcmSenderBitExactnessNewApi, DISABLED_OpusManyChannels) {
// TODO(webrtc:8649): change to higher level
// AudioEncoderOpus::MakeAudioEncoder once a multistream encoder can be set up
// from SDP.
// from SDP. - This is now done for the Decoder.
// The Encoder and Decoder are set up differently (and the test is disabled)
// until the changes from
// https://webrtc-review.googlesource.com/c/src/+/121764 land.
AudioEncoderOpusConfig config = *AudioEncoderOpus::SdpToConfig(
SdpAudioFormat("opus", 48000, 2, {{"stereo", "1"}}));
config.num_channels = kNumChannels;
config.bitrate_bps = kBitrateBps;
const auto sdp_format = SdpAudioFormat(
"multiopus", 48000, kNumChannels,
{{"channel_mapping", "0,1,2,3"}, {"coupled_streams", "2"}});
const auto decoder_config =
AudioDecoderMultiChannelOpus::SdpToConfig(sdp_format);
const auto opus_decoder =
AudioDecoderMultiChannelOpus::MakeAudioDecoder(*decoder_config);
ASSERT_NO_FATAL_FAILURE(SetUpTestExternalEncoder(
absl::make_unique<AudioEncoderOpusImpl>(config, kOpusPayloadType),
kOpusPayloadType));
AudioDecoderOpusImpl opus_decoder(kNumChannels);
rtc::scoped_refptr<AudioDecoderFactory> decoder_factory =
new rtc::RefCountedObject<test::AudioDecoderProxyFactory>(&opus_decoder);
new rtc::RefCountedObject<test::AudioDecoderProxyFactory>(
opus_decoder.get());
// Set up an EXTERNAL DECODER to parse 4 channels.
Run(AcmReceiverBitExactnessOldApi::PlatformChecksum( // audio checksum