Revert of Modified PeerConnection and WebRtcSession for end-to-end QuicDataChannel usage. (patchset #8 id:280001 of https://codereview.webrtc.org/2166873002/ )

Reason for revert:
Reverting because it broke an RTP data channel test on the FYI bots.

Original issue's description:
> Modified PeerConnection and WebRtcSession for end-to-end QuicDataChannel usage.
>
> To allow end-to-end QuicDataChannel usage with a
> PeerConnection, RTCConfiguration has been modified to
> include a boolean for whether to do QUIC, since negotiation of
> QUIC is not implemented. If one peer does QUIC, then it will be
> assumed that the other peer must do QUIC or the connection
> will fail.
>
> PeerConnection has been modified to create data channels of type
> QuicDataChannel when the peer wants to do QUIC.
>
> WebRtcSession has ben modified to use a QuicDataTransport
> instead of a DtlsTransportChannelWrapper/DataChannel
> when QUIC should be used
>
> QuicDataTransport implements the generic functions of
> BaseChannel to manage the QuicTransportChannel.
>
> Committed: https://crrev.com/34b54c36a533dadb6ceb70795119194e6f530ef5
> Cr-Commit-Position: refs/heads/master@{#13645}

TBR=pthatcher@webrtc.org,zhihuang@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review-Url: https://codereview.webrtc.org/2206793007
Cr-Commit-Position: refs/heads/master@{#13647}
This commit is contained in:
deadbeef
2016-08-04 12:22:18 -07:00
committed by Commit bot
parent e7db69bc3c
commit 907abe4411
16 changed files with 165 additions and 541 deletions

View File

@ -242,6 +242,7 @@ static const char kSdpStringMs1Video1[] =
using ::testing::Exactly;
using cricket::StreamParams;
using rtc::scoped_refptr;
using webrtc::AudioSourceInterface;
using webrtc::AudioTrack;
using webrtc::AudioTrackInterface;
@ -534,18 +535,18 @@ class MockPeerConnectionObserver : public PeerConnectionObserver {
return "";
}
rtc::scoped_refptr<PeerConnectionInterface> pc_;
scoped_refptr<PeerConnectionInterface> pc_;
PeerConnectionInterface::SignalingState state_;
std::unique_ptr<IceCandidateInterface> last_candidate_;
rtc::scoped_refptr<DataChannelInterface> last_datachannel_;
scoped_refptr<DataChannelInterface> last_datachannel_;
rtc::scoped_refptr<StreamCollection> remote_streams_;
bool renegotiation_needed_ = false;
bool ice_complete_ = false;
bool callback_triggered = false;
private:
rtc::scoped_refptr<MediaStreamInterface> last_added_stream_;
rtc::scoped_refptr<MediaStreamInterface> last_removed_stream_;
scoped_refptr<MediaStreamInterface> last_added_stream_;
scoped_refptr<MediaStreamInterface> last_removed_stream_;
};
} // namespace
@ -663,7 +664,7 @@ class PeerConnectionInterfaceTest : public testing::Test {
server.uri = uri;
config.servers.push_back(server);
rtc::scoped_refptr<PeerConnectionInterface> pc;
scoped_refptr<PeerConnectionInterface> pc;
pc = pc_factory_->CreatePeerConnection(config, nullptr, nullptr, nullptr,
&observer_);
EXPECT_EQ(nullptr, pc);
@ -699,11 +700,11 @@ class PeerConnectionInterfaceTest : public testing::Test {
void AddVideoStream(const std::string& label) {
// Create a local stream.
rtc::scoped_refptr<MediaStreamInterface> stream(
scoped_refptr<MediaStreamInterface> stream(
pc_factory_->CreateLocalMediaStream(label));
rtc::scoped_refptr<VideoTrackSourceInterface> video_source(
scoped_refptr<VideoTrackSourceInterface> video_source(
pc_factory_->CreateVideoSource(new cricket::FakeVideoCapturer(), NULL));
rtc::scoped_refptr<VideoTrackInterface> video_track(
scoped_refptr<VideoTrackInterface> video_track(
pc_factory_->CreateVideoTrack(label + "v0", video_source));
stream->AddTrack(video_track.get());
EXPECT_TRUE(pc_->AddStream(stream));
@ -713,9 +714,9 @@ class PeerConnectionInterfaceTest : public testing::Test {
void AddVoiceStream(const std::string& label) {
// Create a local stream.
rtc::scoped_refptr<MediaStreamInterface> stream(
scoped_refptr<MediaStreamInterface> stream(
pc_factory_->CreateLocalMediaStream(label));
rtc::scoped_refptr<AudioTrackInterface> audio_track(
scoped_refptr<AudioTrackInterface> audio_track(
pc_factory_->CreateAudioTrack(label + "a0", NULL));
stream->AddTrack(audio_track.get());
EXPECT_TRUE(pc_->AddStream(stream));
@ -727,13 +728,13 @@ class PeerConnectionInterfaceTest : public testing::Test {
const std::string& audio_track_label,
const std::string& video_track_label) {
// Create a local stream.
rtc::scoped_refptr<MediaStreamInterface> stream(
scoped_refptr<MediaStreamInterface> stream(
pc_factory_->CreateLocalMediaStream(stream_label));
rtc::scoped_refptr<AudioTrackInterface> audio_track(
scoped_refptr<AudioTrackInterface> audio_track(
pc_factory_->CreateAudioTrack(
audio_track_label, static_cast<AudioSourceInterface*>(NULL)));
stream->AddTrack(audio_track.get());
rtc::scoped_refptr<VideoTrackInterface> video_track(
scoped_refptr<VideoTrackInterface> video_track(
pc_factory_->CreateVideoTrack(
video_track_label,
pc_factory_->CreateVideoSource(new cricket::FakeVideoCapturer())));
@ -1041,9 +1042,9 @@ class PeerConnectionInterfaceTest : public testing::Test {
}
cricket::FakePortAllocator* port_allocator_ = nullptr;
rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> pc_factory_;
rtc::scoped_refptr<PeerConnectionFactoryForTest> pc_factory_for_test_;
rtc::scoped_refptr<PeerConnectionInterface> pc_;
scoped_refptr<webrtc::PeerConnectionFactoryInterface> pc_factory_;
scoped_refptr<PeerConnectionFactoryForTest> pc_factory_for_test_;
scoped_refptr<PeerConnectionInterface> pc_;
MockPeerConnectionObserver observer_;
rtc::scoped_refptr<StreamCollection> reference_collection_;
};
@ -1051,7 +1052,7 @@ class PeerConnectionInterfaceTest : public testing::Test {
// Test that no callbacks on the PeerConnectionObserver are called after the
// PeerConnection is closed.
TEST_F(PeerConnectionInterfaceTest, CloseAndTestCallbackFunctions) {
rtc::scoped_refptr<PeerConnectionInterface> pc(
scoped_refptr<PeerConnectionInterface> pc(
pc_factory_for_test_->CreatePeerConnection(
PeerConnectionInterface::RTCConfiguration(), nullptr, nullptr,
nullptr, &observer_));
@ -1169,11 +1170,11 @@ TEST_F(PeerConnectionInterfaceTest, AddStreams) {
ASSERT_EQ(2u, pc_->local_streams()->count());
// Test we can add multiple local streams to one peerconnection.
rtc::scoped_refptr<MediaStreamInterface> stream(
scoped_refptr<MediaStreamInterface> stream(
pc_factory_->CreateLocalMediaStream(kStreamLabel3));
rtc::scoped_refptr<AudioTrackInterface> audio_track(
pc_factory_->CreateAudioTrack(kStreamLabel3,
static_cast<AudioSourceInterface*>(NULL)));
scoped_refptr<AudioTrackInterface> audio_track(
pc_factory_->CreateAudioTrack(
kStreamLabel3, static_cast<AudioSourceInterface*>(NULL)));
stream->AddTrack(audio_track.get());
EXPECT_TRUE(pc_->AddStream(stream));
EXPECT_EQ(3u, pc_->local_streams()->count());
@ -1251,16 +1252,15 @@ TEST_F(PeerConnectionInterfaceTest, RemoveStream) {
TEST_F(PeerConnectionInterfaceTest, AddTrackRemoveTrack) {
CreatePeerConnection();
// Create a dummy stream, so tracks share a stream label.
rtc::scoped_refptr<MediaStreamInterface> stream(
scoped_refptr<MediaStreamInterface> stream(
pc_factory_->CreateLocalMediaStream(kStreamLabel1));
std::vector<MediaStreamInterface*> stream_list;
stream_list.push_back(stream.get());
rtc::scoped_refptr<AudioTrackInterface> audio_track(
scoped_refptr<AudioTrackInterface> audio_track(
pc_factory_->CreateAudioTrack("audio_track", nullptr));
rtc::scoped_refptr<VideoTrackInterface> video_track(
pc_factory_->CreateVideoTrack(
"video_track",
pc_factory_->CreateVideoSource(new cricket::FakeVideoCapturer())));
scoped_refptr<VideoTrackInterface> video_track(pc_factory_->CreateVideoTrack(
"video_track",
pc_factory_->CreateVideoSource(new cricket::FakeVideoCapturer())));
auto audio_sender = pc_->AddTrack(audio_track, stream_list);
auto video_sender = pc_->AddTrack(video_track, stream_list);
EXPECT_EQ(1UL, audio_sender->stream_ids().size());
@ -1326,12 +1326,11 @@ TEST_F(PeerConnectionInterfaceTest, AddTrackRemoveTrack) {
TEST_F(PeerConnectionInterfaceTest, AddTrackWithoutStream) {
CreatePeerConnection();
// Create a dummy stream, so tracks share a stream label.
rtc::scoped_refptr<AudioTrackInterface> audio_track(
scoped_refptr<AudioTrackInterface> audio_track(
pc_factory_->CreateAudioTrack("audio_track", nullptr));
rtc::scoped_refptr<VideoTrackInterface> video_track(
pc_factory_->CreateVideoTrack(
"video_track",
pc_factory_->CreateVideoSource(new cricket::FakeVideoCapturer())));
scoped_refptr<VideoTrackInterface> video_track(pc_factory_->CreateVideoTrack(
"video_track",
pc_factory_->CreateVideoSource(new cricket::FakeVideoCapturer())));
auto audio_sender =
pc_->AddTrack(audio_track, std::vector<MediaStreamInterface*>());
auto video_sender =
@ -1490,10 +1489,9 @@ TEST_F(PeerConnectionInterfaceTest, AddTrackAfterAddStream) {
MediaStreamInterface* stream = pc_->local_streams()->at(0);
// Add video track to the audio-only stream.
rtc::scoped_refptr<VideoTrackInterface> video_track(
pc_factory_->CreateVideoTrack(
"video_label",
pc_factory_->CreateVideoSource(new cricket::FakeVideoCapturer())));
scoped_refptr<VideoTrackInterface> video_track(pc_factory_->CreateVideoTrack(
"video_label",
pc_factory_->CreateVideoSource(new cricket::FakeVideoCapturer())));
stream->AddTrack(video_track.get());
std::unique_ptr<SessionDescriptionInterface> offer;
@ -1545,7 +1543,7 @@ TEST_F(PeerConnectionInterfaceTest, GetStatsForSpecificTrack) {
InitiateCall();
ASSERT_LT(0u, pc_->remote_streams()->count());
ASSERT_LT(0u, pc_->remote_streams()->at(0)->GetAudioTracks().size());
rtc::scoped_refptr<MediaStreamTrackInterface> remote_audio =
scoped_refptr<MediaStreamTrackInterface> remote_audio =
pc_->remote_streams()->at(0)->GetAudioTracks()[0];
EXPECT_TRUE(DoGetStats(remote_audio));
@ -1567,7 +1565,7 @@ TEST_F(PeerConnectionInterfaceTest, GetStatsForVideoTrack) {
InitiateCall();
ASSERT_LT(0u, pc_->remote_streams()->count());
ASSERT_LT(0u, pc_->remote_streams()->at(0)->GetVideoTracks().size());
rtc::scoped_refptr<MediaStreamTrackInterface> remote_video =
scoped_refptr<MediaStreamTrackInterface> remote_video =
pc_->remote_streams()->at(0)->GetVideoTracks()[0];
EXPECT_TRUE(DoGetStats(remote_video));
}
@ -1578,7 +1576,7 @@ TEST_F(PeerConnectionInterfaceTest, GetStatsForVideoTrack) {
// data is returned for the track.
TEST_F(PeerConnectionInterfaceTest, DISABLED_GetStatsForInvalidTrack) {
InitiateCall();
rtc::scoped_refptr<AudioTrackInterface> unknown_audio_track(
scoped_refptr<AudioTrackInterface> unknown_audio_track(
pc_factory_->CreateAudioTrack("unknown track", NULL));
EXPECT_FALSE(DoGetStats(unknown_audio_track));
}
@ -1588,9 +1586,9 @@ TEST_F(PeerConnectionInterfaceTest, TestDataChannel) {
FakeConstraints constraints;
constraints.SetAllowRtpDataChannels();
CreatePeerConnection(&constraints);
rtc::scoped_refptr<DataChannelInterface> data1 =
scoped_refptr<DataChannelInterface> data1 =
pc_->CreateDataChannel("test1", NULL);
rtc::scoped_refptr<DataChannelInterface> data2 =
scoped_refptr<DataChannelInterface> data2 =
pc_->CreateDataChannel("test2", NULL);
ASSERT_TRUE(data1 != NULL);
std::unique_ptr<MockDataChannelObserver> observer1(
@ -1635,9 +1633,9 @@ TEST_F(PeerConnectionInterfaceTest, TestSendBinaryOnRtpDataChannel) {
FakeConstraints constraints;
constraints.SetAllowRtpDataChannels();
CreatePeerConnection(&constraints);
rtc::scoped_refptr<DataChannelInterface> data1 =
scoped_refptr<DataChannelInterface> data1 =
pc_->CreateDataChannel("test1", NULL);
rtc::scoped_refptr<DataChannelInterface> data2 =
scoped_refptr<DataChannelInterface> data2 =
pc_->CreateDataChannel("test2", NULL);
ASSERT_TRUE(data1 != NULL);
std::unique_ptr<MockDataChannelObserver> observer1(
@ -1665,7 +1663,7 @@ TEST_F(PeerConnectionInterfaceTest, TestSendOnlyDataChannel) {
FakeConstraints constraints;
constraints.SetAllowRtpDataChannels();
CreatePeerConnection(&constraints);
rtc::scoped_refptr<DataChannelInterface> data1 =
scoped_refptr<DataChannelInterface> data1 =
pc_->CreateDataChannel("test1", NULL);
std::unique_ptr<MockDataChannelObserver> observer1(
new MockDataChannelObserver(data1));
@ -1689,7 +1687,7 @@ TEST_F(PeerConnectionInterfaceTest, TestReceiveOnlyDataChannel) {
CreatePeerConnection(&constraints);
std::string offer_label = "offer_channel";
rtc::scoped_refptr<DataChannelInterface> offer_channel =
scoped_refptr<DataChannelInterface> offer_channel =
pc_->CreateDataChannel(offer_label, NULL);
CreateOfferAsLocalDescription();
@ -1732,7 +1730,7 @@ TEST_F(PeerConnectionInterfaceTest, CreateReliableRtpDataChannelShouldFail) {
std::string label = "test";
webrtc::DataChannelInit config;
config.reliable = true;
rtc::scoped_refptr<DataChannelInterface> channel =
scoped_refptr<DataChannelInterface> channel =
pc_->CreateDataChannel(label, &config);
EXPECT_TRUE(channel == NULL);
}
@ -1744,11 +1742,11 @@ TEST_F(PeerConnectionInterfaceTest, RtpDuplicatedLabelNotAllowed) {
CreatePeerConnection(&constraints);
std::string label = "test";
rtc::scoped_refptr<DataChannelInterface> channel =
scoped_refptr<DataChannelInterface> channel =
pc_->CreateDataChannel(label, nullptr);
EXPECT_NE(channel, nullptr);
rtc::scoped_refptr<DataChannelInterface> dup_channel =
scoped_refptr<DataChannelInterface> dup_channel =
pc_->CreateDataChannel(label, nullptr);
EXPECT_EQ(dup_channel, nullptr);
}
@ -1762,7 +1760,7 @@ TEST_F(PeerConnectionInterfaceTest, CreateSctpDataChannel) {
webrtc::DataChannelInit config;
rtc::scoped_refptr<DataChannelInterface> channel =
scoped_refptr<DataChannelInterface> channel =
pc_->CreateDataChannel("1", &config);
EXPECT_TRUE(channel != NULL);
EXPECT_TRUE(channel->reliable());
@ -1803,7 +1801,7 @@ TEST_F(PeerConnectionInterfaceTest,
config.maxRetransmits = 0;
config.maxRetransmitTime = 0;
rtc::scoped_refptr<DataChannelInterface> channel =
scoped_refptr<DataChannelInterface> channel =
pc_->CreateDataChannel(label, &config);
EXPECT_TRUE(channel == NULL);
}
@ -1817,7 +1815,7 @@ TEST_F(PeerConnectionInterfaceTest,
CreatePeerConnection(&constraints);
webrtc::DataChannelInit config;
rtc::scoped_refptr<DataChannelInterface> channel;
scoped_refptr<DataChannelInterface> channel;
config.id = 1;
channel = pc_->CreateDataChannel("1", &config);
@ -1845,11 +1843,11 @@ TEST_F(PeerConnectionInterfaceTest, SctpDuplicatedLabelAllowed) {
CreatePeerConnection(&constraints);
std::string label = "test";
rtc::scoped_refptr<DataChannelInterface> channel =
scoped_refptr<DataChannelInterface> channel =
pc_->CreateDataChannel(label, nullptr);
EXPECT_NE(channel, nullptr);
rtc::scoped_refptr<DataChannelInterface> dup_channel =
scoped_refptr<DataChannelInterface> dup_channel =
pc_->CreateDataChannel(label, nullptr);
EXPECT_NE(dup_channel, nullptr);
}
@ -1861,12 +1859,12 @@ TEST_F(PeerConnectionInterfaceTest, RenegotiationNeededForNewRtpDataChannel) {
constraints.SetAllowRtpDataChannels();
CreatePeerConnection(&constraints);
rtc::scoped_refptr<DataChannelInterface> dc1 =
scoped_refptr<DataChannelInterface> dc1 =
pc_->CreateDataChannel("test1", NULL);
EXPECT_TRUE(observer_.renegotiation_needed_);
observer_.renegotiation_needed_ = false;
rtc::scoped_refptr<DataChannelInterface> dc2 =
scoped_refptr<DataChannelInterface> dc2 =
pc_->CreateDataChannel("test2", NULL);
EXPECT_TRUE(observer_.renegotiation_needed_);
}
@ -1877,9 +1875,9 @@ TEST_F(PeerConnectionInterfaceTest, DataChannelCloseWhenPeerConnectionClose) {
constraints.SetAllowRtpDataChannels();
CreatePeerConnection(&constraints);
rtc::scoped_refptr<DataChannelInterface> data1 =
scoped_refptr<DataChannelInterface> data1 =
pc_->CreateDataChannel("test1", NULL);
rtc::scoped_refptr<DataChannelInterface> data2 =
scoped_refptr<DataChannelInterface> data2 =
pc_->CreateDataChannel("test2", NULL);
ASSERT_TRUE(data1 != NULL);
std::unique_ptr<MockDataChannelObserver> observer1(
@ -1902,7 +1900,7 @@ TEST_F(PeerConnectionInterfaceTest, TestRejectDataChannelInAnswer) {
constraints.SetAllowRtpDataChannels();
CreatePeerConnection(&constraints);
rtc::scoped_refptr<DataChannelInterface> offer_channel(
scoped_refptr<DataChannelInterface> offer_channel(
pc_->CreateDataChannel("offer_channel", NULL));
CreateOfferAsLocalDescription();
@ -2108,8 +2106,8 @@ TEST_F(PeerConnectionInterfaceTest, CloseAndTestStreamsAndStates) {
EXPECT_EQ(1u, pc_->local_streams()->count());
EXPECT_EQ(1u, pc_->remote_streams()->count());
rtc::scoped_refptr<MediaStreamInterface> remote_stream =
pc_->remote_streams()->at(0);
scoped_refptr<MediaStreamInterface> remote_stream =
pc_->remote_streams()->at(0);
// Track state may be updated asynchronously.
EXPECT_EQ_WAIT(MediaStreamTrackInterface::kEnded,
remote_stream->GetAudioTracks()[0]->state(), kTimeout);
@ -2126,7 +2124,7 @@ TEST_F(PeerConnectionInterfaceTest, CloseAndTestMethods) {
CreateAnswerAsLocalDescription();
ASSERT_EQ(1u, pc_->local_streams()->count());
rtc::scoped_refptr<MediaStreamInterface> local_stream =
scoped_refptr<MediaStreamInterface> local_stream =
pc_->local_streams()->at(0);
pc_->Close();
@ -2219,10 +2217,10 @@ TEST_F(PeerConnectionInterfaceTest,
EXPECT_TRUE(DoSetRemoteDescription(desc_ms1_two_tracks.release()));
EXPECT_TRUE(CompareStreamCollections(observer_.remote_streams(),
reference_collection_));
rtc::scoped_refptr<AudioTrackInterface> audio_track2 =
scoped_refptr<AudioTrackInterface> audio_track2 =
observer_.remote_streams()->at(0)->GetAudioTracks()[1];
EXPECT_EQ(webrtc::MediaStreamTrackInterface::kLive, audio_track2->state());
rtc::scoped_refptr<VideoTrackInterface> video_track2 =
scoped_refptr<VideoTrackInterface> video_track2 =
observer_.remote_streams()->at(0)->GetVideoTracks()[1];
EXPECT_EQ(webrtc::MediaStreamTrackInterface::kLive, video_track2->state());
@ -2643,14 +2641,15 @@ class PeerConnectionMediaConfigTest : public testing::Test {
const MediaConstraintsInterface *constraints) {
pcf_->create_media_controller_called_ = false;
rtc::scoped_refptr<PeerConnectionInterface> pc(pcf_->CreatePeerConnection(
config, constraints, nullptr, nullptr, &observer_));
scoped_refptr<PeerConnectionInterface> pc(
pcf_->CreatePeerConnection(config, constraints, nullptr, nullptr,
&observer_));
EXPECT_TRUE(pc.get());
EXPECT_TRUE(pcf_->create_media_controller_called_);
return pcf_->create_media_controller_config_;
}
rtc::scoped_refptr<PeerConnectionFactoryForTest> pcf_;
scoped_refptr<PeerConnectionFactoryForTest> pcf_;
MockPeerConnectionObserver observer_;
};