Remove enable_rtp_data_channel

This denies the ability to request RTP data channels to callers.
Later CLs will rip out the actual code for creating these channels.

Bug: chromium:928706
Change-Id: Ibb54197f192f567984a348f1539c26be120903f0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/177901
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33740}
This commit is contained in:
Harald Alvestrand 2021-04-14 18:08:36 +00:00 committed by Commit Bot
parent fa8a9465d5
commit bc959b61b3
12 changed files with 6 additions and 513 deletions

View file

@ -404,12 +404,6 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
// from consideration for gathering ICE candidates. // from consideration for gathering ICE candidates.
bool disable_link_local_networks = false; bool disable_link_local_networks = false;
// If set to true, use RTP data channels instead of SCTP.
// TODO(deadbeef): Remove this. We no longer commit to supporting RTP data
// channels, though some applications are still working on moving off of
// them.
bool enable_rtp_data_channel = false;
// Minimum bitrate at which screencast video tracks will be encoded at. // Minimum bitrate at which screencast video tracks will be encoded at.
// This means adding padding bits up to this bitrate, which can help // This means adding padding bits up to this bitrate, which can help
// when switching from a static scene to one with motion. // when switching from a static scene to one with motion.

View file

@ -190,7 +190,6 @@ bool SimplePeerConnection::CreatePeerConnection(const char** turn_urls,
webrtc::PeerConnectionInterface::IceServer stun_server; webrtc::PeerConnectionInterface::IceServer stun_server;
stun_server.uri = GetPeerConnectionString(); stun_server.uri = GetPeerConnectionString();
config_.servers.push_back(stun_server); config_.servers.push_back(stun_server);
config_.enable_rtp_data_channel = true;
config_.enable_dtls_srtp = false; config_.enable_dtls_srtp = false;
peer_connection_ = g_peer_connection_factory->CreatePeerConnection( peer_connection_ = g_peer_connection_factory->CreatePeerConnection(

View file

@ -146,204 +146,6 @@ TEST_P(DataChannelIntegrationTest, DataChannelWhileDisconnectedIceRestart) {
kDefaultTimeout); kDefaultTimeout);
} }
#endif // WEBRTC_HAVE_SCTP
// This test sets up a call between two parties with audio, video and an RTP
// data channel.
TEST_P(DataChannelIntegrationTest, EndToEndCallWithRtpDataChannel) {
PeerConnectionInterface::RTCConfiguration rtc_config;
rtc_config.enable_rtp_data_channel = true;
rtc_config.enable_dtls_srtp = false;
ASSERT_TRUE(CreatePeerConnectionWrappersWithConfig(rtc_config, rtc_config));
ConnectFakeSignaling();
// Expect that data channel created on caller side will show up for callee as
// well.
caller()->CreateDataChannel();
caller()->AddAudioVideoTracks();
callee()->AddAudioVideoTracks();
caller()->CreateAndSetAndSignalOffer();
ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
// Ensure the existence of the RTP data channel didn't impede audio/video.
MediaExpectations media_expectations;
media_expectations.ExpectBidirectionalAudioAndVideo();
ASSERT_TRUE(ExpectNewFrames(media_expectations));
ASSERT_NE(nullptr, caller()->data_channel());
ASSERT_NE(nullptr, callee()->data_channel());
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";
SendRtpDataWithRetries(caller()->data_channel(), data, 5);
EXPECT_EQ_WAIT(data, callee()->data_observer()->last_message(),
kDefaultTimeout);
SendRtpDataWithRetries(callee()->data_channel(), data, 5);
EXPECT_EQ_WAIT(data, caller()->data_observer()->last_message(),
kDefaultTimeout);
}
TEST_P(DataChannelIntegrationTest, RtpDataChannelWorksAfterRollback) {
PeerConnectionInterface::RTCConfiguration rtc_config;
rtc_config.enable_rtp_data_channel = true;
rtc_config.enable_dtls_srtp = false;
ASSERT_TRUE(CreatePeerConnectionWrappersWithConfig(rtc_config, rtc_config));
ConnectFakeSignaling();
auto data_channel = caller()->pc()->CreateDataChannel("label_1", nullptr);
ASSERT_TRUE(data_channel.get() != nullptr);
caller()->CreateAndSetAndSignalOffer();
ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
caller()->CreateDataChannel("label_2", nullptr);
rtc::scoped_refptr<MockSetSessionDescriptionObserver> observer(
new rtc::RefCountedObject<MockSetSessionDescriptionObserver>());
caller()->pc()->SetLocalDescription(observer,
caller()->CreateOfferAndWait().release());
EXPECT_TRUE_WAIT(observer->called(), kDefaultTimeout);
caller()->Rollback();
std::string data = "hello world";
SendRtpDataWithRetries(data_channel, data, 5);
EXPECT_EQ_WAIT(data, callee()->data_observer()->last_message(),
kDefaultTimeout);
}
// Ensure that an RTP data channel is signaled as closed for the caller when
// the callee rejects it in a subsequent offer.
TEST_P(DataChannelIntegrationTest, RtpDataChannelSignaledClosedInCalleeOffer) {
// Same procedure as above test.
PeerConnectionInterface::RTCConfiguration rtc_config;
rtc_config.enable_rtp_data_channel = true;
rtc_config.enable_dtls_srtp = false;
ASSERT_TRUE(CreatePeerConnectionWrappersWithConfig(rtc_config, rtc_config));
ConnectFakeSignaling();
caller()->CreateDataChannel();
caller()->AddAudioVideoTracks();
callee()->AddAudioVideoTracks();
caller()->CreateAndSetAndSignalOffer();
ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
ASSERT_NE(nullptr, caller()->data_channel());
ASSERT_NE(nullptr, callee()->data_channel());
ASSERT_TRUE_WAIT(caller()->data_observer()->IsOpen(), kDefaultTimeout);
ASSERT_TRUE_WAIT(callee()->data_observer()->IsOpen(), kDefaultTimeout);
// Close the data channel on the callee, and do an updated offer/answer.
callee()->data_channel()->Close();
callee()->CreateAndSetAndSignalOffer();
ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
EXPECT_FALSE(caller()->data_observer()->IsOpen());
EXPECT_FALSE(callee()->data_observer()->IsOpen());
}
#if !defined(THREAD_SANITIZER)
// This test provokes TSAN errors. See bugs.webrtc.org/11282
// Tests that data is buffered in an RTP data channel until an observer is
// registered for it.
//
// NOTE: RTP data channels can receive data before the underlying
// transport has detected that a channel is writable and thus data can be
// received before the data channel state changes to open. That is hard to test
// but the same buffering is expected to be used in that case.
//
// Use fake clock and simulated network delay so that we predictably can wait
// until an SCTP message has been delivered without "sleep()"ing.
TEST_P(DataChannelIntegrationTestWithFakeClock,
DataBufferedUntilRtpDataChannelObserverRegistered) {
virtual_socket_server()->set_delay_mean(5); // 5 ms per hop.
virtual_socket_server()->UpdateDelayDistribution();
PeerConnectionInterface::RTCConfiguration rtc_config;
rtc_config.enable_rtp_data_channel = true;
rtc_config.enable_dtls_srtp = false;
ASSERT_TRUE(CreatePeerConnectionWrappersWithConfig(rtc_config, rtc_config));
ConnectFakeSignaling();
caller()->CreateDataChannel();
caller()->CreateAndSetAndSignalOffer();
ASSERT_TRUE(caller()->data_channel() != nullptr);
ASSERT_TRUE_SIMULATED_WAIT(callee()->data_channel() != nullptr,
kDefaultTimeout, FakeClock());
ASSERT_TRUE_SIMULATED_WAIT(caller()->data_observer()->IsOpen(),
kDefaultTimeout, FakeClock());
ASSERT_EQ_SIMULATED_WAIT(DataChannelInterface::kOpen,
callee()->data_channel()->state(), kDefaultTimeout,
FakeClock());
// Unregister the observer which is normally automatically registered.
callee()->data_channel()->UnregisterObserver();
// Send data and advance fake clock until it should have been received.
std::string data = "hello world";
caller()->data_channel()->Send(DataBuffer(data));
SIMULATED_WAIT(false, 50, FakeClock());
// Attach data channel and expect data to be received immediately. Note that
// EXPECT_EQ_WAIT is used, such that the simulated clock is not advanced any
// further, but data can be received even if the callback is asynchronous.
MockDataChannelObserver new_observer(callee()->data_channel());
EXPECT_EQ_SIMULATED_WAIT(data, new_observer.last_message(), kDefaultTimeout,
FakeClock());
}
#endif // !defined(THREAD_SANITIZER)
// This test sets up a call between two parties with audio, video and but only
// the caller client supports RTP data channels.
TEST_P(DataChannelIntegrationTest, RtpDataChannelsRejectedByCallee) {
PeerConnectionInterface::RTCConfiguration rtc_config_1;
rtc_config_1.enable_rtp_data_channel = true;
// Must disable DTLS to make negotiation succeed.
rtc_config_1.enable_dtls_srtp = false;
PeerConnectionInterface::RTCConfiguration rtc_config_2;
rtc_config_2.enable_dtls_srtp = false;
rtc_config_2.enable_dtls_srtp = false;
ASSERT_TRUE(
CreatePeerConnectionWrappersWithConfig(rtc_config_1, rtc_config_2));
ConnectFakeSignaling();
caller()->CreateDataChannel();
ASSERT_TRUE(caller()->data_channel() != nullptr);
caller()->AddAudioVideoTracks();
callee()->AddAudioVideoTracks();
caller()->CreateAndSetAndSignalOffer();
ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
// The caller should still have a data channel, but it should be closed, and
// one should ever have been created for the callee.
EXPECT_TRUE(caller()->data_channel() != nullptr);
EXPECT_FALSE(caller()->data_observer()->IsOpen());
EXPECT_EQ(nullptr, callee()->data_channel());
}
// This test sets up a call between two parties with audio, and video. When
// audio and video is setup and flowing, an RTP data channel is negotiated.
TEST_P(DataChannelIntegrationTest, AddRtpDataChannelInSubsequentOffer) {
PeerConnectionInterface::RTCConfiguration rtc_config;
rtc_config.enable_rtp_data_channel = true;
rtc_config.enable_dtls_srtp = false;
ASSERT_TRUE(CreatePeerConnectionWrappersWithConfig(rtc_config, rtc_config));
ConnectFakeSignaling();
// Do initial offer/answer with audio/video.
caller()->AddAudioVideoTracks();
callee()->AddAudioVideoTracks();
caller()->CreateAndSetAndSignalOffer();
ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
// Create data channel and do new offer and answer.
caller()->CreateDataChannel();
caller()->CreateAndSetAndSignalOffer();
ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
ASSERT_NE(nullptr, caller()->data_channel());
ASSERT_NE(nullptr, callee()->data_channel());
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";
SendRtpDataWithRetries(caller()->data_channel(), data, 5);
EXPECT_EQ_WAIT(data, callee()->data_observer()->last_message(),
kDefaultTimeout);
SendRtpDataWithRetries(callee()->data_channel(), data, 5);
EXPECT_EQ_WAIT(data, caller()->data_observer()->last_message(),
kDefaultTimeout);
}
#ifdef WEBRTC_HAVE_SCTP
// This test sets up a call between two parties with audio, video and an SCTP // This test sets up a call between two parties with audio, video and an SCTP
// data channel. // data channel.
TEST_P(DataChannelIntegrationTest, EndToEndCallWithSctpDataChannel) { TEST_P(DataChannelIntegrationTest, EndToEndCallWithSctpDataChannel) {

View file

@ -362,7 +362,6 @@ bool PeerConnectionInterface::RTCConfiguration::operator==(
disable_ipv6_on_wifi == o.disable_ipv6_on_wifi && disable_ipv6_on_wifi == o.disable_ipv6_on_wifi &&
max_ipv6_networks == o.max_ipv6_networks && max_ipv6_networks == o.max_ipv6_networks &&
disable_link_local_networks == o.disable_link_local_networks && disable_link_local_networks == o.disable_link_local_networks &&
enable_rtp_data_channel == o.enable_rtp_data_channel &&
screencast_min_bitrate == o.screencast_min_bitrate && screencast_min_bitrate == o.screencast_min_bitrate &&
combined_audio_video_bwe == o.combined_audio_video_bwe && combined_audio_video_bwe == o.combined_audio_video_bwe &&
enable_dtls_srtp == o.enable_dtls_srtp && enable_dtls_srtp == o.enable_dtls_srtp &&
@ -594,16 +593,9 @@ RTCError PeerConnection::Initialize(
NoteUsageEvent(UsageEvent::TURN_SERVER_ADDED); NoteUsageEvent(UsageEvent::TURN_SERVER_ADDED);
} }
if (configuration.enable_rtp_data_channel) { // DTLS has to be enabled to use SCTP.
// Enable creation of RTP data channels if the kEnableRtpDataChannels is if (!options_.disable_sctp_data_channels && dtls_enabled_) {
// set. It takes precendence over the disable_sctp_data_channels data_channel_controller_.set_data_channel_type(cricket::DCT_SCTP);
// PeerConnectionFactoryInterface::Options.
data_channel_controller_.set_data_channel_type(cricket::DCT_RTP);
} else {
// DTLS has to be enabled to use SCTP.
if (!options_.disable_sctp_data_channels && dtls_enabled_) {
data_channel_controller_.set_data_channel_type(cricket::DCT_SCTP);
}
} }
// Network thread initialization. // Network thread initialization.
@ -684,8 +676,7 @@ void PeerConnection::InitializeTransportController_n(
config.active_reset_srtp_params = configuration.active_reset_srtp_params; config.active_reset_srtp_params = configuration.active_reset_srtp_params;
// DTLS has to be enabled to use SCTP. // DTLS has to be enabled to use SCTP.
if (!configuration.enable_rtp_data_channel && if (!options_.disable_sctp_data_channels && dtls_enabled_) {
!options_.disable_sctp_data_channels && dtls_enabled_) {
config.sctp_factory = context_->sctp_transport_factory(); config.sctp_factory = context_->sctp_transport_factory();
} }

View file

@ -753,11 +753,9 @@ TEST_P(PeerConnectionBundleTest, RejectDescriptionChangingBundleTag) {
// This tests that removing contents from BUNDLE group and reject the whole // This tests that removing contents from BUNDLE group and reject the whole
// BUNDLE group could work. This is a regression test for // BUNDLE group could work. This is a regression test for
// (https://bugs.chromium.org/p/chromium/issues/detail?id=827917) // (https://bugs.chromium.org/p/chromium/issues/detail?id=827917)
#ifdef HAVE_SCTP
TEST_P(PeerConnectionBundleTest, RemovingContentAndRejectBundleGroup) { TEST_P(PeerConnectionBundleTest, RemovingContentAndRejectBundleGroup) {
RTCConfiguration config; RTCConfiguration config;
#ifndef WEBRTC_HAVE_SCTP
config.enable_rtp_data_channel = true;
#endif
config.bundle_policy = BundlePolicy::kBundlePolicyMaxBundle; config.bundle_policy = BundlePolicy::kBundlePolicyMaxBundle;
auto caller = CreatePeerConnectionWithAudioVideo(config); auto caller = CreatePeerConnectionWithAudioVideo(config);
caller->CreateDataChannel("dc"); caller->CreateDataChannel("dc");
@ -782,6 +780,7 @@ TEST_P(PeerConnectionBundleTest, RemovingContentAndRejectBundleGroup) {
EXPECT_TRUE(caller->SetLocalDescription(std::move(re_offer))); EXPECT_TRUE(caller->SetLocalDescription(std::move(re_offer)));
} }
#endif
// This tests that the BUNDLE group in answer should be a subset of the offered // This tests that the BUNDLE group in answer should be a subset of the offered
// group. // group.

View file

@ -193,28 +193,6 @@ class PeerConnectionDataChannelUnifiedPlanTest
: PeerConnectionDataChannelBaseTest(SdpSemantics::kUnifiedPlan) {} : PeerConnectionDataChannelBaseTest(SdpSemantics::kUnifiedPlan) {}
}; };
TEST_P(PeerConnectionDataChannelTest,
NoSctpTransportCreatedIfRtpDataChannelEnabled) {
RTCConfiguration config;
config.enable_rtp_data_channel = true;
auto caller = CreatePeerConnectionWithDataChannel(config);
ASSERT_TRUE(caller->SetLocalDescription(caller->CreateOffer()));
EXPECT_FALSE(caller->sctp_transport_factory()->last_fake_sctp_transport());
}
TEST_P(PeerConnectionDataChannelTest,
RtpDataChannelCreatedEvenIfSctpAvailable) {
RTCConfiguration config;
config.enable_rtp_data_channel = true;
PeerConnectionFactoryInterface::Options options;
options.disable_sctp_data_channels = false;
auto caller = CreatePeerConnectionWithDataChannel(config, options);
ASSERT_TRUE(caller->SetLocalDescription(caller->CreateOffer()));
EXPECT_FALSE(caller->sctp_transport_factory()->last_fake_sctp_transport());
}
TEST_P(PeerConnectionDataChannelTest, InternalSctpTransportDeletedOnTeardown) { TEST_P(PeerConnectionDataChannelTest, InternalSctpTransportDeletedOnTeardown) {
auto caller = CreatePeerConnectionWithDataChannel(); auto caller = CreatePeerConnectionWithDataChannel();

View file

@ -1901,179 +1901,6 @@ TEST_P(PeerConnectionInterfaceTest, GetRTCStatsBeforeAndAfterCalling) {
EXPECT_TRUE(DoGetRTCStats()); EXPECT_TRUE(DoGetRTCStats());
} }
// This test setup two RTP data channels in loop back.
TEST_P(PeerConnectionInterfaceTest, TestDataChannel) {
RTCConfiguration config;
config.enable_rtp_data_channel = true;
config.enable_dtls_srtp = false;
CreatePeerConnection(config);
rtc::scoped_refptr<DataChannelInterface> data1 =
pc_->CreateDataChannel("test1", NULL);
rtc::scoped_refptr<DataChannelInterface> data2 =
pc_->CreateDataChannel("test2", NULL);
ASSERT_TRUE(data1 != NULL);
std::unique_ptr<MockDataChannelObserver> observer1(
new MockDataChannelObserver(data1));
std::unique_ptr<MockDataChannelObserver> observer2(
new MockDataChannelObserver(data2));
EXPECT_EQ(DataChannelInterface::kConnecting, data1->state());
EXPECT_EQ(DataChannelInterface::kConnecting, data2->state());
std::string data_to_send1 = "testing testing";
std::string data_to_send2 = "testing something else";
EXPECT_FALSE(data1->Send(DataBuffer(data_to_send1)));
CreateOfferReceiveAnswer();
EXPECT_TRUE_WAIT(observer1->IsOpen(), kTimeout);
EXPECT_TRUE_WAIT(observer2->IsOpen(), kTimeout);
EXPECT_EQ(DataChannelInterface::kOpen, data1->state());
EXPECT_EQ(DataChannelInterface::kOpen, data2->state());
EXPECT_TRUE(data1->Send(DataBuffer(data_to_send1)));
EXPECT_TRUE(data2->Send(DataBuffer(data_to_send2)));
EXPECT_EQ_WAIT(data_to_send1, observer1->last_message(), kTimeout);
EXPECT_EQ_WAIT(data_to_send2, observer2->last_message(), kTimeout);
data1->Close();
EXPECT_EQ(DataChannelInterface::kClosing, data1->state());
CreateOfferReceiveAnswer();
EXPECT_FALSE(observer1->IsOpen());
EXPECT_EQ(DataChannelInterface::kClosed, data1->state());
EXPECT_TRUE(observer2->IsOpen());
data_to_send2 = "testing something else again";
EXPECT_TRUE(data2->Send(DataBuffer(data_to_send2)));
EXPECT_EQ_WAIT(data_to_send2, observer2->last_message(), kTimeout);
}
// This test verifies that sendnig binary data over RTP data channels should
// fail.
TEST_P(PeerConnectionInterfaceTest, TestSendBinaryOnRtpDataChannel) {
RTCConfiguration config;
config.enable_rtp_data_channel = true;
config.enable_dtls_srtp = false;
CreatePeerConnection(config);
rtc::scoped_refptr<DataChannelInterface> data1 =
pc_->CreateDataChannel("test1", NULL);
rtc::scoped_refptr<DataChannelInterface> data2 =
pc_->CreateDataChannel("test2", NULL);
ASSERT_TRUE(data1 != NULL);
std::unique_ptr<MockDataChannelObserver> observer1(
new MockDataChannelObserver(data1));
std::unique_ptr<MockDataChannelObserver> observer2(
new MockDataChannelObserver(data2));
EXPECT_EQ(DataChannelInterface::kConnecting, data1->state());
EXPECT_EQ(DataChannelInterface::kConnecting, data2->state());
CreateOfferReceiveAnswer();
EXPECT_TRUE_WAIT(observer1->IsOpen(), kTimeout);
EXPECT_TRUE_WAIT(observer2->IsOpen(), kTimeout);
EXPECT_EQ(DataChannelInterface::kOpen, data1->state());
EXPECT_EQ(DataChannelInterface::kOpen, data2->state());
rtc::CopyOnWriteBuffer buffer("test", 4);
EXPECT_FALSE(data1->Send(DataBuffer(buffer, true)));
}
// This test setup a RTP data channels in loop back and test that a channel is
// opened even if the remote end answer with a zero SSRC.
TEST_P(PeerConnectionInterfaceTest, TestSendOnlyDataChannel) {
RTCConfiguration config;
config.enable_rtp_data_channel = true;
config.enable_dtls_srtp = false;
CreatePeerConnection(config);
rtc::scoped_refptr<DataChannelInterface> data1 =
pc_->CreateDataChannel("test1", NULL);
std::unique_ptr<MockDataChannelObserver> observer1(
new MockDataChannelObserver(data1));
CreateOfferReceiveAnswerWithoutSsrc();
EXPECT_TRUE_WAIT(observer1->IsOpen(), kTimeout);
data1->Close();
EXPECT_EQ(DataChannelInterface::kClosing, data1->state());
CreateOfferReceiveAnswerWithoutSsrc();
EXPECT_EQ(DataChannelInterface::kClosed, data1->state());
EXPECT_FALSE(observer1->IsOpen());
}
// This test that if a data channel is added in an answer a receive only channel
// channel is created.
TEST_P(PeerConnectionInterfaceTest, TestReceiveOnlyDataChannel) {
RTCConfiguration config;
config.enable_rtp_data_channel = true;
config.enable_dtls_srtp = false;
CreatePeerConnection(config);
std::string offer_label = "offer_channel";
rtc::scoped_refptr<DataChannelInterface> offer_channel =
pc_->CreateDataChannel(offer_label, NULL);
CreateOfferAsLocalDescription();
// Replace the data channel label in the offer and apply it as an answer.
std::string receive_label = "answer_channel";
std::string sdp;
EXPECT_TRUE(pc_->local_description()->ToString(&sdp));
absl::StrReplaceAll({{offer_label, receive_label}}, &sdp);
CreateAnswerAsRemoteDescription(sdp);
// Verify that a new incoming data channel has been created and that
// it is open but can't we written to.
ASSERT_TRUE(observer_.last_datachannel_ != NULL);
DataChannelInterface* received_channel = observer_.last_datachannel_;
EXPECT_EQ(DataChannelInterface::kConnecting, received_channel->state());
EXPECT_EQ(receive_label, received_channel->label());
EXPECT_FALSE(received_channel->Send(DataBuffer("something")));
// Verify that the channel we initially offered has been rejected.
EXPECT_EQ(DataChannelInterface::kClosed, offer_channel->state());
// Do another offer / answer exchange and verify that the data channel is
// opened.
CreateOfferReceiveAnswer();
EXPECT_EQ_WAIT(DataChannelInterface::kOpen, received_channel->state(),
kTimeout);
}
// This test that no data channel is returned if a reliable channel is
// requested.
// TODO(perkj): Remove this test once reliable channels are implemented.
TEST_P(PeerConnectionInterfaceTest, CreateReliableRtpDataChannelShouldFail) {
RTCConfiguration rtc_config;
rtc_config.enable_rtp_data_channel = true;
CreatePeerConnection(rtc_config);
std::string label = "test";
webrtc::DataChannelInit config;
config.reliable = true;
rtc::scoped_refptr<DataChannelInterface> channel =
pc_->CreateDataChannel(label, &config);
EXPECT_TRUE(channel == NULL);
}
// Verifies that duplicated label is not allowed for RTP data channel.
TEST_P(PeerConnectionInterfaceTest, RtpDuplicatedLabelNotAllowed) {
RTCConfiguration config;
config.enable_rtp_data_channel = true;
CreatePeerConnection(config);
std::string label = "test";
rtc::scoped_refptr<DataChannelInterface> channel =
pc_->CreateDataChannel(label, nullptr);
EXPECT_NE(channel, nullptr);
rtc::scoped_refptr<DataChannelInterface> dup_channel =
pc_->CreateDataChannel(label, nullptr);
EXPECT_EQ(dup_channel, nullptr);
}
// This tests that a SCTP data channel is returned using different // This tests that a SCTP data channel is returned using different
// DataChannelInit configurations. // DataChannelInit configurations.
TEST_P(PeerConnectionInterfaceTest, CreateSctpDataChannel) { TEST_P(PeerConnectionInterfaceTest, CreateSctpDataChannel) {
@ -2191,78 +2018,6 @@ TEST_P(PeerConnectionInterfaceTest, SctpDuplicatedLabelAllowed) {
EXPECT_NE(dup_channel, nullptr); EXPECT_NE(dup_channel, nullptr);
} }
// This test verifies that OnRenegotiationNeeded is fired for every new RTP
// DataChannel.
TEST_P(PeerConnectionInterfaceTest, RenegotiationNeededForNewRtpDataChannel) {
RTCConfiguration rtc_config;
rtc_config.enable_rtp_data_channel = true;
rtc_config.enable_dtls_srtp = false;
CreatePeerConnection(rtc_config);
rtc::scoped_refptr<DataChannelInterface> dc1 =
pc_->CreateDataChannel("test1", NULL);
EXPECT_TRUE(observer_.renegotiation_needed_);
observer_.renegotiation_needed_ = false;
CreateOfferReceiveAnswer();
rtc::scoped_refptr<DataChannelInterface> dc2 =
pc_->CreateDataChannel("test2", NULL);
EXPECT_EQ(observer_.renegotiation_needed_,
GetParam() == SdpSemantics::kPlanB);
}
// This test that a data channel closes when a PeerConnection is deleted/closed.
TEST_P(PeerConnectionInterfaceTest, DataChannelCloseWhenPeerConnectionClose) {
RTCConfiguration rtc_config;
rtc_config.enable_rtp_data_channel = true;
rtc_config.enable_dtls_srtp = false;
CreatePeerConnection(rtc_config);
rtc::scoped_refptr<DataChannelInterface> data1 =
pc_->CreateDataChannel("test1", NULL);
rtc::scoped_refptr<DataChannelInterface> data2 =
pc_->CreateDataChannel("test2", NULL);
ASSERT_TRUE(data1 != NULL);
std::unique_ptr<MockDataChannelObserver> observer1(
new MockDataChannelObserver(data1));
std::unique_ptr<MockDataChannelObserver> observer2(
new MockDataChannelObserver(data2));
CreateOfferReceiveAnswer();
EXPECT_TRUE_WAIT(observer1->IsOpen(), kTimeout);
EXPECT_TRUE_WAIT(observer2->IsOpen(), kTimeout);
ReleasePeerConnection();
EXPECT_EQ(DataChannelInterface::kClosed, data1->state());
EXPECT_EQ(DataChannelInterface::kClosed, data2->state());
}
// This tests that RTP data channels can be rejected in an answer.
TEST_P(PeerConnectionInterfaceTest, TestRejectRtpDataChannelInAnswer) {
RTCConfiguration rtc_config;
rtc_config.enable_rtp_data_channel = true;
rtc_config.enable_dtls_srtp = false;
CreatePeerConnection(rtc_config);
rtc::scoped_refptr<DataChannelInterface> offer_channel(
pc_->CreateDataChannel("offer_channel", NULL));
CreateOfferAsLocalDescription();
// Create an answer where the m-line for data channels are rejected.
std::string sdp;
EXPECT_TRUE(pc_->local_description()->ToString(&sdp));
std::unique_ptr<SessionDescriptionInterface> answer(
webrtc::CreateSessionDescription(SdpType::kAnswer, sdp));
ASSERT_TRUE(answer);
cricket::ContentInfo* data_info =
cricket::GetFirstDataContent(answer->description());
data_info->rejected = true;
DoSetRemoteDescription(std::move(answer));
EXPECT_EQ(DataChannelInterface::kClosed, offer_channel->state());
}
#ifdef WEBRTC_HAVE_SCTP #ifdef WEBRTC_HAVE_SCTP
// This tests that SCTP data channels can be rejected in an answer. // This tests that SCTP data channels can be rejected in an answer.

View file

@ -2266,17 +2266,4 @@ TEST_F(PeerConnectionJsepTest,
EXPECT_TRUE(callee->CreateOfferAndSetAsLocal()); EXPECT_TRUE(callee->CreateOfferAndSetAsLocal());
} }
TEST_F(PeerConnectionJsepTest, RollbackRtpDataChannel) {
RTCConfiguration config;
config.sdp_semantics = SdpSemantics::kUnifiedPlan;
config.enable_rtp_data_channel = true;
auto pc = CreatePeerConnection(config);
pc->CreateDataChannel("dummy");
auto offer = pc->CreateOffer();
EXPECT_TRUE(pc->CreateOfferAndSetAsLocal());
EXPECT_TRUE(pc->SetRemoteDescription(pc->CreateRollback()));
EXPECT_TRUE(pc->SetLocalDescription(std::move(offer)));
pc->pc()->Close();
}
} // namespace webrtc } // namespace webrtc

View file

@ -514,7 +514,6 @@ public class PeerConnection {
public boolean disableIpv6; public boolean disableIpv6;
public boolean enableDscp; public boolean enableDscp;
public boolean enableCpuOveruseDetection; public boolean enableCpuOveruseDetection;
public boolean enableRtpDataChannel;
public boolean suspendBelowMinBitrate; public boolean suspendBelowMinBitrate;
@Nullable public Integer screencastMinBitrate; @Nullable public Integer screencastMinBitrate;
@Nullable public Boolean combinedAudioVideoBwe; @Nullable public Boolean combinedAudioVideoBwe;
@ -595,7 +594,6 @@ public class PeerConnection {
disableIpv6 = false; disableIpv6 = false;
enableDscp = false; enableDscp = false;
enableCpuOveruseDetection = true; enableCpuOveruseDetection = true;
enableRtpDataChannel = false;
suspendBelowMinBitrate = false; suspendBelowMinBitrate = false;
screencastMinBitrate = null; screencastMinBitrate = null;
combinedAudioVideoBwe = null; combinedAudioVideoBwe = null;
@ -768,11 +766,6 @@ public class PeerConnection {
return enableCpuOveruseDetection; return enableCpuOveruseDetection;
} }
@CalledByNative("RTCConfiguration")
boolean getEnableRtpDataChannel() {
return enableRtpDataChannel;
}
@CalledByNative("RTCConfiguration") @CalledByNative("RTCConfiguration")
boolean getSuspendBelowMinBitrate() { boolean getSuspendBelowMinBitrate() {
return suspendBelowMinBitrate; return suspendBelowMinBitrate;

View file

@ -251,8 +251,6 @@ void JavaToNativeRTCConfiguration(
Java_RTCConfiguration_getEnableDscp(jni, j_rtc_config); Java_RTCConfiguration_getEnableDscp(jni, j_rtc_config);
rtc_config->media_config.video.enable_cpu_adaptation = rtc_config->media_config.video.enable_cpu_adaptation =
Java_RTCConfiguration_getEnableCpuOveruseDetection(jni, j_rtc_config); Java_RTCConfiguration_getEnableCpuOveruseDetection(jni, j_rtc_config);
rtc_config->enable_rtp_data_channel =
Java_RTCConfiguration_getEnableRtpDataChannel(jni, j_rtc_config);
rtc_config->media_config.video.suspend_below_min_bitrate = rtc_config->media_config.video.suspend_below_min_bitrate =
Java_RTCConfiguration_getSuspendBelowMinBitrate(jni, j_rtc_config); Java_RTCConfiguration_getSuspendBelowMinBitrate(jni, j_rtc_config);
rtc_config->screencast_min_bitrate = JavaToNativeOptionalInt( rtc_config->screencast_min_bitrate = JavaToNativeOptionalInt(

View file

@ -167,8 +167,6 @@ void CopyConstraintsIntoRtcConfiguration(
FindConstraint(constraints, MediaConstraints::kCpuOveruseDetection, FindConstraint(constraints, MediaConstraints::kCpuOveruseDetection,
&configuration->media_config.video.enable_cpu_adaptation, &configuration->media_config.video.enable_cpu_adaptation,
nullptr); nullptr);
FindConstraint(constraints, MediaConstraints::kEnableRtpDataChannels,
&configuration->enable_rtp_data_channel, nullptr);
// Find Suspend Below Min Bitrate constraint. // Find Suspend Below Min Bitrate constraint.
FindConstraint( FindConstraint(
constraints, MediaConstraints::kEnableVideoSuspendBelowMinBitrate, constraints, MediaConstraints::kEnableVideoSuspendBelowMinBitrate,

View file

@ -23,7 +23,6 @@ bool Matches(const PeerConnectionInterface::RTCConfiguration& a,
return a.disable_ipv6 == b.disable_ipv6 && return a.disable_ipv6 == b.disable_ipv6 &&
a.audio_jitter_buffer_max_packets == a.audio_jitter_buffer_max_packets ==
b.audio_jitter_buffer_max_packets && b.audio_jitter_buffer_max_packets &&
a.enable_rtp_data_channel == b.enable_rtp_data_channel &&
a.screencast_min_bitrate == b.screencast_min_bitrate && a.screencast_min_bitrate == b.screencast_min_bitrate &&
a.combined_audio_video_bwe == b.combined_audio_video_bwe && a.combined_audio_video_bwe == b.combined_audio_video_bwe &&
a.enable_dtls_srtp == b.enable_dtls_srtp && a.enable_dtls_srtp == b.enable_dtls_srtp &&