Simulcast should be disabled if RID header extension is not supported.
Simulcast is disabled if the RIDs are not negotiated.
This change addresses the scenario in which RIDs are negotiated but
support for the RID extension is not negotiated.
In such cases, the RID extension cannot be used, so support for
simulcast should be turned off, as if RIDs were not negotiated.
A similar case can be made for MIDs, however MIDs are not explicitly
specified in simulcast. RIDs are only guaranteed to be unique within
a media section so it would seem that MIDs should be required.
However, applications supply RID values and can guarantee their
uniqueness, so unlike RIDs, the use of MIDs is not enforced as mandatory.
Bug: webrtc:10075
Change-Id: Ic1b27878ea152eaee43a38bbfda11144307766fe
Reviewed-on: https://webrtc-review.googlesource.com/c/125176
Commit-Queue: Amit Hilbuch <amithi@webrtc.org>
Reviewed-by: Seth Hampson <shampson@webrtc.org>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26934}
diff --git a/pc/peer_connection.cc b/pc/peer_connection.cc
index 9c4461d..6a5f925 100644
--- a/pc/peer_connection.cc
+++ b/pc/peer_connection.cc
@@ -3060,6 +3060,18 @@
return result;
}
+static bool SimulcastIsRejected(
+ const ContentInfo* local_content,
+ const MediaContentDescription& answer_media_desc) {
+ bool simulcast_offered = local_content &&
+ local_content->media_description() &&
+ local_content->media_description()->HasSimulcast();
+ bool simulcast_answered = answer_media_desc.HasSimulcast();
+ bool rids_supported = RtpExtension::FindHeaderExtensionByUri(
+ answer_media_desc.rtp_header_extensions(), RtpExtension::kRidUri);
+ return simulcast_offered && (!simulcast_answered || !rids_supported);
+}
+
static RTCError DisableSimulcastInSender(
rtc::scoped_refptr<RtpSenderInternal> sender) {
RTC_DCHECK(sender);
@@ -3155,12 +3167,7 @@
// Check if the offer indicated simulcast but the answer rejected it.
// This can happen when simulcast is not supported on the remote party.
- // This check can be simplified to comparing the number of send encodings,
- // but that might break legacy implementation in which simulcast is not
- // signaled in the remote description.
- if (old_local_content && old_local_content->media_description() &&
- old_local_content->media_description()->HasSimulcast() &&
- !media_desc->HasSimulcast()) {
+ if (SimulcastIsRejected(old_local_content, *media_desc)) {
RTCError error =
DisableSimulcastInSender(transceiver->internal()->sender_internal());
if (!error.ok()) {