AudioCodingModule: Remove support for creating encoders

After this CL, all audio encoders have to be injected by the caller.
This means that there is no special "built-in" set of codecs, and
users won't have to pay the binary size and security costs of codecs
they aren't using.

Bug: webrtc:8396
Change-Id: Idb0959ce395940c8bb3bbb49256cdcd84fc87bb6
Reviewed-on: https://webrtc-review.googlesource.com/c/103821
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25600}
This commit is contained in:
Karl Wiberg
2018-11-12 14:21:58 +01:00
committed by Commit Bot
parent 80c6762a37
commit 49c33ce528
9 changed files with 75 additions and 1402 deletions

View File

@ -154,40 +154,6 @@ class AudioCodingModule {
// Sender
//
///////////////////////////////////////////////////////////////////////////
// int32_t RegisterSendCodec()
// Registers a codec, specified by |send_codec|, as sending codec.
// This API can be called multiple of times to register Codec. The last codec
// registered overwrites the previous ones.
// The API can also be used to change payload type for CNG and RED, which are
// registered by default to default payload types.
// Note that registering CNG and RED won't overwrite speech codecs.
// This API can be called to set/change the send payload-type, frame-size
// or encoding rate (if applicable for the codec).
//
// Note: If a stereo codec is registered as send codec, VAD/DTX will
// automatically be turned off, since it is not supported for stereo sending.
//
// Note: If a secondary encoder is already registered, and the new send-codec
// has a sampling rate that does not match the secondary encoder, the
// secondary encoder will be unregistered.
//
// Input:
// -send_codec : Parameters of the codec to be registered, c.f.
// common_types.h for the definition of
// CodecInst.
//
// Return value:
// -1 if failed to initialize,
// 0 if succeeded.
//
virtual int32_t RegisterSendCodec(const CodecInst& send_codec) = 0;
// Registers |external_speech_encoder| as encoder. The new encoder will
// replace any previously registered speech encoder (internal or external).
virtual void RegisterExternalSendCodec(
AudioEncoder* external_speech_encoder) = 0;
// |modifier| is called exactly once with one argument: a pointer to the
// unique_ptr that holds the current encoder (which is null if there is no
// current encoder). For the duration of the call, |modifier| has exclusive
@ -257,71 +223,6 @@ class AudioCodingModule {
//
virtual int32_t Add10MsData(const AudioFrame& audio_frame) = 0;
///////////////////////////////////////////////////////////////////////////
// (RED) Redundant Coding
//
///////////////////////////////////////////////////////////////////////////
// int32_t SetREDStatus()
// configure RED status i.e. on/off.
//
// RFC 2198 describes a solution which has a single payload type which
// signifies a packet with redundancy. That packet then becomes a container,
// encapsulating multiple payloads into a single RTP packet.
// Such a scheme is flexible, since any amount of redundancy may be
// encapsulated within a single packet. There is, however, a small overhead
// since each encapsulated payload must be preceded by a header indicating
// the type of data enclosed.
//
// Input:
// -enable_red : if true RED is enabled, otherwise RED is
// disabled.
//
// Return value:
// -1 if failed to set RED status,
// 0 if succeeded.
//
virtual int32_t SetREDStatus(bool enable_red) = 0;
///////////////////////////////////////////////////////////////////////////
// bool REDStatus()
// Get RED status
//
// Return value:
// true if RED is enabled,
// false if RED is disabled.
//
virtual bool REDStatus() const = 0;
///////////////////////////////////////////////////////////////////////////
// (FEC) Forward Error Correction (codec internal)
//
///////////////////////////////////////////////////////////////////////////
// int32_t SetCodecFEC()
// Configures codec internal FEC status i.e. on/off. No effects on codecs that
// do not provide internal FEC.
//
// Input:
// -enable_fec : if true FEC will be enabled otherwise the FEC is
// disabled.
//
// Return value:
// -1 if failed, or the codec does not support FEC
// 0 if succeeded.
//
virtual int SetCodecFEC(bool enable_codec_fec) = 0;
///////////////////////////////////////////////////////////////////////////
// bool CodecFEC()
// Gets status of codec internal FEC.
//
// Return value:
// true if FEC is enabled,
// false if FEC is disabled.
//
virtual bool CodecFEC() const = 0;
///////////////////////////////////////////////////////////////////////////
// int SetPacketLossRate()
// Sets expected packet loss rate for encoding. Some encoders provide packet
@ -343,55 +244,6 @@ class AudioCodingModule {
// (VAD) Voice Activity Detection
//
///////////////////////////////////////////////////////////////////////////
// int32_t SetVAD()
// If DTX is enabled & the codec does not have internal DTX/VAD
// WebRtc VAD will be automatically enabled and |enable_vad| is ignored.
//
// If DTX is disabled but VAD is enabled no DTX packets are send,
// regardless of whether the codec has internal DTX/VAD or not. In this
// case, WebRtc VAD is running to label frames as active/in-active.
//
// NOTE! VAD/DTX is not supported when sending stereo.
//
// Inputs:
// -enable_dtx : if true DTX is enabled,
// otherwise DTX is disabled.
// -enable_vad : if true VAD is enabled,
// otherwise VAD is disabled.
// -vad_mode : determines the aggressiveness of VAD. A more
// aggressive mode results in more frames labeled
// as in-active, c.f. definition of
// ACMVADMode in audio_coding_module_typedefs.h
// for valid values.
//
// Return value:
// -1 if failed to set up VAD/DTX,
// 0 if succeeded.
//
virtual int32_t SetVAD(const bool enable_dtx = true,
const bool enable_vad = false,
const ACMVADMode vad_mode = VADNormal) = 0;
///////////////////////////////////////////////////////////////////////////
// int32_t VAD()
// Get VAD status.
//
// Outputs:
// -dtx_enabled : is set to true if DTX is enabled, otherwise
// is set to false.
// -vad_enabled : is set to true if VAD is enabled, otherwise
// is set to false.
// -vad_mode : is set to the current aggressiveness of VAD.
//
// Return value:
// -1 if fails to retrieve the setting of DTX/VAD,
// 0 if succeeded.
//
virtual int32_t VAD(bool* dtx_enabled,
bool* vad_enabled,
ACMVADMode* vad_mode) const = 0;
///////////////////////////////////////////////////////////////////////////
// int32_t RegisterVADCallback()
// Call this method to register a callback function which is called
@ -455,29 +307,6 @@ class AudioCodingModule {
virtual bool RegisterReceiveCodec(int rtp_payload_type,
const SdpAudioFormat& audio_format) = 0;
///////////////////////////////////////////////////////////////////////////
// int32_t RegisterReceiveCodec()
// Register possible decoders, can be called multiple times for
// codecs, CNG-NB, CNG-WB, CNG-SWB, AVT and RED.
//
// Input:
// -receive_codec : parameters of the codec to be registered, c.f.
// common_types.h for the definition of
// CodecInst.
//
// Return value:
// -1 if failed to register the codec
// 0 if the codec registered successfully.
//
virtual int RegisterReceiveCodec(const CodecInst& receive_codec) = 0;
// Register a decoder; call repeatedly to register multiple decoders. |df| is
// a decoder factory that returns an iSAC decoder; it will be called once if
// the decoder being registered is iSAC.
virtual int RegisterReceiveCodec(
const CodecInst& receive_codec,
rtc::FunctionView<std::unique_ptr<AudioDecoder>()> isac_factory) = 0;
// Registers an external decoder. The name is only used to provide information
// back to the caller about the decoder. Hence, the name is arbitrary, and may
// be empty.