Attempt to recycle a stopped data m-line before creating a new one
which avoids an infinitely growing SDP if the remote end rejects
the datachannel section. This will reactivate the m-line even if
all datachannels are closed.
BUG=chromium:1442604
Change-Id: If60f93b406271163df692d96102baab701923602
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/304241
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@microsoft.com>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40029}
diff --git a/pc/peer_connection.cc b/pc/peer_connection.cc
index 0956d75..3f99c96 100644
--- a/pc/peer_connection.cc
+++ b/pc/peer_connection.cc
@@ -1420,9 +1420,10 @@
rtc::scoped_refptr<DataChannelInterface> channel = ret.MoveValue();
- // Trigger the onRenegotiationNeeded event for
- // the first SCTP DataChannel.
- if (first_datachannel) {
+ // Check the onRenegotiationNeeded event (with plan-b backward compat)
+ if (configuration_.sdp_semantics == SdpSemantics::kUnifiedPlan ||
+ (configuration_.sdp_semantics == SdpSemantics::kPlanB_DEPRECATED &&
+ first_datachannel)) {
sdp_handler_->UpdateNegotiationNeeded();
}
NoteUsageEvent(UsageEvent::DATA_ADDED);