AudioCodingModule: Specify decoders using SdpAudioFormat

NetEq already uses SdpAudioFormat internally; this CL adds an
AudioCodingModule::RegisterReceiveCodec overload that accepts
SdpAudioFormat, and propagates it through AcmReceiver into NetEq.

The intention is to get rid of the other ways to specify decoders and
always use SdpAudioFormat. (And eventually to do the same for encoders
too.)

NOTRY=true
BUG=5801

Review-Url: https://codereview.webrtc.org/2365653004
Cr-Commit-Position: refs/heads/master@{#14506}
This commit is contained in:
kwiberg
2016-10-04 09:33:27 -07:00
committed by Commit bot
parent 3168781d2f
commit 5adaf735dc
16 changed files with 286 additions and 123 deletions

View File

@ -121,6 +121,9 @@ class AudioCodingModuleImpl final : public AudioCodingModule {
// Get current playout frequency.
int PlayoutFrequency() const override;
bool RegisterReceiveCodec(int rtp_payload_type,
const SdpAudioFormat& audio_format) override;
int RegisterReceiveCodec(const CodecInst& receive_codec) override;
int RegisterReceiveCodec(
const CodecInst& receive_codec,
@ -987,6 +990,21 @@ int AudioCodingModuleImpl::PlayoutFrequency() const {
return receiver_.last_output_sample_rate_hz();
}
bool AudioCodingModuleImpl::RegisterReceiveCodec(
int rtp_payload_type,
const SdpAudioFormat& audio_format) {
rtc::CritScope lock(&acm_crit_sect_);
RTC_DCHECK(receiver_initialized_);
if (!acm2::RentACodec::IsPayloadTypeValid(rtp_payload_type)) {
LOG_F(LS_ERROR) << "Invalid payload-type " << rtp_payload_type
<< " for decoder.";
return false;
}
return receiver_.AddCodec(rtp_payload_type, audio_format);
}
int AudioCodingModuleImpl::RegisterReceiveCodec(const CodecInst& codec) {
rtc::CritScope lock(&acm_crit_sect_);
auto* ef = encoder_factory_.get();