iSAC: Make separate AudioEncoder and AudioDecoder objects

The only shared state is now the bandwidth estimation info.
This reduces the amount and complexity of the locking
substantially.

Review URL: https://codereview.webrtc.org/1208993010

Cr-Commit-Position: refs/heads/master@{#9762}
This commit is contained in:
kwiberg
2015-08-24 02:03:23 -07:00
committed by Commit bot
parent 2159b89fa2
commit 608c3cfe77
20 changed files with 367 additions and 510 deletions

View File

@ -53,21 +53,17 @@ class CodecOwner {
const AudioEncoderMutable* SpeechEncoder() const;
private:
// There are three main cases for the state of the encoder members below:
// 1. An external encoder is used. |external_speech_encoder_| points to it.
// |speech_encoder_| is null, and |isac_is_encoder_| is false.
// 2. The internal iSAC codec is used as encoder. |isac_codec_| points to it
// and |isac_is_encoder_| is true. |external_speech_encoder_| and
// |speech_encoder_| are null.
// 3. Another internal encoder is used. |speech_encoder_| points to it.
// |external_speech_encoder_| is null, and |isac_is_encoder_| is false.
// In addition to case 2, |isac_codec_| is valid when GetIsacDecoder has been
// called.
// At most one of these is non-null:
rtc::scoped_ptr<AudioEncoderMutable> speech_encoder_;
rtc::scoped_ptr<AudioEncoderDecoderMutableIsac> isac_codec_;
bool isac_is_encoder_;
AudioEncoderMutable* external_speech_encoder_;
// If we've created an iSAC decoder because someone called GetIsacDecoder,
// store it here.
rtc::scoped_ptr<AudioDecoder> isac_decoder_;
// iSAC bandwidth estimation info, for use with iSAC encoders and decoders.
LockedIsacBandwidthInfo isac_bandwidth_info_;
// |cng_encoder_| and |red_encoder_| are valid iff CNG or RED, respectively,
// are active.
rtc::scoped_ptr<AudioEncoder> cng_encoder_;