Deprecate NetEq::GetDecoderFormat and remove implementation.

Bug: None
Change-Id: I9c90b41ee528984d1a3cd1632565c6dc1598e4d5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/360920
Reviewed-by: Tomas Lundqvist <tomasl@google.com>
Commit-Queue: Jakob Ivarsson‎ <jakobi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42881}
This commit is contained in:
Jakob Ivarsson 2024-08-29 08:07:19 +00:00 committed by WebRTC LUCI CQ
parent a99bf7fa84
commit 04cc4ce2f2
3 changed files with 15 additions and 33 deletions

View File

@ -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<DecoderFormat> GetDecoderFormat(
int payload_type) const = 0;
[[deprecated(
"Use GetCurrentDecoderFormat")]] virtual absl::optional<DecoderFormat>
GetDecoderFormat(int payload_type) const {
return absl::nullopt;
}
// Returns info for the most recently used decoder.
virtual absl::optional<DecoderFormat> GetCurrentDecoderFormat() const {

View File

@ -374,37 +374,22 @@ int NetEqImpl::last_output_sample_rate_hz() const {
return last_output_sample_rate_hz_;
}
absl::optional<NetEq::DecoderFormat> NetEqImpl::GetDecoderFormat(
int payload_type) const {
MutexLock lock(&mutex_);
return GetDecoderFormatInternal(payload_type);
}
absl::optional<NetEq::DecoderFormat> 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<int>(decoder->Channels()) : 1,
/*sdp_format=*/di->GetFormat()};
}
absl::optional<NetEq::DecoderFormat> 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<int>(di->GetDecoder()->Channels()),
/*sdp_format=*/di->GetFormat()};
}
void NetEqImpl::FlushBuffers() {

View File

@ -177,9 +177,6 @@ class NetEqImpl : public webrtc::NetEq {
int last_output_sample_rate_hz() const override;
absl::optional<DecoderFormat> GetDecoderFormat(
int payload_type) const override;
absl::optional<DecoderFormat> 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<DecoderFormat> GetDecoderFormatInternal(int payload_type) const
RTC_EXCLUSIVE_LOCKS_REQUIRED(mutex_);
const Environment env_;
mutable Mutex mutex_;