mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 05:40:42 +01:00
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:
parent
fa8a9465d5
commit
bc959b61b3
12 changed files with 6 additions and 513 deletions
|
@ -404,12 +404,6 @@ class RTC_EXPORT PeerConnectionInterface : public rtc::RefCountInterface {
|
|||
// from consideration for gathering ICE candidates.
|
||||
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.
|
||||
// This means adding padding bits up to this bitrate, which can help
|
||||
// when switching from a static scene to one with motion.
|
||||
|
|
|
@ -190,7 +190,6 @@ bool SimplePeerConnection::CreatePeerConnection(const char** turn_urls,
|
|||
webrtc::PeerConnectionInterface::IceServer stun_server;
|
||||
stun_server.uri = GetPeerConnectionString();
|
||||
config_.servers.push_back(stun_server);
|
||||
config_.enable_rtp_data_channel = true;
|
||||
config_.enable_dtls_srtp = false;
|
||||
|
||||
peer_connection_ = g_peer_connection_factory->CreatePeerConnection(
|
||||
|
|
|
@ -146,204 +146,6 @@ TEST_P(DataChannelIntegrationTest, DataChannelWhileDisconnectedIceRestart) {
|
|||
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
|
||||
// data channel.
|
||||
TEST_P(DataChannelIntegrationTest, EndToEndCallWithSctpDataChannel) {
|
||||
|
|
|
@ -362,7 +362,6 @@ bool PeerConnectionInterface::RTCConfiguration::operator==(
|
|||
disable_ipv6_on_wifi == o.disable_ipv6_on_wifi &&
|
||||
max_ipv6_networks == o.max_ipv6_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 &&
|
||||
combined_audio_video_bwe == o.combined_audio_video_bwe &&
|
||||
enable_dtls_srtp == o.enable_dtls_srtp &&
|
||||
|
@ -594,17 +593,10 @@ RTCError PeerConnection::Initialize(
|
|||
NoteUsageEvent(UsageEvent::TURN_SERVER_ADDED);
|
||||
}
|
||||
|
||||
if (configuration.enable_rtp_data_channel) {
|
||||
// Enable creation of RTP data channels if the kEnableRtpDataChannels is
|
||||
// set. It takes precendence over the disable_sctp_data_channels
|
||||
// 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()->Invoke<void>(RTC_FROM_HERE, [this, &stun_servers,
|
||||
|
@ -684,8 +676,7 @@ void PeerConnection::InitializeTransportController_n(
|
|||
config.active_reset_srtp_params = configuration.active_reset_srtp_params;
|
||||
|
||||
// DTLS has to be enabled to use SCTP.
|
||||
if (!configuration.enable_rtp_data_channel &&
|
||||
!options_.disable_sctp_data_channels && dtls_enabled_) {
|
||||
if (!options_.disable_sctp_data_channels && dtls_enabled_) {
|
||||
config.sctp_factory = context_->sctp_transport_factory();
|
||||
}
|
||||
|
||||
|
|
|
@ -753,11 +753,9 @@ TEST_P(PeerConnectionBundleTest, RejectDescriptionChangingBundleTag) {
|
|||
// This tests that removing contents from BUNDLE group and reject the whole
|
||||
// BUNDLE group could work. This is a regression test for
|
||||
// (https://bugs.chromium.org/p/chromium/issues/detail?id=827917)
|
||||
#ifdef HAVE_SCTP
|
||||
TEST_P(PeerConnectionBundleTest, RemovingContentAndRejectBundleGroup) {
|
||||
RTCConfiguration config;
|
||||
#ifndef WEBRTC_HAVE_SCTP
|
||||
config.enable_rtp_data_channel = true;
|
||||
#endif
|
||||
config.bundle_policy = BundlePolicy::kBundlePolicyMaxBundle;
|
||||
auto caller = CreatePeerConnectionWithAudioVideo(config);
|
||||
caller->CreateDataChannel("dc");
|
||||
|
@ -782,6 +780,7 @@ TEST_P(PeerConnectionBundleTest, RemovingContentAndRejectBundleGroup) {
|
|||
|
||||
EXPECT_TRUE(caller->SetLocalDescription(std::move(re_offer)));
|
||||
}
|
||||
#endif
|
||||
|
||||
// This tests that the BUNDLE group in answer should be a subset of the offered
|
||||
// group.
|
||||
|
|
|
@ -193,28 +193,6 @@ class PeerConnectionDataChannelUnifiedPlanTest
|
|||
: 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) {
|
||||
auto caller = CreatePeerConnectionWithDataChannel();
|
||||
|
||||
|
|
|
@ -1901,179 +1901,6 @@ TEST_P(PeerConnectionInterfaceTest, GetRTCStatsBeforeAndAfterCalling) {
|
|||
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
|
||||
// DataChannelInit configurations.
|
||||
TEST_P(PeerConnectionInterfaceTest, CreateSctpDataChannel) {
|
||||
|
@ -2191,78 +2018,6 @@ TEST_P(PeerConnectionInterfaceTest, SctpDuplicatedLabelAllowed) {
|
|||
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
|
||||
// This tests that SCTP data channels can be rejected in an answer.
|
||||
|
|
|
@ -2266,17 +2266,4 @@ TEST_F(PeerConnectionJsepTest,
|
|||
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
|
||||
|
|
|
@ -514,7 +514,6 @@ public class PeerConnection {
|
|||
public boolean disableIpv6;
|
||||
public boolean enableDscp;
|
||||
public boolean enableCpuOveruseDetection;
|
||||
public boolean enableRtpDataChannel;
|
||||
public boolean suspendBelowMinBitrate;
|
||||
@Nullable public Integer screencastMinBitrate;
|
||||
@Nullable public Boolean combinedAudioVideoBwe;
|
||||
|
@ -595,7 +594,6 @@ public class PeerConnection {
|
|||
disableIpv6 = false;
|
||||
enableDscp = false;
|
||||
enableCpuOveruseDetection = true;
|
||||
enableRtpDataChannel = false;
|
||||
suspendBelowMinBitrate = false;
|
||||
screencastMinBitrate = null;
|
||||
combinedAudioVideoBwe = null;
|
||||
|
@ -768,11 +766,6 @@ public class PeerConnection {
|
|||
return enableCpuOveruseDetection;
|
||||
}
|
||||
|
||||
@CalledByNative("RTCConfiguration")
|
||||
boolean getEnableRtpDataChannel() {
|
||||
return enableRtpDataChannel;
|
||||
}
|
||||
|
||||
@CalledByNative("RTCConfiguration")
|
||||
boolean getSuspendBelowMinBitrate() {
|
||||
return suspendBelowMinBitrate;
|
||||
|
|
|
@ -251,8 +251,6 @@ void JavaToNativeRTCConfiguration(
|
|||
Java_RTCConfiguration_getEnableDscp(jni, j_rtc_config);
|
||||
rtc_config->media_config.video.enable_cpu_adaptation =
|
||||
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 =
|
||||
Java_RTCConfiguration_getSuspendBelowMinBitrate(jni, j_rtc_config);
|
||||
rtc_config->screencast_min_bitrate = JavaToNativeOptionalInt(
|
||||
|
|
|
@ -167,8 +167,6 @@ void CopyConstraintsIntoRtcConfiguration(
|
|||
FindConstraint(constraints, MediaConstraints::kCpuOveruseDetection,
|
||||
&configuration->media_config.video.enable_cpu_adaptation,
|
||||
nullptr);
|
||||
FindConstraint(constraints, MediaConstraints::kEnableRtpDataChannels,
|
||||
&configuration->enable_rtp_data_channel, nullptr);
|
||||
// Find Suspend Below Min Bitrate constraint.
|
||||
FindConstraint(
|
||||
constraints, MediaConstraints::kEnableVideoSuspendBelowMinBitrate,
|
||||
|
|
|
@ -23,7 +23,6 @@ bool Matches(const PeerConnectionInterface::RTCConfiguration& a,
|
|||
return a.disable_ipv6 == b.disable_ipv6 &&
|
||||
a.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.combined_audio_video_bwe == b.combined_audio_video_bwe &&
|
||||
a.enable_dtls_srtp == b.enable_dtls_srtp &&
|
||||
|
|
Loading…
Reference in a new issue