diff --git a/api/neteq/neteq.h b/api/neteq/neteq.h index 9e71afcc86..f9ee3b60cf 100644 --- a/api/neteq/neteq.h +++ b/api/neteq/neteq.h @@ -298,8 +298,11 @@ class NetEq { // Returns the decoder info for the given payload type. Returns empty if no // such payload type was registered. - virtual absl::optional GetDecoderFormat( - int payload_type) const = 0; + [[deprecated( + "Use GetCurrentDecoderFormat")]] virtual absl::optional + GetDecoderFormat(int payload_type) const { + return absl::nullopt; + } // Returns info for the most recently used decoder. virtual absl::optional GetCurrentDecoderFormat() const { diff --git a/modules/audio_coding/neteq/neteq_impl.cc b/modules/audio_coding/neteq/neteq_impl.cc index 7ef4832cca..a93954f4d9 100644 --- a/modules/audio_coding/neteq/neteq_impl.cc +++ b/modules/audio_coding/neteq/neteq_impl.cc @@ -374,37 +374,22 @@ int NetEqImpl::last_output_sample_rate_hz() const { return last_output_sample_rate_hz_; } -absl::optional NetEqImpl::GetDecoderFormat( - int payload_type) const { - MutexLock lock(&mutex_); - return GetDecoderFormatInternal(payload_type); -} - -absl::optional NetEqImpl::GetDecoderFormatInternal( - int payload_type) const { - const DecoderDatabase::DecoderInfo* const di = - decoder_database_->GetDecoderInfo(payload_type); - if (di == nullptr) { - // Payload type not registered. - return absl::nullopt; - } - const AudioDecoder* const decoder = di->GetDecoder(); - // TODO(kwiberg): Why the special case for RED? - return DecoderFormat{ - /*payload_type=*/payload_type, - /*sample_rate_hz=*/di->IsRed() ? 8000 : di->SampleRateHz(), - /*num_channels=*/ - decoder ? rtc::dchecked_cast(decoder->Channels()) : 1, - /*sdp_format=*/di->GetFormat()}; -} - absl::optional NetEqImpl::GetCurrentDecoderFormat() const { MutexLock lock(&mutex_); if (!current_rtp_payload_type_.has_value()) { return absl::nullopt; } - return GetDecoderFormatInternal(*current_rtp_payload_type_); + const DecoderDatabase::DecoderInfo* di = + decoder_database_->GetDecoderInfo(*current_rtp_payload_type_); + if (di == nullptr) { + return absl::nullopt; + } + return DecoderFormat{ + /*payload_type=*/*current_rtp_payload_type_, + /*sample_rate_hz=*/di->SampleRateHz(), + /*num_channels=*/rtc::dchecked_cast(di->GetDecoder()->Channels()), + /*sdp_format=*/di->GetFormat()}; } void NetEqImpl::FlushBuffers() { diff --git a/modules/audio_coding/neteq/neteq_impl.h b/modules/audio_coding/neteq/neteq_impl.h index 1b2e12d6c6..0ce80b7386 100644 --- a/modules/audio_coding/neteq/neteq_impl.h +++ b/modules/audio_coding/neteq/neteq_impl.h @@ -177,9 +177,6 @@ class NetEqImpl : public webrtc::NetEq { int last_output_sample_rate_hz() const override; - absl::optional GetDecoderFormat( - int payload_type) const override; - absl::optional GetCurrentDecoderFormat() const override; // Flushes both the packet buffer and the sync buffer. @@ -342,9 +339,6 @@ class NetEqImpl : public webrtc::NetEq { NetEqController::PacketArrivedInfo ToPacketArrivedInfo( const Packet& packet) const RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_); - absl::optional GetDecoderFormatInternal(int payload_type) const - RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_); - const Environment env_; mutable Mutex mutex_;