Convert CNG into C++ and remove it from AudioDecoder

Broke out CNG from AudioDecoder as they didn't really share an interface.

Converted the CNG code to C++, to make initialization and resource handling easier. This includes several changes to the behavior, favoring RTC_CHECKs over returning error codes.

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

Cr-Commit-Position: refs/heads/master@{#12491}
This commit is contained in:
ossu
2016-04-25 07:55:58 -07:00
committed by Commit bot
parent f55f58d45d
commit 97ba30eedf
24 changed files with 744 additions and 1251 deletions

View File

@ -16,6 +16,7 @@
#include "webrtc/base/constructormagic.h"
#include "webrtc/common_types.h" // NULL
#include "webrtc/modules/audio_coding/codecs/cng/webrtc_cng.h"
#include "webrtc/modules/audio_coding/neteq/audio_decoder_impl.h"
#include "webrtc/modules/audio_coding/neteq/packet.h"
#include "webrtc/typedefs.h"
@ -142,7 +143,7 @@ class DecoderDatabase {
// Returns the current active comfort noise decoder, or NULL if no active
// comfort noise decoder exists.
virtual AudioDecoder* GetActiveCngDecoder();
virtual ComfortNoiseDecoder* GetActiveCngDecoder();
// Returns kOK if all packets in |packet_list| carry payload types that are
// registered in the database. Otherwise, returns kDecoderNotFound.
@ -152,8 +153,9 @@ class DecoderDatabase {
typedef std::map<uint8_t, DecoderInfo> DecoderMap;
DecoderMap decoders_;
int active_decoder_;
int active_cng_decoder_;
int active_decoder_type_;
int active_cng_decoder_type_;
std::unique_ptr<ComfortNoiseDecoder> active_cng_decoder_;
RTC_DISALLOW_COPY_AND_ASSIGN(DecoderDatabase);
};