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

Unified Diff: talk/media/webrtc/webrtcvideoengine2.cc

Issue 1269863005: MediaController/Call instantiation. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Remove redundant reset(nullptr) Created 5 years, 3 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 | « talk/media/webrtc/webrtcvideoengine2.h ('k') | talk/media/webrtc/webrtcvideoengine2_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: talk/media/webrtc/webrtcvideoengine2.cc
diff --git a/talk/media/webrtc/webrtcvideoengine2.cc b/talk/media/webrtc/webrtcvideoengine2.cc
index 917efc8c50c8c1bb516ef441329104c931d07080..cde449e26230e45e68d321f7d787e61c1328a994 100644
--- a/talk/media/webrtc/webrtcvideoengine2.cc
+++ b/talk/media/webrtc/webrtcvideoengine2.cc
@@ -340,10 +340,6 @@ static const int kDefaultQpMax = 56;
static const int kDefaultRtcpReceiverReportSsrc = 1;
-const int kMinBandwidthBps = 30000;
-const int kStartBandwidthBps = 300000;
-const int kMaxBandwidthBps = 2000000;
-
std::vector<VideoCodec> DefaultVideoCodecList() {
std::vector<VideoCodec> codecs;
if (CodecIsInternallySupported(kVp9CodecName)) {
@@ -537,13 +533,6 @@ UnsignalledSsrcHandler::Action DefaultUnsignalledSsrcHandler::OnUnsignalledSsrc(
return kDeliverPacket;
}
-WebRtcCallFactory::~WebRtcCallFactory() {
-}
-webrtc::Call* WebRtcCallFactory::CreateCall(
- const webrtc::Call::Config& config) {
- return webrtc::Call::Create(config);
-}
-
VideoRenderer* DefaultUnsignalledSsrcHandler::GetDefaultRenderer() const {
return default_renderer_;
}
@@ -557,10 +546,8 @@ void DefaultUnsignalledSsrcHandler::SetDefaultRenderer(
}
}
-WebRtcVideoEngine2::WebRtcVideoEngine2(WebRtcVoiceEngine* voice_engine)
- : voice_engine_(voice_engine),
- initialized_(false),
- call_factory_(&default_call_factory_),
+WebRtcVideoEngine2::WebRtcVideoEngine2()
+ : initialized_(false),
external_decoder_factory_(NULL),
external_encoder_factory_(NULL) {
LOG(LS_INFO) << "WebRtcVideoEngine2::WebRtcVideoEngine2()";
@@ -580,11 +567,6 @@ WebRtcVideoEngine2::~WebRtcVideoEngine2() {
LOG(LS_INFO) << "WebRtcVideoEngine2::~WebRtcVideoEngine2";
}
-void WebRtcVideoEngine2::SetCallFactory(WebRtcCallFactory* call_factory) {
- DCHECK(!initialized_);
- call_factory_ = call_factory;
-}
-
void WebRtcVideoEngine2::Init() {
LOG(LS_INFO) << "WebRtcVideoEngine2::Init";
initialized_ = true;
@@ -616,20 +598,12 @@ bool WebRtcVideoEngine2::SetDefaultEncoderConfig(
}
WebRtcVideoChannel2* WebRtcVideoEngine2::CreateChannel(
- const VideoOptions& options,
- VoiceMediaChannel* voice_channel) {
+ webrtc::Call* call,
+ const VideoOptions& options) {
DCHECK(initialized_);
- LOG(LS_INFO) << "CreateChannel: "
- << (voice_channel != NULL ? "With" : "Without")
- << " voice channel. Options: " << options.ToString();
- WebRtcVideoChannel2* channel =
- new WebRtcVideoChannel2(call_factory_, voice_engine_,
- static_cast<WebRtcVoiceMediaChannel*>(voice_channel), options,
- external_encoder_factory_, external_decoder_factory_);
- if (!channel->Init()) {
- delete channel;
- return NULL;
- }
+ LOG(LS_INFO) << "CreateChannel. Options: " << options.ToString();
+ WebRtcVideoChannel2* channel = new WebRtcVideoChannel2(call, options,
+ external_encoder_factory_, external_decoder_factory_);
channel->SetRecvCodecs(video_codecs_);
return channel;
}
@@ -788,32 +762,18 @@ std::vector<VideoCodec> WebRtcVideoEngine2::GetSupportedCodecs() const {
}
WebRtcVideoChannel2::WebRtcVideoChannel2(
- WebRtcCallFactory* call_factory,
- WebRtcVoiceEngine* voice_engine,
- WebRtcVoiceMediaChannel* voice_channel,
+ webrtc::Call* call,
const VideoOptions& options,
WebRtcVideoEncoderFactory* external_encoder_factory,
WebRtcVideoDecoderFactory* external_decoder_factory)
- : unsignalled_ssrc_handler_(&default_unsignalled_ssrc_handler_),
- voice_channel_(voice_channel),
- voice_channel_id_(voice_channel ? voice_channel->voe_channel() : -1),
+ : call_(call),
+ unsignalled_ssrc_handler_(&default_unsignalled_ssrc_handler_),
external_encoder_factory_(external_encoder_factory),
external_decoder_factory_(external_decoder_factory) {
DCHECK(thread_checker_.CalledOnValidThread());
SetDefaultOptions();
options_.SetAll(options);
options_.cpu_overuse_detection.Get(&signal_cpu_adaptation_);
- webrtc::Call::Config config;
- if (voice_engine != NULL) {
- config.voice_engine = voice_engine->voe()->engine();
- }
- config.bitrate_config.min_bitrate_bps = kMinBandwidthBps;
- config.bitrate_config.start_bitrate_bps = kStartBandwidthBps;
- config.bitrate_config.max_bitrate_bps = kMaxBandwidthBps;
- call_.reset(call_factory->CreateCall(config));
- if (voice_channel_) {
- voice_channel_->SetCall(call_.get());
- }
rtcp_receiver_report_ssrc_ = kDefaultRtcpReceiverReportSsrc;
sending_ = false;
default_send_ssrc_ = 0;
@@ -828,23 +788,12 @@ void WebRtcVideoChannel2::SetDefaultOptions() {
}
WebRtcVideoChannel2::~WebRtcVideoChannel2() {
- DetachVoiceChannel();
for (auto& kv : send_streams_)
delete kv.second;
for (auto& kv : receive_streams_)
delete kv.second;
}
-bool WebRtcVideoChannel2::Init() { return true; }
-
-void WebRtcVideoChannel2::DetachVoiceChannel() {
- DCHECK(thread_checker_.CalledOnValidThread());
- if (voice_channel_) {
- voice_channel_->SetCall(nullptr);
- voice_channel_ = nullptr;
- }
-}
-
bool WebRtcVideoChannel2::CodecIsExternallySupported(
const std::string& name) const {
if (external_encoder_factory_ == NULL) {
@@ -1149,7 +1098,7 @@ bool WebRtcVideoChannel2::AddSendStream(const StreamParams& sp) {
config.overuse_callback = this;
WebRtcVideoSendStream* stream =
- new WebRtcVideoSendStream(call_.get(),
+ new WebRtcVideoSendStream(call_,
sp,
config,
external_encoder_factory_,
@@ -1272,7 +1221,7 @@ bool WebRtcVideoChannel2::AddRecvStream(const StreamParams& sp,
}
receive_streams_[ssrc] = new WebRtcVideoReceiveStream(
- call_.get(), sp, config, external_decoder_factory_, default_stream,
+ call_, sp, config, external_decoder_factory_, default_stream,
recv_codecs_);
return true;
« no previous file with comments | « talk/media/webrtc/webrtcvideoengine2.h ('k') | talk/media/webrtc/webrtcvideoengine2_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698