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}
diff --git a/webrtc/modules/audio_coding/neteq/neteq_impl.cc b/webrtc/modules/audio_coding/neteq/neteq_impl.cc
index e21294a..b60f1b8 100644
--- a/webrtc/modules/audio_coding/neteq/neteq_impl.cc
+++ b/webrtc/modules/audio_coding/neteq/neteq_impl.cc
@@ -279,6 +279,35 @@
   return kOK;
 }
 
+bool NetEqImpl::RegisterPayloadType(int rtp_payload_type,
+                                    const SdpAudioFormat& audio_format) {
+  LOG(LS_VERBOSE) << "NetEqImpl::RegisterPayloadType: payload type "
+                  << rtp_payload_type << ", codec " << audio_format;
+  rtc::CritScope lock(&crit_sect_);
+  switch (decoder_database_->RegisterPayload(rtp_payload_type, audio_format)) {
+    case DecoderDatabase::kOK:
+      return true;
+    case DecoderDatabase::kInvalidRtpPayloadType:
+      error_code_ = kInvalidRtpPayloadType;
+      return false;
+    case DecoderDatabase::kCodecNotSupported:
+      error_code_ = kCodecNotSupported;
+      return false;
+    case DecoderDatabase::kDecoderExists:
+      error_code_ = kDecoderExists;
+      return false;
+    case DecoderDatabase::kInvalidSampleRate:
+      error_code_ = kInvalidSampleRate;
+      return false;
+    case DecoderDatabase::kInvalidPointer:
+      error_code_ = kInvalidPointer;
+      return false;
+    default:
+      error_code_ = kOtherError;
+      return false;
+  }
+}
+
 int NetEqImpl::RemovePayloadType(uint8_t rtp_payload_type) {
   rtc::CritScope lock(&crit_sect_);
   int ret = decoder_database_->Remove(rtp_payload_type);