Use new TransportController implementation in PeerConnection.
The TransportController will be replaced by the JsepTransportController
and JsepTransport will be replace be JsepTransport2.
The JsepTransportController will take the entire SessionDescription
and handle the RtcpMux, Sdes and BUNDLE internally.
The ownership model is also changed. The P2P layer transports are not
ref-counted and will be owned by the JsepTransport2.
In ORTC aspect, RtpTransportAdapter is now a wrapper over RtpTransport
or SrtpTransport and it implements the public and internal interface
by calling the transport underneath.
Bug: webrtc:8587
Change-Id: Ia7fa61288a566f211f8560072ea0eecaf19e48df
Reviewed-on: https://webrtc-review.googlesource.com/59586
Commit-Queue: Zhi Huang <zhihuang@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22693}
diff --git a/pc/channelmanager.cc b/pc/channelmanager.cc
index ead1da9..e32f56a 100644
--- a/pc/channelmanager.cc
+++ b/pc/channelmanager.cc
@@ -155,48 +155,17 @@
VoiceChannel* ChannelManager::CreateVoiceChannel(
webrtc::Call* call,
const cricket::MediaConfig& media_config,
- DtlsTransportInternal* rtp_transport,
- DtlsTransportInternal* rtcp_transport,
- rtc::Thread* signaling_thread,
- const std::string& content_name,
- bool srtp_required,
- const AudioOptions& options) {
- return worker_thread_->Invoke<VoiceChannel*>(RTC_FROM_HERE, [&] {
- return CreateVoiceChannel_w(
- call, media_config, rtp_transport, rtcp_transport, rtp_transport,
- rtcp_transport, signaling_thread, content_name, srtp_required, options);
- });
-}
-
-VoiceChannel* ChannelManager::CreateVoiceChannel(
- webrtc::Call* call,
- const cricket::MediaConfig& media_config,
- rtc::PacketTransportInternal* rtp_transport,
- rtc::PacketTransportInternal* rtcp_transport,
- rtc::Thread* signaling_thread,
- const std::string& content_name,
- bool srtp_required,
- const AudioOptions& options) {
- return worker_thread_->Invoke<VoiceChannel*>(RTC_FROM_HERE, [&] {
- return CreateVoiceChannel_w(call, media_config, nullptr, nullptr,
- rtp_transport, rtcp_transport, signaling_thread,
- content_name, srtp_required, options);
- });
-}
-
-VoiceChannel* ChannelManager::CreateVoiceChannel(
- webrtc::Call* call,
- const cricket::MediaConfig& media_config,
webrtc::RtpTransportInternal* rtp_transport,
rtc::Thread* signaling_thread,
const std::string& content_name,
bool srtp_required,
+ const rtc::CryptoOptions& crypto_options,
const AudioOptions& options) {
if (!worker_thread_->IsCurrent()) {
return worker_thread_->Invoke<VoiceChannel*>(RTC_FROM_HERE, [&] {
return CreateVoiceChannel(call, media_config, rtp_transport,
signaling_thread, content_name, srtp_required,
- options);
+ crypto_options, options);
});
}
@@ -215,8 +184,8 @@
auto voice_channel = rtc::MakeUnique<VoiceChannel>(
worker_thread_, network_thread_, signaling_thread, media_engine_.get(),
- rtc::WrapUnique(media_channel), content_name,
- rtp_transport->rtcp_packet_transport() == nullptr, srtp_required);
+ rtc::WrapUnique(media_channel), content_name, srtp_required,
+ crypto_options);
voice_channel->Init_w(rtp_transport);
@@ -225,41 +194,6 @@
return voice_channel_ptr;
}
-VoiceChannel* ChannelManager::CreateVoiceChannel_w(
- webrtc::Call* call,
- const cricket::MediaConfig& media_config,
- DtlsTransportInternal* rtp_dtls_transport,
- DtlsTransportInternal* rtcp_dtls_transport,
- rtc::PacketTransportInternal* rtp_packet_transport,
- rtc::PacketTransportInternal* rtcp_packet_transport,
- rtc::Thread* signaling_thread,
- const std::string& content_name,
- bool srtp_required,
- const AudioOptions& options) {
- RTC_DCHECK_RUN_ON(worker_thread_);
- RTC_DCHECK(initialized_);
- RTC_DCHECK(call);
- if (!media_engine_) {
- return nullptr;
- }
-
- VoiceMediaChannel* media_channel = media_engine_->CreateChannel(
- call, media_config, options);
- if (!media_channel) {
- return nullptr;
- }
-
- auto voice_channel = rtc::MakeUnique<VoiceChannel>(
- worker_thread_, network_thread_, signaling_thread, media_engine_.get(),
- rtc::WrapUnique(media_channel), content_name,
- rtcp_packet_transport == nullptr, srtp_required);
- voice_channel->Init_w(rtp_dtls_transport, rtcp_dtls_transport,
- rtp_packet_transport, rtcp_packet_transport);
-
- VoiceChannel* voice_channel_ptr = voice_channel.get();
- voice_channels_.push_back(std::move(voice_channel));
- return voice_channel_ptr;
-}
void ChannelManager::DestroyVoiceChannel(VoiceChannel* voice_channel) {
TRACE_EVENT0("webrtc", "ChannelManager::DestroyVoiceChannel");
@@ -289,48 +223,17 @@
VideoChannel* ChannelManager::CreateVideoChannel(
webrtc::Call* call,
const cricket::MediaConfig& media_config,
- DtlsTransportInternal* rtp_transport,
- DtlsTransportInternal* rtcp_transport,
- rtc::Thread* signaling_thread,
- const std::string& content_name,
- bool srtp_required,
- const VideoOptions& options) {
- return worker_thread_->Invoke<VideoChannel*>(RTC_FROM_HERE, [&] {
- return CreateVideoChannel_w(
- call, media_config, rtp_transport, rtcp_transport, rtp_transport,
- rtcp_transport, signaling_thread, content_name, srtp_required, options);
- });
-}
-
-VideoChannel* ChannelManager::CreateVideoChannel(
- webrtc::Call* call,
- const cricket::MediaConfig& media_config,
- rtc::PacketTransportInternal* rtp_transport,
- rtc::PacketTransportInternal* rtcp_transport,
- rtc::Thread* signaling_thread,
- const std::string& content_name,
- bool srtp_required,
- const VideoOptions& options) {
- return worker_thread_->Invoke<VideoChannel*>(RTC_FROM_HERE, [&] {
- return CreateVideoChannel_w(call, media_config, nullptr, nullptr,
- rtp_transport, rtcp_transport, signaling_thread,
- content_name, srtp_required, options);
- });
-}
-
-VideoChannel* ChannelManager::CreateVideoChannel(
- webrtc::Call* call,
- const cricket::MediaConfig& media_config,
webrtc::RtpTransportInternal* rtp_transport,
rtc::Thread* signaling_thread,
const std::string& content_name,
bool srtp_required,
+ const rtc::CryptoOptions& crypto_options,
const VideoOptions& options) {
if (!worker_thread_->IsCurrent()) {
return worker_thread_->Invoke<VideoChannel*>(RTC_FROM_HERE, [&] {
return CreateVideoChannel(call, media_config, rtp_transport,
signaling_thread, content_name, srtp_required,
- options);
+ crypto_options, options);
});
}
@@ -349,8 +252,8 @@
auto video_channel = rtc::MakeUnique<VideoChannel>(
worker_thread_, network_thread_, signaling_thread,
- rtc::WrapUnique(media_channel), content_name,
- rtp_transport->rtcp_packet_transport() == nullptr, srtp_required);
+ rtc::WrapUnique(media_channel), content_name, srtp_required,
+ crypto_options);
video_channel->Init_w(rtp_transport);
VideoChannel* video_channel_ptr = video_channel.get();
@@ -358,41 +261,7 @@
return video_channel_ptr;
}
-VideoChannel* ChannelManager::CreateVideoChannel_w(
- webrtc::Call* call,
- const cricket::MediaConfig& media_config,
- DtlsTransportInternal* rtp_dtls_transport,
- DtlsTransportInternal* rtcp_dtls_transport,
- rtc::PacketTransportInternal* rtp_packet_transport,
- rtc::PacketTransportInternal* rtcp_packet_transport,
- rtc::Thread* signaling_thread,
- const std::string& content_name,
- bool srtp_required,
- const VideoOptions& options) {
- RTC_DCHECK_RUN_ON(worker_thread_);
- RTC_DCHECK(initialized_);
- RTC_DCHECK(call);
- if (!media_engine_) {
- return nullptr;
- }
- VideoMediaChannel* media_channel = media_engine_->CreateVideoChannel(
- call, media_config, options);
- if (!media_channel) {
- return nullptr;
- }
-
- auto video_channel = rtc::MakeUnique<VideoChannel>(
- worker_thread_, network_thread_, signaling_thread,
- rtc::WrapUnique(media_channel), content_name,
- rtcp_packet_transport == nullptr, srtp_required);
- video_channel->Init_w(rtp_dtls_transport, rtcp_dtls_transport,
- rtp_packet_transport, rtcp_packet_transport);
-
- VideoChannel* video_channel_ptr = video_channel.get();
- video_channels_.push_back(std::move(video_channel));
- return video_channel_ptr;
-}
void ChannelManager::DestroyVideoChannel(VideoChannel* video_channel) {
TRACE_EVENT0("webrtc", "ChannelManager::DestroyVideoChannel");
@@ -421,49 +290,15 @@
RtpDataChannel* ChannelManager::CreateRtpDataChannel(
const cricket::MediaConfig& media_config,
- DtlsTransportInternal* rtp_transport,
- DtlsTransportInternal* rtcp_transport,
- rtc::Thread* signaling_thread,
- const std::string& content_name,
- bool srtp_required) {
- if (!worker_thread_->IsCurrent()) {
- return worker_thread_->Invoke<RtpDataChannel*>(RTC_FROM_HERE, [&] {
- return CreateRtpDataChannel(media_config, rtp_transport, rtcp_transport,
- signaling_thread, content_name,
- srtp_required);
- });
- }
-
- // This is ok to alloc from a thread other than the worker thread.
- RTC_DCHECK(initialized_);
- DataMediaChannel* media_channel = data_engine_->CreateChannel(media_config);
- if (!media_channel) {
- RTC_LOG(LS_WARNING) << "Failed to create RTP data channel.";
- return nullptr;
- }
-
- auto data_channel = rtc::MakeUnique<RtpDataChannel>(
- worker_thread_, network_thread_, signaling_thread,
- rtc::WrapUnique(media_channel), content_name, rtcp_transport == nullptr,
- srtp_required);
- data_channel->Init_w(rtp_transport, rtcp_transport, rtp_transport,
- rtcp_transport);
-
- RtpDataChannel* data_channel_ptr = data_channel.get();
- data_channels_.push_back(std::move(data_channel));
- return data_channel_ptr;
-}
-
-RtpDataChannel* ChannelManager::CreateRtpDataChannel(
- const cricket::MediaConfig& media_config,
webrtc::RtpTransportInternal* rtp_transport,
rtc::Thread* signaling_thread,
const std::string& content_name,
- bool srtp_required) {
+ bool srtp_required,
+ const rtc::CryptoOptions& crypto_options) {
if (!worker_thread_->IsCurrent()) {
return worker_thread_->Invoke<RtpDataChannel*>(RTC_FROM_HERE, [&] {
return CreateRtpDataChannel(media_config, rtp_transport, signaling_thread,
- content_name, srtp_required);
+ content_name, srtp_required, crypto_options);
});
}
@@ -477,8 +312,8 @@
auto data_channel = rtc::MakeUnique<RtpDataChannel>(
worker_thread_, network_thread_, signaling_thread,
- rtc::WrapUnique(media_channel), content_name,
- rtp_transport->rtcp_packet_transport() == nullptr, srtp_required);
+ rtc::WrapUnique(media_channel), content_name, srtp_required,
+ crypto_options);
data_channel->Init_w(rtp_transport);
RtpDataChannel* data_channel_ptr = data_channel.get();