Cleanup: Replacing set extension status bool with CHECK.

This was just checked in all places were it was used, moving the check
into RtpRtcp reduces the boiler plate required at the call sites.

Also changing to always register and unregister extensions by URI to
synchronize the code in AudioSendStream with the code in RtpVideoSender.

This prepares for reducing the scope of ChannelSend.

Bug: webrtc:9883
Change-Id: Ia64d79f20eb98f46cbbbe8318770e4fcf9caa1ec
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/155620
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29490}
diff --git a/audio/channel_send.cc b/audio/channel_send.cc
index f803bf9..569615b 100644
--- a/audio/channel_send.cc
+++ b/audio/channel_send.cc
@@ -189,7 +189,7 @@
   void OnUplinkPacketLossRate(float packet_loss_rate);
   bool InputMute() const;
 
-  int SetSendRtpHeaderExtension(bool enable, RTPExtensionType type, int id);
+  void SetSendRtpHeaderExtension(bool enable, absl::string_view uri, int id);
 
   int32_t SendRtpAudio(AudioFrameType frameType,
                        uint8_t payloadType,
@@ -894,22 +894,18 @@
                          int repaired_extension_id) {
   RTC_DCHECK_RUN_ON(&worker_thread_checker_);
   if (extension_id != 0) {
-    int ret = SetSendRtpHeaderExtension(!rid.empty(), kRtpExtensionRtpStreamId,
-                                        extension_id);
-    RTC_DCHECK_EQ(0, ret);
+    SetSendRtpHeaderExtension(!rid.empty(), RtpStreamId::kUri, extension_id);
   }
   if (repaired_extension_id != 0) {
-    int ret = SetSendRtpHeaderExtension(!rid.empty(), kRtpExtensionRtpStreamId,
-                                        repaired_extension_id);
-    RTC_DCHECK_EQ(0, ret);
+    SetSendRtpHeaderExtension(!rid.empty(), RtpStreamId::kUri,
+                              repaired_extension_id);
   }
   _rtpRtcpModule->SetRid(rid);
 }
 
 void ChannelSend::SetMid(const std::string& mid, int extension_id) {
   RTC_DCHECK_RUN_ON(&worker_thread_checker_);
-  int ret = SetSendRtpHeaderExtension(true, kRtpExtensionMid, extension_id);
-  RTC_DCHECK_EQ(0, ret);
+  SetSendRtpHeaderExtension(true, RtpMid::kUri, extension_id);
   _rtpRtcpModule->SetMid(mid);
 }
 
@@ -921,15 +917,12 @@
 void ChannelSend::SetSendAudioLevelIndicationStatus(bool enable, int id) {
   RTC_DCHECK_RUN_ON(&worker_thread_checker_);
   _includeAudioLevelIndication = enable;
-  int ret = SetSendRtpHeaderExtension(enable, kRtpExtensionAudioLevel, id);
-  RTC_DCHECK_EQ(0, ret);
+  SetSendRtpHeaderExtension(enable, AudioLevel::kUri, id);
 }
 
 void ChannelSend::EnableSendTransportSequenceNumber(int id) {
   RTC_DCHECK_RUN_ON(&worker_thread_checker_);
-  int ret =
-      SetSendRtpHeaderExtension(true, kRtpExtensionTransportSequenceNumber, id);
-  RTC_DCHECK_EQ(0, ret);
+  SetSendRtpHeaderExtension(true, TransportSequenceNumber::kUri, id);
 }
 
 void ChannelSend::RegisterSenderCongestionControlObjects(
@@ -1093,18 +1086,13 @@
   return _rtpRtcpModule.get();
 }
 
-int ChannelSend::SetSendRtpHeaderExtension(bool enable,
-                                           RTPExtensionType type,
-                                           int id) {
-  int error = 0;
-  _rtpRtcpModule->DeregisterSendRtpHeaderExtension(type);
+void ChannelSend::SetSendRtpHeaderExtension(bool enable,
+                                            absl::string_view uri,
+                                            int id) {
+  _rtpRtcpModule->DeregisterSendRtpHeaderExtension(uri);
   if (enable) {
-    // TODO(nisse): RtpRtcp::RegisterSendRtpHeaderExtension to take an int
-    // argument. Currently it wants an uint8_t.
-    error = _rtpRtcpModule->RegisterSendRtpHeaderExtension(
-        type, rtc::dchecked_cast<uint8_t>(id));
+    _rtpRtcpModule->RegisterRtpHeaderExtension(uri, id);
   }
-  return error;
 }
 
 int64_t ChannelSend::GetRTT() const {