Remove CodecInst pt.2
The following APIs on AudioCodingModule are deprecated with this CL:
static int NumberOfCodecs();
static int Codec(int, CodecInst*);
static int Codec(const char*, CodecInst*, int, size_t);
static int Codec(const char*, int, size_t);
absl::optional<CodecInst> SendCodec() const;
bool RegisterReceiveCodec(int, const SdpAudioFormat&);
int RegisterExternalReceiveCodec(int, AudioDecoder*, int, int, const std::string&);
int UnregisterReceiveCodec(uint8_t);
int32_t ReceiveCodec(CodecInst*);
absl::optional<SdpAudioFormat> ReceiveFormat();
As well as this method on RtpRtcp module:
int32_t RegisterSendPayload(const CodecInst&);
Bug: webrtc:7626
Change-Id: I1230732136f1fe9048cf74afdeab767ca57ac9ce
Reviewed-on: https://webrtc-review.googlesource.com/c/113816
Commit-Queue: Fredrik Solenberg <solenberg@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26025}
diff --git a/modules/audio_coding/neteq/neteq_impl.cc b/modules/audio_coding/neteq/neteq_impl.cc
index 436e60a..d27d5d2 100644
--- a/modules/audio_coding/neteq/neteq_impl.cc
+++ b/modules/audio_coding/neteq/neteq_impl.cc
@@ -416,27 +416,6 @@
return last_output_sample_rate_hz_;
}
-absl::optional<CodecInst> NetEqImpl::GetDecoder(int payload_type) const {
- rtc::CritScope lock(&crit_sect_);
- const DecoderDatabase::DecoderInfo* di =
- decoder_database_->GetDecoderInfo(payload_type);
- if (!di) {
- return absl::nullopt;
- }
-
- // Create a CodecInst with some fields set. The remaining fields are zeroed,
- // but we tell MSan to consider them uninitialized.
- CodecInst ci = {0};
- rtc::MsanMarkUninitialized(rtc::MakeArrayView(&ci, 1));
- ci.pltype = payload_type;
- std::strncpy(ci.plname, di->get_name().c_str(), sizeof(ci.plname));
- ci.plname[sizeof(ci.plname) - 1] = '\0';
- ci.plfreq = di->IsRed() ? 8000 : di->SampleRateHz();
- AudioDecoder* const decoder = di->GetDecoder();
- ci.channels = decoder ? decoder->Channels() : 1;
- return ci;
-}
-
absl::optional<SdpAudioFormat> NetEqImpl::GetDecoderFormat(
int payload_type) const {
rtc::CritScope lock(&crit_sect_);
@@ -445,7 +424,13 @@
if (!di) {
return absl::nullopt; // Payload type not registered.
}
- return di->GetFormat();
+
+ SdpAudioFormat format = di->GetFormat();
+ // TODO(solenberg): This is legacy but messed up - mixing RTP rate and SR.
+ format.clockrate_hz = di->IsRed() ? 8000 : di->SampleRateHz();
+ const AudioDecoder* const decoder = di->GetDecoder();
+ format.num_channels = decoder ? decoder->Channels() : 1;
+ return format;
}
void NetEqImpl::FlushBuffers() {