Reland of Opus multistream.

This is a reland of
https://webrtc-review.googlesource.com/c/src/+/111750.

This time we don't use the multistream decoder unless we have to.
(Which is when #channels >2). Pros: don't make downstream projects
crash due to used up stack space, a few % more efficiency for the
typical case (because multistream adds some overhead). Cons: Messy
C-code with "union" types and #define MACROs, probably more
maintenance.

Bug: webrtc:8649
Change-Id: I4253a5e0c382f67ac7c6731dc6602a31e6779e63
Reviewed-on: https://webrtc-review.googlesource.com/c/120049
Commit-Queue: Alex Loiko <aleloi@webrtc.org>
Reviewed-by: Minyue Li <minyue@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26445}
This commit is contained in:
Alex Loiko
2019-01-29 12:27:08 +01:00
committed by Commit Bot
parent e5ccf5fe5b
commit 7a3e43a5d7
7 changed files with 268 additions and 59 deletions

View File

@ -72,7 +72,8 @@ class OpusFrame : public AudioDecoder::EncodedAudioFrame {
AudioDecoderOpusImpl::AudioDecoderOpusImpl(size_t num_channels)
: channels_(num_channels) {
RTC_DCHECK(num_channels == 1 || num_channels == 2);
WebRtcOpus_DecoderCreate(&dec_state_, channels_);
const int error = WebRtcOpus_DecoderCreate(&dec_state_, channels_);
RTC_DCHECK(error == 0);
WebRtcOpus_DecoderInit(dec_state_);
}