2013-07-10 00:45:36 +00:00
|
|
|
/*
|
2016-02-10 07:54:43 -08:00
|
|
|
* Copyright 2004 The WebRTC project authors. All Rights Reserved.
|
2013-07-10 00:45:36 +00:00
|
|
|
*
|
2016-02-10 07:54:43 -08:00
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
2013-07-10 00:45:36 +00:00
|
|
|
*/
|
|
|
|
|
|
2019-01-11 09:11:00 -08:00
|
|
|
#include "pc/peer_connection_factory.h"
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2019-04-10 13:48:24 +02:00
|
|
|
#include <memory>
|
2015-12-17 03:04:15 -08:00
|
|
|
#include <utility>
|
|
|
|
|
|
2020-04-01 12:03:11 +02:00
|
|
|
#include "absl/strings/match.h"
|
2020-10-20 15:35:31 +00:00
|
|
|
#include "api/async_resolver_factory.h"
|
|
|
|
|
#include "api/call/call_factory_interface.h"
|
Revert "Revert "Enables PeerConnectionFactory using external fec controller""
This reverts commit 00733015fafbbc61ddc12dfdc88b21a9fcd9d122.
Reason for revert: The reason for a downstream test failure on the original commit and a workaround has been found. Solution is to keep a PeerConnectionFactory constructor implementation as the same as before.
Original change's description:
> Revert "Enables PeerConnectionFactory using external fec controller"
>
> This reverts commit 4f07bdb25567d8ef528311e0b50a62c61d543fc3.
>
> Reason for revert: Speculatively reverting, because downstream test is now hitting "PeerConnectionFactory.initialize was not called before creating a PeerConnectionFactory" error, even though it did call initialize. I don't see how any change in this CL could cause that, but it's the only CL on the blamelist, and it does modify PeerConnectionFactory.java
>
> Original change's description:
> > Enables PeerConnectionFactory using external fec controller
> >
> > Bug: webrtc:8799
> > Change-Id: Ieb2cf6163b9a83844ab9ed4822b4a7f1db4c24b8
> > Reviewed-on: https://webrtc-review.googlesource.com/43961
> > Commit-Queue: Ying Wang <yinwa@webrtc.org>
> > Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> > Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> > Reviewed-by: Niels Moller <nisse@webrtc.org>
> > Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#22038}
>
> TBR=sakal@webrtc.org,kwiberg@webrtc.org,nisse@webrtc.org,stefan@webrtc.org,yinwa@webrtc.org
>
> Change-Id: I95868c35d6f9973e0ebf563814cd71d0fcbd433d
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: webrtc:8799
> Reviewed-on: https://webrtc-review.googlesource.com/54080
> Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
> Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#22040}
TBR=deadbeef@webrtc.org,sakal@webrtc.org,kwiberg@webrtc.org,nisse@webrtc.org,stefan@webrtc.org,yinwa@webrtc.org
Bug: webrtc:8799
Change-Id: If9f3292bfcc739782967530c49f006d0abbc38a8
Reviewed-on: https://webrtc-review.googlesource.com/55400
Commit-Queue: Ying Wang <yinwa@webrtc.org>
Reviewed-by: Ying Wang <yinwa@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22100}
2018-02-20 12:50:27 +01:00
|
|
|
#include "api/fec_controller.h"
|
2020-10-20 15:35:31 +00:00
|
|
|
#include "api/ice_transport_interface.h"
|
2019-04-10 13:48:24 +02:00
|
|
|
#include "api/network_state_predictor.h"
|
2020-10-20 15:35:31 +00:00
|
|
|
#include "api/packet_socket_factory.h"
|
2019-08-07 12:24:53 +02:00
|
|
|
#include "api/rtc_event_log/rtc_event_log.h"
|
2021-02-10 14:31:24 +01:00
|
|
|
#include "api/sequence_checker.h"
|
2020-10-20 15:35:31 +00:00
|
|
|
#include "api/transport/bitrate_settings.h"
|
2019-08-13 10:48:48 +02:00
|
|
|
#include "api/units/data_rate.h"
|
2020-10-20 15:35:31 +00:00
|
|
|
#include "call/audio_state.h"
|
2021-05-31 14:02:28 +02:00
|
|
|
#include "call/rtp_transport_controller_send_factory.h"
|
2020-10-20 15:35:31 +00:00
|
|
|
#include "media/base/media_engine.h"
|
2020-01-06 14:31:57 -08:00
|
|
|
#include "p2p/base/basic_async_resolver_factory.h"
|
2019-01-11 09:11:00 -08:00
|
|
|
#include "p2p/base/basic_packet_socket_factory.h"
|
2019-11-15 12:33:05 -08:00
|
|
|
#include "p2p/base/default_ice_transport_factory.h"
|
2021-05-09 14:58:57 +00:00
|
|
|
#include "p2p/base/port_allocator.h"
|
2019-01-11 09:11:00 -08:00
|
|
|
#include "p2p/client/basic_port_allocator.h"
|
|
|
|
|
#include "pc/audio_track.h"
|
|
|
|
|
#include "pc/local_audio_source.h"
|
|
|
|
|
#include "pc/media_stream.h"
|
2021-05-26 18:56:30 +02:00
|
|
|
#include "pc/media_stream_proxy.h"
|
|
|
|
|
#include "pc/media_stream_track_proxy.h"
|
2019-01-11 09:11:00 -08:00
|
|
|
#include "pc/peer_connection.h"
|
2021-05-26 18:56:30 +02:00
|
|
|
#include "pc/peer_connection_factory_proxy.h"
|
|
|
|
|
#include "pc/peer_connection_proxy.h"
|
2019-04-10 13:48:24 +02:00
|
|
|
#include "pc/rtp_parameters_conversion.h"
|
2020-10-20 15:35:31 +00:00
|
|
|
#include "pc/session_description.h"
|
2019-01-11 09:11:00 -08:00
|
|
|
#include "pc/video_track.h"
|
2019-04-10 13:48:24 +02:00
|
|
|
#include "rtc_base/checks.h"
|
2019-08-13 10:48:48 +02:00
|
|
|
#include "rtc_base/experiments/field_trial_parser.h"
|
|
|
|
|
#include "rtc_base/experiments/field_trial_units.h"
|
2020-10-20 15:35:31 +00:00
|
|
|
#include "rtc_base/location.h"
|
|
|
|
|
#include "rtc_base/logging.h"
|
2019-08-13 10:48:48 +02:00
|
|
|
#include "rtc_base/numerics/safe_conversions.h"
|
2020-10-20 15:35:31 +00:00
|
|
|
#include "rtc_base/ref_counted_object.h"
|
2021-05-09 14:58:57 +00:00
|
|
|
#include "rtc_base/rtc_certificate_generator.h"
|
2019-06-11 14:04:16 +02:00
|
|
|
#include "rtc_base/system/file_wrapper.h"
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
2017-01-31 01:48:08 -08:00
|
|
|
rtc::scoped_refptr<PeerConnectionFactoryInterface>
|
2018-05-29 15:04:32 -07:00
|
|
|
CreateModularPeerConnectionFactory(
|
|
|
|
|
PeerConnectionFactoryDependencies dependencies) {
|
2020-10-20 15:35:31 +00:00
|
|
|
// The PeerConnectionFactory must be created on the signaling thread.
|
|
|
|
|
if (dependencies.signaling_thread &&
|
|
|
|
|
!dependencies.signaling_thread->IsCurrent()) {
|
|
|
|
|
return dependencies.signaling_thread
|
|
|
|
|
->Invoke<rtc::scoped_refptr<PeerConnectionFactoryInterface>>(
|
|
|
|
|
RTC_FROM_HERE, [&dependencies] {
|
|
|
|
|
return CreateModularPeerConnectionFactory(
|
|
|
|
|
std::move(dependencies));
|
|
|
|
|
});
|
|
|
|
|
}
|
2016-12-13 14:06:26 -08:00
|
|
|
|
2020-10-20 15:35:31 +00:00
|
|
|
auto pc_factory = PeerConnectionFactory::Create(std::move(dependencies));
|
|
|
|
|
if (!pc_factory) {
|
2016-12-13 14:06:26 -08:00
|
|
|
return nullptr;
|
|
|
|
|
}
|
2020-10-20 15:35:31 +00:00
|
|
|
// Verify that the invocation and the initialization ended up agreeing on the
|
|
|
|
|
// thread.
|
|
|
|
|
RTC_DCHECK_RUN_ON(pc_factory->signaling_thread());
|
2021-04-01 19:14:54 +02:00
|
|
|
return PeerConnectionFactoryProxy::Create(
|
|
|
|
|
pc_factory->signaling_thread(), pc_factory->worker_thread(), pc_factory);
|
2017-01-31 01:48:08 -08:00
|
|
|
}
|
|
|
|
|
|
2020-10-20 15:35:31 +00:00
|
|
|
// Static
|
|
|
|
|
rtc::scoped_refptr<PeerConnectionFactory> PeerConnectionFactory::Create(
|
|
|
|
|
PeerConnectionFactoryDependencies dependencies) {
|
|
|
|
|
auto context = ConnectionContext::Create(&dependencies);
|
|
|
|
|
if (!context) {
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
2021-04-27 14:43:08 +02:00
|
|
|
return rtc::make_ref_counted<PeerConnectionFactory>(context, &dependencies);
|
2020-10-20 15:35:31 +00:00
|
|
|
}
|
|
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
PeerConnectionFactory::PeerConnectionFactory(
|
2020-10-20 15:35:31 +00:00
|
|
|
rtc::scoped_refptr<ConnectionContext> context,
|
|
|
|
|
PeerConnectionFactoryDependencies* dependencies)
|
|
|
|
|
: context_(context),
|
|
|
|
|
task_queue_factory_(std::move(dependencies->task_queue_factory)),
|
|
|
|
|
event_log_factory_(std::move(dependencies->event_log_factory)),
|
|
|
|
|
fec_controller_factory_(std::move(dependencies->fec_controller_factory)),
|
2019-04-10 13:48:24 +02:00
|
|
|
network_state_predictor_factory_(
|
2020-10-20 15:35:31 +00:00
|
|
|
std::move(dependencies->network_state_predictor_factory)),
|
2018-05-18 18:05:10 +02:00
|
|
|
injected_network_controller_factory_(
|
2020-10-20 15:35:31 +00:00
|
|
|
std::move(dependencies->network_controller_factory)),
|
2021-05-31 14:02:28 +02:00
|
|
|
neteq_factory_(std::move(dependencies->neteq_factory)),
|
|
|
|
|
transport_controller_send_factory_(
|
|
|
|
|
(dependencies->transport_controller_send_factory)
|
|
|
|
|
? std::move(dependencies->transport_controller_send_factory)
|
|
|
|
|
: std::make_unique<RtpTransportControllerSendFactory>()) {}
|
2020-10-20 15:35:31 +00:00
|
|
|
|
|
|
|
|
PeerConnectionFactory::PeerConnectionFactory(
|
|
|
|
|
PeerConnectionFactoryDependencies dependencies)
|
|
|
|
|
: PeerConnectionFactory(ConnectionContext::Create(&dependencies),
|
|
|
|
|
&dependencies) {}
|
2018-05-29 15:04:32 -07:00
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
PeerConnectionFactory::~PeerConnectionFactory() {
|
2020-10-15 08:34:31 +00:00
|
|
|
RTC_DCHECK_RUN_ON(signaling_thread());
|
2013-07-10 00:45:36 +00:00
|
|
|
}
|
|
|
|
|
|
2016-08-04 05:20:32 -07:00
|
|
|
void PeerConnectionFactory::SetOptions(const Options& options) {
|
2020-11-04 10:34:21 +00:00
|
|
|
RTC_DCHECK_RUN_ON(signaling_thread());
|
|
|
|
|
options_ = options;
|
2016-08-04 05:20:32 -07:00
|
|
|
}
|
|
|
|
|
|
2018-06-28 14:09:33 +02:00
|
|
|
RtpCapabilities PeerConnectionFactory::GetRtpSenderCapabilities(
|
|
|
|
|
cricket::MediaType kind) const {
|
2020-10-15 08:34:31 +00:00
|
|
|
RTC_DCHECK_RUN_ON(signaling_thread());
|
2018-06-28 14:09:33 +02:00
|
|
|
switch (kind) {
|
|
|
|
|
case cricket::MEDIA_TYPE_AUDIO: {
|
|
|
|
|
cricket::AudioCodecs cricket_codecs;
|
2020-10-15 08:34:31 +00:00
|
|
|
channel_manager()->GetSupportedAudioSendCodecs(&cricket_codecs);
|
2020-03-16 13:40:51 +01:00
|
|
|
return ToRtpCapabilities(
|
|
|
|
|
cricket_codecs,
|
2020-10-15 08:34:31 +00:00
|
|
|
channel_manager()->GetDefaultEnabledAudioRtpHeaderExtensions());
|
2018-06-28 14:09:33 +02:00
|
|
|
}
|
|
|
|
|
case cricket::MEDIA_TYPE_VIDEO: {
|
|
|
|
|
cricket::VideoCodecs cricket_codecs;
|
2020-10-15 08:34:31 +00:00
|
|
|
channel_manager()->GetSupportedVideoSendCodecs(&cricket_codecs);
|
2020-03-16 13:40:51 +01:00
|
|
|
return ToRtpCapabilities(
|
|
|
|
|
cricket_codecs,
|
2020-10-15 08:34:31 +00:00
|
|
|
channel_manager()->GetDefaultEnabledVideoRtpHeaderExtensions());
|
2018-06-28 14:09:33 +02:00
|
|
|
}
|
|
|
|
|
case cricket::MEDIA_TYPE_DATA:
|
|
|
|
|
return RtpCapabilities();
|
2020-10-13 12:43:15 +02:00
|
|
|
case cricket::MEDIA_TYPE_UNSUPPORTED:
|
|
|
|
|
return RtpCapabilities();
|
2018-06-28 14:09:33 +02:00
|
|
|
}
|
2021-05-19 16:17:04 +00:00
|
|
|
RTC_DLOG(LS_ERROR) << "Got unexpected MediaType " << kind;
|
2020-11-08 00:49:37 +01:00
|
|
|
RTC_CHECK_NOTREACHED();
|
2018-06-28 14:09:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RtpCapabilities PeerConnectionFactory::GetRtpReceiverCapabilities(
|
|
|
|
|
cricket::MediaType kind) const {
|
2020-10-15 08:34:31 +00:00
|
|
|
RTC_DCHECK_RUN_ON(signaling_thread());
|
2018-06-28 14:09:33 +02:00
|
|
|
switch (kind) {
|
|
|
|
|
case cricket::MEDIA_TYPE_AUDIO: {
|
|
|
|
|
cricket::AudioCodecs cricket_codecs;
|
2020-10-15 08:34:31 +00:00
|
|
|
channel_manager()->GetSupportedAudioReceiveCodecs(&cricket_codecs);
|
2020-03-16 13:40:51 +01:00
|
|
|
return ToRtpCapabilities(
|
|
|
|
|
cricket_codecs,
|
2020-10-15 08:34:31 +00:00
|
|
|
channel_manager()->GetDefaultEnabledAudioRtpHeaderExtensions());
|
2018-06-28 14:09:33 +02:00
|
|
|
}
|
|
|
|
|
case cricket::MEDIA_TYPE_VIDEO: {
|
|
|
|
|
cricket::VideoCodecs cricket_codecs;
|
2020-10-15 08:34:31 +00:00
|
|
|
channel_manager()->GetSupportedVideoReceiveCodecs(&cricket_codecs);
|
2020-03-16 13:40:51 +01:00
|
|
|
return ToRtpCapabilities(
|
|
|
|
|
cricket_codecs,
|
2020-10-15 08:34:31 +00:00
|
|
|
channel_manager()->GetDefaultEnabledVideoRtpHeaderExtensions());
|
2018-06-28 14:09:33 +02:00
|
|
|
}
|
|
|
|
|
case cricket::MEDIA_TYPE_DATA:
|
|
|
|
|
return RtpCapabilities();
|
2020-10-13 12:43:15 +02:00
|
|
|
case cricket::MEDIA_TYPE_UNSUPPORTED:
|
|
|
|
|
return RtpCapabilities();
|
2018-06-28 14:09:33 +02:00
|
|
|
}
|
2021-05-19 16:17:04 +00:00
|
|
|
RTC_DLOG(LS_ERROR) << "Got unexpected MediaType " << kind;
|
2020-11-08 00:49:37 +01:00
|
|
|
RTC_CHECK_NOTREACHED();
|
2018-06-28 14:09:33 +02:00
|
|
|
}
|
|
|
|
|
|
2014-07-29 17:36:52 +00:00
|
|
|
rtc::scoped_refptr<AudioSourceInterface>
|
2016-03-04 02:51:39 -08:00
|
|
|
PeerConnectionFactory::CreateAudioSource(const cricket::AudioOptions& options) {
|
2020-10-15 08:34:31 +00:00
|
|
|
RTC_DCHECK(signaling_thread()->IsCurrent());
|
2016-03-04 02:51:39 -08:00
|
|
|
rtc::scoped_refptr<LocalAudioSource> source(
|
2017-02-10 21:26:48 -08:00
|
|
|
LocalAudioSource::Create(&options));
|
2016-03-04 02:51:39 -08:00
|
|
|
return source;
|
|
|
|
|
}
|
|
|
|
|
|
2019-06-11 14:04:16 +02:00
|
|
|
bool PeerConnectionFactory::StartAecDump(FILE* file, int64_t max_size_bytes) {
|
2021-04-01 19:14:54 +02:00
|
|
|
RTC_DCHECK_RUN_ON(worker_thread());
|
2020-10-15 08:34:31 +00:00
|
|
|
return channel_manager()->StartAecDump(FileWrapper(file), max_size_bytes);
|
2019-06-11 14:04:16 +02:00
|
|
|
}
|
|
|
|
|
|
2015-10-22 03:25:41 -07:00
|
|
|
void PeerConnectionFactory::StopAecDump() {
|
2021-04-01 19:14:54 +02:00
|
|
|
RTC_DCHECK_RUN_ON(worker_thread());
|
2020-10-15 08:34:31 +00:00
|
|
|
channel_manager()->StopAecDump();
|
2015-10-22 03:25:41 -07:00
|
|
|
}
|
|
|
|
|
|
2020-11-27 08:05:42 +00:00
|
|
|
RTCErrorOr<rtc::scoped_refptr<PeerConnectionInterface>>
|
|
|
|
|
PeerConnectionFactory::CreatePeerConnectionOrError(
|
|
|
|
|
const PeerConnectionInterface::RTCConfiguration& configuration,
|
|
|
|
|
PeerConnectionDependencies dependencies) {
|
2020-11-04 10:34:21 +00:00
|
|
|
RTC_DCHECK_RUN_ON(signaling_thread());
|
2019-09-05 14:35:04 +02:00
|
|
|
RTC_DCHECK(!(dependencies.allocator && dependencies.packet_socket_factory))
|
|
|
|
|
<< "You can't set both allocator and packet_socket_factory; "
|
|
|
|
|
"the former is going away (see bugs.webrtc.org/7447";
|
2016-03-04 02:51:39 -08:00
|
|
|
|
Created PeerConnectionDependencies to avoid creating new CreatePeerConnection overloads.
Currently CreatePeerConnection takes 3 parameters. This is going to expand to four with a new change. Every time a new parameter is added, we need to deprecate the old method, switch clients to the new one, update fake/mock classes and tests, and so on, which is a cumbersome process.
To address this, this CL introduces a PeerConnectionDependencies structure to encapsulate all mandatory and optional dependencies (where a dependency is defined as non trivial
executable code that an API user may want to provide to the native API). This allows adding a new injectable dependency by simply adding a new field to the struct, avoiding the hassle described above.
You may think we could use RTCConfiguration for this. But since RTCConfiguration is both passed in and out of the PeerConnection (using GetConfiguration/SetConfiguration), it can't carry unique_ptrs. And we don't want to inject dependencies via raw pointers, since this could lead to lifetime management bugs, where the dependency is deleted before the PeerConnection is done using it.
Bug: webrtc:7913
Change-Id: I38c3f4ce4f26b37e6fe219d1eeca271294b40db8
Reviewed-on: https://webrtc-review.googlesource.com/73663
Commit-Queue: Benjamin Wright <benwright@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23084}
2018-05-02 13:46:31 -07:00
|
|
|
// Set internal defaults if optional dependencies are not set.
|
|
|
|
|
if (!dependencies.cert_generator) {
|
Use absl::make_unique and absl::WrapUnique directly
Instead of going through our wrappers in ptr_util.h.
This CL was generated by the following script:
git grep -l ptr_util | xargs perl -pi -e 's,#include "rtc_base/ptr_util.h",#include "absl/memory/memory.h",'
git grep -l MakeUnique | xargs perl -pi -e 's,\b(rtc::)?MakeUnique\b,absl::make_unique,g'
git grep -l WrapUnique | xargs perl -pi -e 's,\b(rtc::)?WrapUnique\b,absl::WrapUnique,g'
git checkout -- rtc_base/ptr_util{.h,_unittest.cc}
git cl format
Followed by manually adding dependencies on
//third_party/abseil-cpp/absl/memory until `gn check` stopped
complaining.
Bug: webrtc:9473
Change-Id: I89ccd363f070479b8c431eb2c3d404a46eaacc1c
Reviewed-on: https://webrtc-review.googlesource.com/86600
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23850}
2018-07-05 11:40:33 +02:00
|
|
|
dependencies.cert_generator =
|
2020-10-15 08:34:31 +00:00
|
|
|
std::make_unique<rtc::RTCCertificateGenerator>(signaling_thread(),
|
|
|
|
|
network_thread());
|
2015-12-01 15:01:24 -08:00
|
|
|
}
|
Created PeerConnectionDependencies to avoid creating new CreatePeerConnection overloads.
Currently CreatePeerConnection takes 3 parameters. This is going to expand to four with a new change. Every time a new parameter is added, we need to deprecate the old method, switch clients to the new one, update fake/mock classes and tests, and so on, which is a cumbersome process.
To address this, this CL introduces a PeerConnectionDependencies structure to encapsulate all mandatory and optional dependencies (where a dependency is defined as non trivial
executable code that an API user may want to provide to the native API). This allows adding a new injectable dependency by simply adding a new field to the struct, avoiding the hassle described above.
You may think we could use RTCConfiguration for this. But since RTCConfiguration is both passed in and out of the PeerConnection (using GetConfiguration/SetConfiguration), it can't carry unique_ptrs. And we don't want to inject dependencies via raw pointers, since this could lead to lifetime management bugs, where the dependency is deleted before the PeerConnection is done using it.
Bug: webrtc:7913
Change-Id: I38c3f4ce4f26b37e6fe219d1eeca271294b40db8
Reviewed-on: https://webrtc-review.googlesource.com/73663
Commit-Queue: Benjamin Wright <benwright@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23084}
2018-05-02 13:46:31 -07:00
|
|
|
if (!dependencies.allocator) {
|
2019-09-05 14:35:04 +02:00
|
|
|
rtc::PacketSocketFactory* packet_socket_factory;
|
|
|
|
|
if (dependencies.packet_socket_factory)
|
|
|
|
|
packet_socket_factory = dependencies.packet_socket_factory.get();
|
|
|
|
|
else
|
2020-10-15 08:34:31 +00:00
|
|
|
packet_socket_factory = context_->default_socket_factory();
|
2019-09-05 14:35:04 +02:00
|
|
|
|
2020-07-27 14:07:59 +02:00
|
|
|
dependencies.allocator = std::make_unique<cricket::BasicPortAllocator>(
|
2020-10-15 08:34:31 +00:00
|
|
|
context_->default_network_manager(), packet_socket_factory,
|
2020-07-27 14:07:59 +02:00
|
|
|
configuration.turn_customizer);
|
2015-12-01 15:01:24 -08:00
|
|
|
}
|
Created PeerConnectionDependencies to avoid creating new CreatePeerConnection overloads.
Currently CreatePeerConnection takes 3 parameters. This is going to expand to four with a new change. Every time a new parameter is added, we need to deprecate the old method, switch clients to the new one, update fake/mock classes and tests, and so on, which is a cumbersome process.
To address this, this CL introduces a PeerConnectionDependencies structure to encapsulate all mandatory and optional dependencies (where a dependency is defined as non trivial
executable code that an API user may want to provide to the native API). This allows adding a new injectable dependency by simply adding a new field to the struct, avoiding the hassle described above.
You may think we could use RTCConfiguration for this. But since RTCConfiguration is both passed in and out of the PeerConnection (using GetConfiguration/SetConfiguration), it can't carry unique_ptrs. And we don't want to inject dependencies via raw pointers, since this could lead to lifetime management bugs, where the dependency is deleted before the PeerConnection is done using it.
Bug: webrtc:7913
Change-Id: I38c3f4ce4f26b37e6fe219d1eeca271294b40db8
Reviewed-on: https://webrtc-review.googlesource.com/73663
Commit-Queue: Benjamin Wright <benwright@webrtc.org>
Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23084}
2018-05-02 13:46:31 -07:00
|
|
|
|
2020-01-06 14:31:57 -08:00
|
|
|
if (!dependencies.async_resolver_factory) {
|
|
|
|
|
dependencies.async_resolver_factory =
|
|
|
|
|
std::make_unique<webrtc::BasicAsyncResolverFactory>();
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-15 12:33:05 -08:00
|
|
|
if (!dependencies.ice_transport_factory) {
|
|
|
|
|
dependencies.ice_transport_factory =
|
|
|
|
|
std::make_unique<DefaultIceTransportFactory>();
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-15 08:34:31 +00:00
|
|
|
dependencies.allocator->SetNetworkIgnoreMask(options().network_ignore_mask);
|
2015-12-01 15:01:24 -08:00
|
|
|
|
2017-09-05 04:30:30 -07:00
|
|
|
std::unique_ptr<RtcEventLog> event_log =
|
2020-10-15 08:34:31 +00:00
|
|
|
worker_thread()->Invoke<std::unique_ptr<RtcEventLog>>(
|
2021-01-18 09:24:33 +01:00
|
|
|
RTC_FROM_HERE, [this] { return CreateRtcEventLog_w(); });
|
Revert of Add logging of host lookups made by TurnPort to the RtcEventLog. (patchset #11 id:200001 of https://codereview.webrtc.org/2996933003/ )
Reason for revert:
Breaks Chromium build due to the changed constructor in webrtc/p2p/client/basicportallocator.h.
Build (example): https://build.chromium.org/p/chromium.webrtc.fyi/builders/Linux%20Builder/builds/19739.
Log:
FAILED: obj/remoting/protocol/protocol/port_allocator.o
/b/c/goma_client/gomacc ../../third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF obj/remoting/protocol/protocol/port_allocator.o.d -DV8_DEPRECATION_WARNINGS -DUSE_UDEV -DUSE_AURA=1 -DUSE_PANGO=1 -DUSE_CAIRO=1 -DUSE_GLIB=1 -DUSE_NSS_CERTS=1 -DUSE_X11=1 -DFULL_SAFE_BROWSING -DSAFE_BROWSING_CSD -DSAFE_BROWSING_DB_LOCAL -DCHROMIUM_BUILD -DFIELDTRIAL_TESTING_ENABLED -DCR_CLANG_REVISION=\"310694-2\" -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -DCOMPONENT_BUILD -D_DEBUG -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DWTF_USE_DYNAMIC_ANNOTATIONS=1 -D_GLIBCXX_DEBUG=1 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_32 -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_26 -DEXPAT_RELATIVE_PATH -DGL_GLEXT_PROTOTYPES -DUSE_GLX -DUSE_EGL -DGOOGLE_PROTOBUF_NO_RTTI -DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER -DHAVE_PTHREAD -DPROTOBUF_USE_DLLS -DWEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=0 -DFEATURE_ENABLE_VOICEMAIL -DGTEST_RELATIVE_PATH -DWEBRTC_CHROMIUM_BUILD -DWEBRTC_POSIX -DWEBRTC_LINUX -DBORINGSSL_SHARED_LIBRARY -I../.. -Igen -I../../build/linux/debian_jessie_amd64-sysroot/usr/include/glib-2.0 -I../../build/linux/debian_jessie_amd64-sysroot/usr/lib/x86_64-linux-gnu/glib-2.0/include -I../../third_party/libwebp/src -I../../third_party/khronos -I../../gpu -I../../third_party/protobuf/src -Igen/protoc_out -I../../third_party/protobuf/src -I../../third_party/webrtc_overrides -I../../testing/gtest/include -I../../third_party -I../../third_party/webrtc_overrides -I../../third_party -I../../third_party/boringssl/src/include -I../../build/linux/debian_jessie_amd64-sysroot/usr/include/nss -I../../build/linux/debian_jessie_amd64-sysroot/usr/include/nspr -I../../third_party/libyuv/include -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -funwind-tables -fPIC -pipe -B../../third_party/binutils/Linux_x64/Release/bin -pthread -fcolor-diagnostics -fdebug-prefix-map=/b/c/b/Linux_Builder__dbg_/src=. -m64 -march=x86-64 -Wall -Werror -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Wno-c++11-narrowing -Wno-covered-switch-default -Wno-unneeded-internal-declaration -Wno-inconsistent-missing-override -Wno-undefined-var-template -Wno-nonportable-include-path -Wno-address-of-packed-member -Wno-unused-lambda-capture -Wno-user-defined-warnings -Wno-enum-compare-switch -O0 -fno-omit-frame-pointer -g2 -gsplit-dwarf -fvisibility=hidden -Xclang -load -Xclang ../../third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.so -Xclang -add-plugin -Xclang find-bad-constructs -Xclang -plugin-arg-find-bad-constructs -Xclang check-auto-raw-pointer -Xclang -plugin-arg-find-bad-constructs -Xclang check-ipc -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -Wexit-time-destructors -Wno-header-guard -Wno-undefined-bool-conversion -Wno-tautological-undefined-compare -std=gnu++14 -fno-rtti -nostdinc++ -isystem../../buildtools/third_party/libc++/trunk/include -isystem../../buildtools/third_party/libc++abi/trunk/include --sysroot=../../build/linux/debian_jessie_amd64-sysroot -fno-exceptions -fvisibility-inlines-hidden -c ../../remoting/protocol/port_allocator.cc -o obj/remoting/protocol/protocol/port_allocator.o
../../remoting/protocol/port_allocator.cc:48:7: error: no matching constructor for initialization of 'cricket::BasicPortAllocator'
: BasicPortAllocator(network_manager.get(), socket_factory.get()),
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../third_party/webrtc/p2p/client/basicportallocator.h:35:12: note: candidate constructor not viable: requires single argument 'network_manager', but 2 arguments were provided
explicit BasicPortAllocator(rtc::NetworkManager* network_manager);
^
../../third_party/webrtc/p2p/client/basicportallocator.h:30:7: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 2 were provided
class BasicPortAllocator : public PortAllocator {
^
../../third_party/webrtc/p2p/client/basicportallocator.h:32:3: note: candidate constructor not viable: requires 3 arguments, but 2 were provided
BasicPortAllocator(rtc::NetworkManager* network_manager,
^
../../third_party/webrtc/p2p/client/basicportallocator.h:36:3: note: candidate constructor not viable: requires 3 arguments, but 2 were provided
BasicPortAllocator(rtc::NetworkManager* network_manager,
^
../../third_party/webrtc/p2p/client/basicportallocator.h:39:3: note: candidate constructor not viable: requires 5 arguments, but 2 were provided
BasicPortAllocator(rtc::NetworkManager* network_manager,
^
1 error generated.
Original issue's description:
> Add logging host lookups made by TurnPort to the RtcEventLog.
>
> The following fields are logged:
> - error, if there was an error.
> - elapsed time in milliseconds
>
> BUG=webrtc:8100
>
> Review-Url: https://codereview.webrtc.org/2996933003
> Cr-Commit-Position: refs/heads/master@{#19574}
> Committed: https://chromium.googlesource.com/external/webrtc/+/c251cb13c08aba710ba3a12588beb4aa172c7323
TBR=terelius@webrtc.org,pthatcher@webrtc.org,jonaso@google.com,pthatcher@google.com,solenberg@webrtc.org,deadbeef@webrtc.org,jonaso@webrtc.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=webrtc:8100
Review-Url: https://codereview.webrtc.org/3012473002
Cr-Commit-Position: refs/heads/master@{#19578}
2017-08-29 04:49:00 -07:00
|
|
|
|
2020-10-15 08:34:31 +00:00
|
|
|
std::unique_ptr<Call> call = worker_thread()->Invoke<std::unique_ptr<Call>>(
|
2017-06-15 12:52:32 -07:00
|
|
|
RTC_FROM_HERE,
|
2021-01-18 09:24:33 +01:00
|
|
|
[this, &event_log] { return CreateCall_w(event_log.get()); });
|
2017-06-15 12:52:32 -07:00
|
|
|
|
2020-11-27 08:05:42 +00:00
|
|
|
auto result = PeerConnection::Create(context_, options_, std::move(event_log),
|
|
|
|
|
std::move(call), configuration,
|
|
|
|
|
std::move(dependencies));
|
|
|
|
|
if (!result.ok()) {
|
|
|
|
|
return result.MoveError();
|
2015-12-01 15:01:24 -08:00
|
|
|
}
|
2021-02-10 13:05:44 +01:00
|
|
|
// We configure the proxy with a pointer to the network thread for methods
|
|
|
|
|
// that need to be invoked there rather than on the signaling thread.
|
2021-07-27 22:09:55 +00:00
|
|
|
// Internally, the proxy object has a member variable named |worker_thread_|
|
2021-02-10 13:05:44 +01:00
|
|
|
// which will point to the network thread (and not the factory's
|
|
|
|
|
// worker_thread()). All such methods have thread checks though, so the code
|
|
|
|
|
// should still be clear (outside of macro expansion).
|
2020-11-27 08:05:42 +00:00
|
|
|
rtc::scoped_refptr<PeerConnectionInterface> result_proxy =
|
2021-02-10 13:05:44 +01:00
|
|
|
PeerConnectionProxy::Create(signaling_thread(), network_thread(),
|
|
|
|
|
result.MoveValue());
|
2020-11-27 08:05:42 +00:00
|
|
|
return result_proxy;
|
2015-12-01 15:01:24 -08:00
|
|
|
}
|
|
|
|
|
|
2014-07-29 17:36:52 +00:00
|
|
|
rtc::scoped_refptr<MediaStreamInterface>
|
2018-03-02 11:34:10 -08:00
|
|
|
PeerConnectionFactory::CreateLocalMediaStream(const std::string& stream_id) {
|
2020-10-15 08:34:31 +00:00
|
|
|
RTC_DCHECK(signaling_thread()->IsCurrent());
|
|
|
|
|
return MediaStreamProxy::Create(signaling_thread(),
|
2018-03-02 11:34:10 -08:00
|
|
|
MediaStream::Create(stream_id));
|
2013-07-10 00:45:36 +00:00
|
|
|
}
|
|
|
|
|
|
2016-03-08 01:27:48 +01:00
|
|
|
rtc::scoped_refptr<VideoTrackInterface> PeerConnectionFactory::CreateVideoTrack(
|
2013-07-10 00:45:36 +00:00
|
|
|
const std::string& id,
|
2016-03-08 01:27:48 +01:00
|
|
|
VideoTrackSourceInterface* source) {
|
2020-10-15 08:34:31 +00:00
|
|
|
RTC_DCHECK(signaling_thread()->IsCurrent());
|
2014-07-29 17:36:52 +00:00
|
|
|
rtc::scoped_refptr<VideoTrackInterface> track(
|
2020-10-15 08:34:31 +00:00
|
|
|
VideoTrack::Create(id, source, worker_thread()));
|
|
|
|
|
return VideoTrackProxy::Create(signaling_thread(), worker_thread(), track);
|
2013-07-10 00:45:36 +00:00
|
|
|
}
|
|
|
|
|
|
2014-05-13 11:07:01 +00:00
|
|
|
rtc::scoped_refptr<AudioTrackInterface> PeerConnectionFactory::CreateAudioTrack(
|
|
|
|
|
const std::string& id,
|
|
|
|
|
AudioSourceInterface* source) {
|
2020-10-15 08:34:31 +00:00
|
|
|
RTC_DCHECK(signaling_thread()->IsCurrent());
|
2015-12-15 04:27:11 -08:00
|
|
|
rtc::scoped_refptr<AudioTrackInterface> track(AudioTrack::Create(id, source));
|
2020-10-15 08:34:31 +00:00
|
|
|
return AudioTrackProxy::Create(signaling_thread(), track);
|
2013-07-10 00:45:36 +00:00
|
|
|
}
|
|
|
|
|
|
2017-05-05 02:23:02 -07:00
|
|
|
cricket::ChannelManager* PeerConnectionFactory::channel_manager() {
|
2020-10-15 08:34:31 +00:00
|
|
|
return context_->channel_manager();
|
2017-05-05 02:23:02 -07:00
|
|
|
}
|
|
|
|
|
|
2017-09-06 05:18:15 -07:00
|
|
|
std::unique_ptr<RtcEventLog> PeerConnectionFactory::CreateRtcEventLog_w() {
|
2020-10-15 08:34:31 +00:00
|
|
|
RTC_DCHECK_RUN_ON(worker_thread());
|
2018-10-26 20:39:33 +02:00
|
|
|
|
|
|
|
|
auto encoding_type = RtcEventLog::EncodingType::Legacy;
|
2019-11-15 17:18:52 +01:00
|
|
|
if (IsTrialEnabled("WebRTC-RtcEventLogNewFormat"))
|
2018-10-26 20:39:33 +02:00
|
|
|
encoding_type = RtcEventLog::EncodingType::NewFormat;
|
2017-10-03 16:11:34 +02:00
|
|
|
return event_log_factory_
|
|
|
|
|
? event_log_factory_->CreateRtcEventLog(encoding_type)
|
2019-09-17 17:06:18 +02:00
|
|
|
: std::make_unique<RtcEventLogNull>();
|
2017-09-06 05:18:15 -07:00
|
|
|
}
|
|
|
|
|
|
2017-06-15 12:52:32 -07:00
|
|
|
std::unique_ptr<Call> PeerConnectionFactory::CreateCall_w(
|
|
|
|
|
RtcEventLog* event_log) {
|
2020-10-15 08:34:31 +00:00
|
|
|
RTC_DCHECK_RUN_ON(worker_thread());
|
2017-09-06 12:33:43 -07:00
|
|
|
|
2021-01-30 16:15:21 +01:00
|
|
|
webrtc::Call::Config call_config(event_log, network_thread());
|
2020-10-15 08:34:31 +00:00
|
|
|
if (!channel_manager()->media_engine() || !context_->call_factory()) {
|
2017-06-15 12:52:32 -07:00
|
|
|
return nullptr;
|
|
|
|
|
}
|
2018-11-16 11:29:55 +01:00
|
|
|
call_config.audio_state =
|
2020-10-15 08:34:31 +00:00
|
|
|
channel_manager()->media_engine()->voice().GetAudioState();
|
2019-08-13 10:48:48 +02:00
|
|
|
|
2020-02-17 18:46:07 +01:00
|
|
|
FieldTrialParameter<DataRate> min_bandwidth("min",
|
|
|
|
|
DataRate::KilobitsPerSec(30));
|
|
|
|
|
FieldTrialParameter<DataRate> start_bandwidth("start",
|
|
|
|
|
DataRate::KilobitsPerSec(300));
|
|
|
|
|
FieldTrialParameter<DataRate> max_bandwidth("max",
|
|
|
|
|
DataRate::KilobitsPerSec(2000));
|
2019-08-13 10:48:48 +02:00
|
|
|
ParseFieldTrial({&min_bandwidth, &start_bandwidth, &max_bandwidth},
|
2020-10-15 08:34:31 +00:00
|
|
|
trials().Lookup("WebRTC-PcFactoryDefaultBitrates"));
|
2019-08-13 10:48:48 +02:00
|
|
|
|
|
|
|
|
call_config.bitrate_config.min_bitrate_bps =
|
|
|
|
|
rtc::saturated_cast<int>(min_bandwidth->bps());
|
|
|
|
|
call_config.bitrate_config.start_bitrate_bps =
|
|
|
|
|
rtc::saturated_cast<int>(start_bandwidth->bps());
|
|
|
|
|
call_config.bitrate_config.max_bitrate_bps =
|
|
|
|
|
rtc::saturated_cast<int>(max_bandwidth->bps());
|
2017-06-15 12:52:32 -07:00
|
|
|
|
Revert "Revert "Enables PeerConnectionFactory using external fec controller""
This reverts commit 00733015fafbbc61ddc12dfdc88b21a9fcd9d122.
Reason for revert: The reason for a downstream test failure on the original commit and a workaround has been found. Solution is to keep a PeerConnectionFactory constructor implementation as the same as before.
Original change's description:
> Revert "Enables PeerConnectionFactory using external fec controller"
>
> This reverts commit 4f07bdb25567d8ef528311e0b50a62c61d543fc3.
>
> Reason for revert: Speculatively reverting, because downstream test is now hitting "PeerConnectionFactory.initialize was not called before creating a PeerConnectionFactory" error, even though it did call initialize. I don't see how any change in this CL could cause that, but it's the only CL on the blamelist, and it does modify PeerConnectionFactory.java
>
> Original change's description:
> > Enables PeerConnectionFactory using external fec controller
> >
> > Bug: webrtc:8799
> > Change-Id: Ieb2cf6163b9a83844ab9ed4822b4a7f1db4c24b8
> > Reviewed-on: https://webrtc-review.googlesource.com/43961
> > Commit-Queue: Ying Wang <yinwa@webrtc.org>
> > Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> > Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> > Reviewed-by: Niels Moller <nisse@webrtc.org>
> > Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#22038}
>
> TBR=sakal@webrtc.org,kwiberg@webrtc.org,nisse@webrtc.org,stefan@webrtc.org,yinwa@webrtc.org
>
> Change-Id: I95868c35d6f9973e0ebf563814cd71d0fcbd433d
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: webrtc:8799
> Reviewed-on: https://webrtc-review.googlesource.com/54080
> Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
> Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#22040}
TBR=deadbeef@webrtc.org,sakal@webrtc.org,kwiberg@webrtc.org,nisse@webrtc.org,stefan@webrtc.org,yinwa@webrtc.org
Bug: webrtc:8799
Change-Id: If9f3292bfcc739782967530c49f006d0abbc38a8
Reviewed-on: https://webrtc-review.googlesource.com/55400
Commit-Queue: Ying Wang <yinwa@webrtc.org>
Reviewed-by: Ying Wang <yinwa@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22100}
2018-02-20 12:50:27 +01:00
|
|
|
call_config.fec_controller_factory = fec_controller_factory_.get();
|
2019-04-01 10:33:16 +02:00
|
|
|
call_config.task_queue_factory = task_queue_factory_.get();
|
2019-04-10 13:48:24 +02:00
|
|
|
call_config.network_state_predictor_factory =
|
|
|
|
|
network_state_predictor_factory_.get();
|
2019-11-01 11:47:51 +01:00
|
|
|
call_config.neteq_factory = neteq_factory_.get();
|
Revert "Revert "Enables PeerConnectionFactory using external fec controller""
This reverts commit 00733015fafbbc61ddc12dfdc88b21a9fcd9d122.
Reason for revert: The reason for a downstream test failure on the original commit and a workaround has been found. Solution is to keep a PeerConnectionFactory constructor implementation as the same as before.
Original change's description:
> Revert "Enables PeerConnectionFactory using external fec controller"
>
> This reverts commit 4f07bdb25567d8ef528311e0b50a62c61d543fc3.
>
> Reason for revert: Speculatively reverting, because downstream test is now hitting "PeerConnectionFactory.initialize was not called before creating a PeerConnectionFactory" error, even though it did call initialize. I don't see how any change in this CL could cause that, but it's the only CL on the blamelist, and it does modify PeerConnectionFactory.java
>
> Original change's description:
> > Enables PeerConnectionFactory using external fec controller
> >
> > Bug: webrtc:8799
> > Change-Id: Ieb2cf6163b9a83844ab9ed4822b4a7f1db4c24b8
> > Reviewed-on: https://webrtc-review.googlesource.com/43961
> > Commit-Queue: Ying Wang <yinwa@webrtc.org>
> > Reviewed-by: Stefan Holmer <stefan@webrtc.org>
> > Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> > Reviewed-by: Niels Moller <nisse@webrtc.org>
> > Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
> > Cr-Commit-Position: refs/heads/master@{#22038}
>
> TBR=sakal@webrtc.org,kwiberg@webrtc.org,nisse@webrtc.org,stefan@webrtc.org,yinwa@webrtc.org
>
> Change-Id: I95868c35d6f9973e0ebf563814cd71d0fcbd433d
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: webrtc:8799
> Reviewed-on: https://webrtc-review.googlesource.com/54080
> Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org>
> Commit-Queue: Taylor Brandstetter <deadbeef@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#22040}
TBR=deadbeef@webrtc.org,sakal@webrtc.org,kwiberg@webrtc.org,nisse@webrtc.org,stefan@webrtc.org,yinwa@webrtc.org
Bug: webrtc:8799
Change-Id: If9f3292bfcc739782967530c49f006d0abbc38a8
Reviewed-on: https://webrtc-review.googlesource.com/55400
Commit-Queue: Ying Wang <yinwa@webrtc.org>
Reviewed-by: Ying Wang <yinwa@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22100}
2018-02-20 12:50:27 +01:00
|
|
|
|
2019-11-15 17:18:52 +01:00
|
|
|
if (IsTrialEnabled("WebRTC-Bwe-InjectedCongestionController")) {
|
2018-05-18 18:05:10 +02:00
|
|
|
RTC_LOG(LS_INFO) << "Using injected network controller factory";
|
|
|
|
|
call_config.network_controller_factory =
|
|
|
|
|
injected_network_controller_factory_.get();
|
|
|
|
|
} else {
|
|
|
|
|
RTC_LOG(LS_INFO) << "Using default network controller factory";
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-15 08:34:31 +00:00
|
|
|
call_config.trials = &trials();
|
2021-05-31 14:02:28 +02:00
|
|
|
call_config.rtp_transport_controller_send_factory =
|
|
|
|
|
transport_controller_send_factory_.get();
|
2020-10-15 08:34:31 +00:00
|
|
|
return std::unique_ptr<Call>(
|
|
|
|
|
context_->call_factory()->CreateCall(call_config));
|
2017-06-15 12:52:32 -07:00
|
|
|
}
|
|
|
|
|
|
2019-11-15 17:18:52 +01:00
|
|
|
bool PeerConnectionFactory::IsTrialEnabled(absl::string_view key) const {
|
2020-10-15 08:34:31 +00:00
|
|
|
return absl::StartsWith(trials().Lookup(key), "Enabled");
|
2019-11-15 17:18:52 +01:00
|
|
|
}
|
|
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
} // namespace webrtc
|