Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(773)

Unified Diff: webrtc/pc/channelmanager.cc

Issue 2614813003: Revert of Separating SCTP code from BaseChannel/MediaChannel. (Closed)
Patch Set: Also reverting https://codereview.webrtc.org/2612963002 Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/pc/channelmanager.h ('k') | webrtc/pc/channelmanager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/pc/channelmanager.cc
diff --git a/webrtc/pc/channelmanager.cc b/webrtc/pc/channelmanager.cc
index cdfed68bb6bbd7f98b70c2f13a5bec3da48f4e57..a0b3609ecfc89ee61f733082528514007348170a 100644
--- a/webrtc/pc/channelmanager.cc
+++ b/webrtc/pc/channelmanager.cc
@@ -20,7 +20,11 @@
#include "webrtc/base/stringutils.h"
#include "webrtc/base/trace_event.h"
#include "webrtc/media/base/device.h"
+#include "webrtc/media/base/hybriddataengine.h"
#include "webrtc/media/base/rtpdataengine.h"
+#ifdef HAVE_SCTP
+#include "webrtc/media/sctp/sctpdataengine.h"
+#endif
#include "webrtc/pc/srtpfilter.h"
namespace cricket {
@@ -29,7 +33,11 @@ namespace cricket {
using rtc::Bind;
static DataEngineInterface* ConstructDataEngine() {
+#ifdef HAVE_SCTP
+ return new HybridDataEngine(new RtpDataEngine(), new SctpDataEngine());
+#else
return new RtpDataEngine();
+#endif
}
ChannelManager::ChannelManager(MediaEngineInterface* me,
@@ -336,66 +344,73 @@ void ChannelManager::DestroyVideoChannel_w(VideoChannel* video_channel) {
delete video_channel;
}
-RtpDataChannel* ChannelManager::CreateRtpDataChannel(
+DataChannel* ChannelManager::CreateDataChannel(
webrtc::MediaControllerInterface* media_controller,
TransportController* transport_controller,
const std::string& content_name,
const std::string* bundle_transport_name,
bool rtcp,
- bool srtp_required) {
- return worker_thread_->Invoke<RtpDataChannel*>(
- RTC_FROM_HERE, Bind(&ChannelManager::CreateRtpDataChannel_w, this,
- media_controller, transport_controller, content_name,
- bundle_transport_name, rtcp, srtp_required));
+ bool srtp_required,
+ DataChannelType channel_type) {
+ return worker_thread_->Invoke<DataChannel*>(
+ RTC_FROM_HERE,
+ Bind(&ChannelManager::CreateDataChannel_w, this, media_controller,
+ transport_controller, content_name, bundle_transport_name, rtcp,
+ srtp_required, channel_type));
}
-RtpDataChannel* ChannelManager::CreateRtpDataChannel_w(
+DataChannel* ChannelManager::CreateDataChannel_w(
webrtc::MediaControllerInterface* media_controller,
TransportController* transport_controller,
const std::string& content_name,
const std::string* bundle_transport_name,
bool rtcp,
- bool srtp_required) {
+ bool srtp_required,
+ DataChannelType data_channel_type) {
// This is ok to alloc from a thread other than the worker thread.
ASSERT(initialized_);
MediaConfig config;
if (media_controller) {
config = media_controller->config();
}
- DataMediaChannel* media_channel = data_media_engine_->CreateChannel(config);
+ DataMediaChannel* media_channel =
+ data_media_engine_->CreateChannel(data_channel_type, config);
if (!media_channel) {
- LOG(LS_WARNING) << "Failed to create RTP data channel.";
- return nullptr;
+ LOG(LS_WARNING) << "Failed to create data channel of type "
+ << data_channel_type;
+ return NULL;
}
- RtpDataChannel* data_channel = new RtpDataChannel(
- worker_thread_, network_thread_, media_channel, transport_controller,
- content_name, rtcp, srtp_required);
+ // Only RTP data channels need SRTP.
+ srtp_required = srtp_required && data_channel_type == DCT_RTP;
+ DataChannel* data_channel =
+ new DataChannel(worker_thread_, network_thread_, media_channel,
+ transport_controller, content_name, rtcp, srtp_required);
data_channel->SetCryptoOptions(crypto_options_);
if (!data_channel->Init_w(bundle_transport_name)) {
LOG(LS_WARNING) << "Failed to init data channel.";
delete data_channel;
- return nullptr;
+ return NULL;
}
data_channels_.push_back(data_channel);
return data_channel;
}
-void ChannelManager::DestroyRtpDataChannel(RtpDataChannel* data_channel) {
- TRACE_EVENT0("webrtc", "ChannelManager::DestroyRtpDataChannel");
+void ChannelManager::DestroyDataChannel(DataChannel* data_channel) {
+ TRACE_EVENT0("webrtc", "ChannelManager::DestroyDataChannel");
if (data_channel) {
worker_thread_->Invoke<void>(
RTC_FROM_HERE,
- Bind(&ChannelManager::DestroyRtpDataChannel_w, this, data_channel));
+ Bind(&ChannelManager::DestroyDataChannel_w, this, data_channel));
}
}
-void ChannelManager::DestroyRtpDataChannel_w(RtpDataChannel* data_channel) {
- TRACE_EVENT0("webrtc", "ChannelManager::DestroyRtpDataChannel_w");
+void ChannelManager::DestroyDataChannel_w(DataChannel* data_channel) {
+ TRACE_EVENT0("webrtc", "ChannelManager::DestroyDataChannel_w");
// Destroy data channel.
ASSERT(initialized_);
- RtpDataChannels::iterator it =
- std::find(data_channels_.begin(), data_channels_.end(), data_channel);
+ DataChannels::iterator it = std::find(data_channels_.begin(),
+ data_channels_.end(), data_channel);
ASSERT(it != data_channels_.end());
if (it == data_channels_.end())
return;
« no previous file with comments | « webrtc/pc/channelmanager.h ('k') | webrtc/pc/channelmanager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698