Support "UDP/DTLS/SCTP" and "TCP/DTLS/SCTP" profile strings.
This CL doesn't yet offer these protos; it just accepts them if they're
seen in a remote offer. It also doesn't verify that the ICE candidate
protocol matches the m= section protocol (UDP vs. TCP), since we don't
do this elsewhere and don't really have a reason to care.
This CL also adds an integration test that receives a spec-compliant
SCTP offer and attempts to send data bidirectionally.
BUG=webrtc:7706
Review-Url: https://codereview.webrtc.org/2902213002
Cr-Commit-Position: refs/heads/master@{#18265}
diff --git a/webrtc/pc/peerconnection_integrationtest.cc b/webrtc/pc/peerconnection_integrationtest.cc
index e6c3cf1..12b99b4 100644
--- a/webrtc/pc/peerconnection_integrationtest.cc
+++ b/webrtc/pc/peerconnection_integrationtest.cc
@@ -2482,6 +2482,40 @@
kMaxWaitForFramesMs);
}
+static void MakeSpecCompliantSctpOffer(cricket::SessionDescription* desc) {
+ const ContentInfo* dc_offer = GetFirstDataContent(desc);
+ ASSERT_NE(nullptr, dc_offer);
+ cricket::DataContentDescription* dcd_offer =
+ static_cast<cricket::DataContentDescription*>(dc_offer->description);
+ dcd_offer->set_use_sctpmap(false);
+ dcd_offer->set_protocol("UDP/DTLS/SCTP");
+}
+
+// Test that the data channel works when a spec-compliant SCTP m= section is
+// offered (using "a=sctp-port" instead of "a=sctpmap", and using
+// "UDP/DTLS/SCTP" as the protocol).
+TEST_F(PeerConnectionIntegrationTest,
+ DataChannelWorksWhenSpecCompliantSctpOfferReceived) {
+ ASSERT_TRUE(CreatePeerConnectionWrappers());
+ ConnectFakeSignaling();
+ caller()->CreateDataChannel();
+ caller()->SetGeneratedSdpMunger(MakeSpecCompliantSctpOffer);
+ caller()->CreateAndSetAndSignalOffer();
+ ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
+ ASSERT_TRUE_WAIT(callee()->data_channel() != nullptr, kDefaultTimeout);
+ EXPECT_TRUE_WAIT(caller()->data_observer()->IsOpen(), kDefaultTimeout);
+ EXPECT_TRUE_WAIT(callee()->data_observer()->IsOpen(), kDefaultTimeout);
+
+ // Ensure data can be sent in both directions.
+ std::string data = "hello world";
+ caller()->data_channel()->Send(DataBuffer(data));
+ EXPECT_EQ_WAIT(data, callee()->data_observer()->last_message(),
+ kDefaultTimeout);
+ callee()->data_channel()->Send(DataBuffer(data));
+ EXPECT_EQ_WAIT(data, caller()->data_observer()->last_message(),
+ kDefaultTimeout);
+}
+
#endif // HAVE_SCTP
// Test that the ICE connection and gathering states eventually reach