Reland "Adding a restriction for legal RID values."

This is a reland of 07f3279a730980583403b78c3762c5d246d1d9be

Original change's description:
> Adding a restriction for legal RID values.
>
> According to the spec, RID values should be constrained to only
> alpha-numeric values. This was not enforced in our implementation to
> allow for more flexibility.
> It has been brought to our attention that some values that we currently
> consider legal (such as the '~', '=' ';' characters) might cause confusion
> with the simulcast syntax that uses these characters to indicate other
> meanings.
> What's worse, is that some characters, when used in RIDs (such as
> \u{1f937} \u{1f4a9} and \u{1f926}) cause uncontrollable laughter for some
> users which might also be a health hazard.
> This change resolves these issues by restricting RIDs to alpha-numeric.
>
> Bug: webrtc:10491
> Change-Id: I16e262c87525d0289764beacd098e1525a355463
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/132061
> Reviewed-by: Steve Anton <steveanton@webrtc.org>
> Commit-Queue: Amit Hilbuch <amithi@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#27499}

TBR=steveanton@webrtc.org

Bug: webrtc:10491
Change-Id: I856581306a9258480ee9184f12b55c2a23dd8636
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/131983
Commit-Queue: Amit Hilbuch <amithi@webrtc.org>
Reviewed-by: Amit Hilbuch <amithi@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27530}
diff --git a/pc/peer_connection.cc b/pc/peer_connection.cc
index acf5e72..e7a1a11 100644
--- a/pc/peer_connection.cc
+++ b/pc/peer_connection.cc
@@ -24,11 +24,14 @@
 #include "api/jsep_session_description.h"
 #include "api/media_stream_proxy.h"
 #include "api/media_stream_track_proxy.h"
+#include "api/rtc_error.h"
+#include "api/rtp_parameters.h"
 #include "api/uma_metrics.h"
 #include "call/call.h"
 #include "logging/rtc_event_log/ice_logger.h"
 #include "logging/rtc_event_log/output/rtc_event_log_output_file.h"
 #include "logging/rtc_event_log/rtc_event_log.h"
+#include "media/base/rid_description.h"
 #include "media/sctp/sctp_transport.h"
 #include "pc/audio_rtp_receiver.h"
 #include "pc/audio_track.h"
@@ -1547,6 +1550,14 @@
         "RIDs must be provided for either all or none of the send encodings.");
   }
 
+  if (num_rids > 0 && absl::c_any_of(init.send_encodings,
+                                     [](const RtpEncodingParameters& encoding) {
+                                       return !IsLegalRsidName(encoding.rid);
+                                     })) {
+    LOG_AND_RETURN_ERROR(RTCErrorType::INVALID_PARAMETER,
+                         "Invalid RID value provided.");
+  }
+
   if (absl::c_any_of(init.send_encodings,
                      [](const RtpEncodingParameters& encoding) {
                        return encoding.ssrc.has_value();