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}
diff --git a/modules/audio_coding/codecs/opus/opus_inst.h b/modules/audio_coding/codecs/opus/opus_inst.h
index 2473a5c..0b31181 100644
--- a/modules/audio_coding/codecs/opus/opus_inst.h
+++ b/modules/audio_coding/codecs/opus/opus_inst.h
@@ -17,16 +17,23 @@
RTC_PUSH_IGNORING_WUNDEF()
#include "opus.h"
+#include "opus_multistream.h"
RTC_POP_IGNORING_WUNDEF()
struct WebRtcOpusEncInst {
- OpusEncoder* encoder;
+ union {
+ OpusEncoder* encoder;
+ OpusMSEncoder* multistream_encoder;
+ } encoder;
size_t channels;
int in_dtx_mode;
};
struct WebRtcOpusDecInst {
- OpusDecoder* decoder;
+ union {
+ OpusDecoder* decoder;
+ OpusMSDecoder* multistream_decoder;
+ } decoder;
int prev_decoded_samples;
size_t channels;
int in_dtx_mode;