Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(349)

Unified Diff: webrtc/modules/audio_coding/acm2/acm_receiver.cc

Issue 2365653004: AudioCodingModule: Specify decoders using SdpAudioFormat (Closed)
Patch Set: rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_coding/acm2/acm_receiver.cc
diff --git a/webrtc/modules/audio_coding/acm2/acm_receiver.cc b/webrtc/modules/audio_coding/acm2/acm_receiver.cc
index 89eee00fc37edc10d715f1720ff193688d863b8d..0b19310b84d8fe80f12084c13cf4f0403737c75c 100644
--- a/webrtc/modules/audio_coding/acm2/acm_receiver.cc
+++ b/webrtc/modules/audio_coding/acm2/acm_receiver.cc
@@ -230,6 +230,31 @@ int32_t AcmReceiver::AddCodec(int acm_codec_id,
return 0;
}
+bool AcmReceiver::AddCodec(int rtp_payload_type,
+ const SdpAudioFormat& audio_format) {
+ const auto old_format = neteq_->GetDecoderFormat(rtp_payload_type);
+ if (old_format && *old_format == audio_format) {
+ // Re-registering the same codec. Do nothing and return.
+ return true;
+ }
+
+ if (neteq_->RemovePayloadType(rtp_payload_type) != NetEq::kOK &&
+ neteq_->LastError() != NetEq::kDecoderNotFound) {
+ LOG(LERROR) << "AcmReceiver::AddCodec: Could not remove existing decoder"
+ " for payload type "
+ << rtp_payload_type;
+ return false;
+ }
+
+ const bool success =
+ neteq_->RegisterPayloadType(rtp_payload_type, audio_format);
+ if (!success) {
+ LOG(LERROR) << "AcmReceiver::AddCodec failed for payload type "
+ << rtp_payload_type << ", decoder format " << audio_format;
+ }
+ return success;
+}
+
void AcmReceiver::FlushBuffers() {
neteq_->FlushBuffers();
}

Powered by Google App Engine
This is Rietveld 408576698