Move webrtc::CreatePeerConnectionFactory definition next to decl.

This CL moves webrtc::CreatePeerConnectionFactory definitions out of
pc:create_pc_factory and merges it with its declaration in the api/
directory.

In order to avoid circular dependencies a new build target is created:
* api:create_peerconnection_factory

Bug: webrtc:9862
Change-Id: Ie215c94460cba026f5bf7d11c9a5aa03792064af
Reviewed-on: https://webrtc-review.googlesource.com/c/111186
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25744}
This commit is contained in:
Mirko Bonadei
2018-11-22 09:00:13 +01:00
committed by Commit Bot
parent d51b3553db
commit 2ff3f49700
21 changed files with 373 additions and 355 deletions

View File

@ -46,10 +46,29 @@ rtc_source_set("callfactory_api") {
rtc_static_library("create_peerconnection_factory") {
visibility = [ "*" ]
allow_poison = [ "software_video_codecs" ]
sources = [
"create_peerconnection_factory.cc",
"create_peerconnection_factory.h",
]
deps = [
":callfactory_api",
":fec_controller_api",
":libjingle_peerconnection_api",
"../logging:rtc_event_log_api",
"../logging:rtc_event_log_impl_base",
"../media:rtc_audio_video",
"../modules/audio_device:audio_device_api",
"../modules/audio_processing:api",
"../pc:peerconnection",
"../rtc_base:ptr_util",
"../rtc_base:rtc_base",
"../rtc_base:rtc_base_approved",
"audio:audio_mixer_api",
"audio_codecs:audio_codecs_api",
"transport:network_control",
"video_codecs:video_codecs_api",
]
}
rtc_static_library("libjingle_peerconnection_api") {

View File

@ -66,6 +66,10 @@ specific_include_rules = {
"+rtc_base/socketaddress.h",
],
"create_peerconnection_factory\.h": [
"+rtc_base/scoped_ref_ptr.h",
],
"datachannelinterface\.h": [
"+rtc_base/copyonwritebuffer.h",
"+rtc_base/refcount.h",

View File

@ -9,3 +9,174 @@
*/
#include "api/create_peerconnection_factory.h"
#include <memory>
#include <utility>
#include "api/call/callfactoryinterface.h"
#include "api/peerconnectioninterface.h"
#include "api/video_codecs/video_decoder_factory.h"
#include "api/video_codecs/video_encoder_factory.h"
#include "logging/rtc_event_log/rtc_event_log_factory.h"
#include "logging/rtc_event_log/rtc_event_log_factory_interface.h"
#include "media/engine/webrtcmediaengine.h"
#include "modules/audio_device/include/audio_device.h"
#include "modules/audio_processing/include/audio_processing.h"
#include "rtc_base/bind.h"
#include "rtc_base/scoped_ref_ptr.h"
#include "rtc_base/thread.h"
namespace webrtc {
#if defined(USE_BUILTIN_SW_CODECS)
rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory) {
return CreatePeerConnectionFactoryWithAudioMixer(
nullptr /*network_thread*/, nullptr /*worker_thread*/,
nullptr /*signaling_thread*/, nullptr /*default_adm*/,
audio_encoder_factory, audio_decoder_factory,
nullptr /*video_encoder_factory*/, nullptr /*video_decoder_factory*/,
nullptr /*audio_mixer*/);
}
// Note: all the other CreatePeerConnectionFactory variants just end up calling
// this, ultimately.
rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
rtc::Thread* network_thread,
rtc::Thread* worker_thread,
rtc::Thread* signaling_thread,
AudioDeviceModule* default_adm,
rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
cricket::WebRtcVideoEncoderFactory* video_encoder_factory,
cricket::WebRtcVideoDecoderFactory* video_decoder_factory,
rtc::scoped_refptr<AudioMixer> audio_mixer,
rtc::scoped_refptr<AudioProcessing> audio_processing) {
rtc::scoped_refptr<AudioProcessing> audio_processing_use = audio_processing;
if (!audio_processing_use) {
audio_processing_use = AudioProcessingBuilder().Create();
}
std::unique_ptr<cricket::MediaEngineInterface> media_engine(
cricket::WebRtcMediaEngineFactory::Create(
default_adm, audio_encoder_factory, audio_decoder_factory,
video_encoder_factory, video_decoder_factory, audio_mixer,
audio_processing_use));
std::unique_ptr<CallFactoryInterface> call_factory = CreateCallFactory();
std::unique_ptr<RtcEventLogFactoryInterface> event_log_factory =
CreateRtcEventLogFactory();
return CreateModularPeerConnectionFactory(
network_thread, worker_thread, signaling_thread, std::move(media_engine),
std::move(call_factory), std::move(event_log_factory));
}
rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
rtc::Thread* network_thread,
rtc::Thread* worker_thread,
rtc::Thread* signaling_thread,
AudioDeviceModule* default_adm,
rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
cricket::WebRtcVideoEncoderFactory* video_encoder_factory,
cricket::WebRtcVideoDecoderFactory* video_decoder_factory,
rtc::scoped_refptr<AudioMixer> audio_mixer,
rtc::scoped_refptr<AudioProcessing> audio_processing,
std::unique_ptr<FecControllerFactoryInterface> fec_controller_factory,
std::unique_ptr<NetworkControllerFactoryInterface>
network_controller_factory) {
rtc::scoped_refptr<AudioProcessing> audio_processing_use = audio_processing;
if (!audio_processing_use) {
audio_processing_use = AudioProcessingBuilder().Create();
}
std::unique_ptr<cricket::MediaEngineInterface> media_engine(
cricket::WebRtcMediaEngineFactory::Create(
default_adm, audio_encoder_factory, audio_decoder_factory,
video_encoder_factory, video_decoder_factory, audio_mixer,
audio_processing_use));
std::unique_ptr<CallFactoryInterface> call_factory = CreateCallFactory();
std::unique_ptr<RtcEventLogFactoryInterface> event_log_factory =
CreateRtcEventLogFactory();
return CreateModularPeerConnectionFactory(
network_thread, worker_thread, signaling_thread, std::move(media_engine),
std::move(call_factory), std::move(event_log_factory),
std::move(fec_controller_factory), std::move(network_controller_factory));
}
#endif
rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
rtc::Thread* network_thread,
rtc::Thread* worker_thread,
rtc::Thread* signaling_thread,
rtc::scoped_refptr<AudioDeviceModule> default_adm,
rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
std::unique_ptr<VideoEncoderFactory> video_encoder_factory,
std::unique_ptr<VideoDecoderFactory> video_decoder_factory,
rtc::scoped_refptr<AudioMixer> audio_mixer,
rtc::scoped_refptr<AudioProcessing> audio_processing) {
if (!audio_processing)
audio_processing = AudioProcessingBuilder().Create();
std::unique_ptr<cricket::MediaEngineInterface> media_engine =
cricket::WebRtcMediaEngineFactory::Create(
default_adm, audio_encoder_factory, audio_decoder_factory,
std::move(video_encoder_factory), std::move(video_decoder_factory),
audio_mixer, audio_processing);
std::unique_ptr<CallFactoryInterface> call_factory = CreateCallFactory();
std::unique_ptr<RtcEventLogFactoryInterface> event_log_factory =
CreateRtcEventLogFactory();
PeerConnectionFactoryDependencies dependencies;
dependencies.network_thread = network_thread;
dependencies.worker_thread = worker_thread;
dependencies.signaling_thread = signaling_thread;
dependencies.media_engine = std::move(media_engine);
dependencies.call_factory = std::move(call_factory);
dependencies.event_log_factory = std::move(event_log_factory);
return CreateModularPeerConnectionFactory(std::move(dependencies));
}
#if defined(USE_BUILTIN_SW_CODECS)
rtc::scoped_refptr<PeerConnectionFactoryInterface>
CreatePeerConnectionFactoryWithAudioMixer(
rtc::Thread* network_thread,
rtc::Thread* worker_thread,
rtc::Thread* signaling_thread,
AudioDeviceModule* default_adm,
rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
cricket::WebRtcVideoEncoderFactory* video_encoder_factory,
cricket::WebRtcVideoDecoderFactory* video_decoder_factory,
rtc::scoped_refptr<AudioMixer> audio_mixer) {
return CreatePeerConnectionFactory(
network_thread, worker_thread, signaling_thread, default_adm,
audio_encoder_factory, audio_decoder_factory, video_encoder_factory,
video_decoder_factory, audio_mixer, nullptr);
}
rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
rtc::Thread* network_thread,
rtc::Thread* worker_thread,
rtc::Thread* signaling_thread,
AudioDeviceModule* default_adm,
rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
cricket::WebRtcVideoEncoderFactory* video_encoder_factory,
cricket::WebRtcVideoDecoderFactory* video_decoder_factory) {
return CreatePeerConnectionFactoryWithAudioMixer(
network_thread, worker_thread, signaling_thread, default_adm,
audio_encoder_factory, audio_decoder_factory, video_encoder_factory,
video_decoder_factory, nullptr);
}
#endif
} // namespace webrtc

View File

@ -11,7 +11,163 @@
#ifndef API_CREATE_PEERCONNECTION_FACTORY_H_
#define API_CREATE_PEERCONNECTION_FACTORY_H_
// TODO(bugs.webrtc.org/9862): Move webrtc::CreatePeerConnectionFactory and
// webrtc::CreatePeerConnectionFactoryWithAudioMixer here.
#include <memory>
#include "api/audio/audio_mixer.h"
#include "api/audio_codecs/audio_decoder_factory.h"
#include "api/audio_codecs/audio_encoder_factory.h"
#include "api/fec_controller.h"
#include "api/peerconnectioninterface.h"
#include "api/transport/network_control.h"
#include "rtc_base/scoped_ref_ptr.h"
namespace cricket {
class WebRtcVideoDecoderFactory;
class WebRtcVideoEncoderFactory;
} // namespace cricket
namespace webrtc {
class AudioDeviceModule;
class AudioProcessing;
class Thread;
#if defined(USE_BUILTIN_SW_CODECS)
// Create a new instance of PeerConnectionFactoryInterface.
//
// This method relies on the thread it's called on as the "signaling thread"
// for the PeerConnectionFactory it creates.
//
// As such, if the current thread is not already running an rtc::Thread message
// loop, an application using this method must eventually either call
// rtc::Thread::Current()->Run(), or call
// rtc::Thread::Current()->ProcessMessages() within the application's own
// message loop.
RTC_EXPORT rtc::scoped_refptr<PeerConnectionFactoryInterface>
CreatePeerConnectionFactory(
rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory);
// Create a new instance of PeerConnectionFactoryInterface.
//
// |network_thread|, |worker_thread| and |signaling_thread| are
// the only mandatory parameters.
//
// If non-null, a reference is added to |default_adm|, and ownership of
// |video_encoder_factory| and |video_decoder_factory| is transferred to the
// returned factory.
// TODO(deadbeef): Use rtc::scoped_refptr<> and std::unique_ptr<> to make this
// ownership transfer and ref counting more obvious.
RTC_EXPORT rtc::scoped_refptr<PeerConnectionFactoryInterface>
CreatePeerConnectionFactory(
rtc::Thread* network_thread,
rtc::Thread* worker_thread,
rtc::Thread* signaling_thread,
AudioDeviceModule* default_adm,
rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
cricket::WebRtcVideoEncoderFactory* video_encoder_factory,
cricket::WebRtcVideoDecoderFactory* video_decoder_factory);
// Create a new instance of PeerConnectionFactoryInterface with optional
// external audio mixed and audio processing modules.
//
// If |audio_mixer| is null, an internal audio mixer will be created and used.
// If |audio_processing| is null, an internal audio processing module will be
// created and used.
RTC_EXPORT rtc::scoped_refptr<PeerConnectionFactoryInterface>
CreatePeerConnectionFactory(
rtc::Thread* network_thread,
rtc::Thread* worker_thread,
rtc::Thread* signaling_thread,
AudioDeviceModule* default_adm,
rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
cricket::WebRtcVideoEncoderFactory* video_encoder_factory,
cricket::WebRtcVideoDecoderFactory* video_decoder_factory,
rtc::scoped_refptr<AudioMixer> audio_mixer,
rtc::scoped_refptr<AudioProcessing> audio_processing);
// Create a new instance of PeerConnectionFactoryInterface with optional
// external audio mixer, audio processing, and fec controller modules.
//
// If |audio_mixer| is null, an internal audio mixer will be created and used.
// If |audio_processing| is null, an internal audio processing module will be
// created and used.
// If |fec_controller_factory| is null, an internal fec controller module will
// be created and used.
// If |network_controller_factory| is provided, it will be used if enabled via
// field trial.
RTC_EXPORT rtc::scoped_refptr<PeerConnectionFactoryInterface>
CreatePeerConnectionFactory(
rtc::Thread* network_thread,
rtc::Thread* worker_thread,
rtc::Thread* signaling_thread,
AudioDeviceModule* default_adm,
rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
cricket::WebRtcVideoEncoderFactory* video_encoder_factory,
cricket::WebRtcVideoDecoderFactory* video_decoder_factory,
rtc::scoped_refptr<AudioMixer> audio_mixer,
rtc::scoped_refptr<AudioProcessing> audio_processing,
std::unique_ptr<FecControllerFactoryInterface> fec_controller_factory,
std::unique_ptr<NetworkControllerFactoryInterface>
network_controller_factory = nullptr);
#endif // defined(USE_BUILTIN_SW_CODECS)
// Create a new instance of PeerConnectionFactoryInterface with optional video
// codec factories. These video factories represents all video codecs, i.e. no
// extra internal video codecs will be added.
// When building WebRTC with rtc_use_builtin_sw_codecs = false, this is the
// only available CreatePeerConnectionFactory overload.
RTC_EXPORT rtc::scoped_refptr<PeerConnectionFactoryInterface>
CreatePeerConnectionFactory(
rtc::Thread* network_thread,
rtc::Thread* worker_thread,
rtc::Thread* signaling_thread,
rtc::scoped_refptr<AudioDeviceModule> default_adm,
rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
std::unique_ptr<VideoEncoderFactory> video_encoder_factory,
std::unique_ptr<VideoDecoderFactory> video_decoder_factory,
rtc::scoped_refptr<AudioMixer> audio_mixer,
rtc::scoped_refptr<AudioProcessing> audio_processing);
#if defined(USE_BUILTIN_SW_CODECS)
// Create a new instance of PeerConnectionFactoryInterface with external audio
// mixer.
//
// If |audio_mixer| is null, an internal audio mixer will be created and used.
RTC_EXPORT rtc::scoped_refptr<PeerConnectionFactoryInterface>
CreatePeerConnectionFactoryWithAudioMixer(
rtc::Thread* network_thread,
rtc::Thread* worker_thread,
rtc::Thread* signaling_thread,
AudioDeviceModule* default_adm,
rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
cricket::WebRtcVideoEncoderFactory* video_encoder_factory,
cricket::WebRtcVideoDecoderFactory* video_decoder_factory,
rtc::scoped_refptr<AudioMixer> audio_mixer);
// Create a new instance of PeerConnectionFactoryInterface.
// Same thread is used as worker and network thread.
RTC_EXPORT inline rtc::scoped_refptr<PeerConnectionFactoryInterface>
CreatePeerConnectionFactory(
rtc::Thread* worker_and_network_thread,
rtc::Thread* signaling_thread,
AudioDeviceModule* default_adm,
rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
cricket::WebRtcVideoEncoderFactory* video_encoder_factory,
cricket::WebRtcVideoDecoderFactory* video_decoder_factory) {
return CreatePeerConnectionFactory(
worker_and_network_thread, worker_and_network_thread, signaling_thread,
default_adm, audio_encoder_factory, audio_decoder_factory,
video_encoder_factory, video_decoder_factory);
}
#endif // defined(USE_BUILTIN_SW_CODECS)
} // namespace webrtc
#endif // API_CREATE_PEERCONNECTION_FACTORY_H_

View File

@ -1372,142 +1372,6 @@ class PeerConnectionFactoryInterface : public rtc::RefCountInterface {
~PeerConnectionFactoryInterface() override = default;
};
#if defined(USE_BUILTIN_SW_CODECS)
// Create a new instance of PeerConnectionFactoryInterface.
//
// This method relies on the thread it's called on as the "signaling thread"
// for the PeerConnectionFactory it creates.
//
// As such, if the current thread is not already running an rtc::Thread message
// loop, an application using this method must eventually either call
// rtc::Thread::Current()->Run(), or call
// rtc::Thread::Current()->ProcessMessages() within the application's own
// message loop.
RTC_EXPORT rtc::scoped_refptr<PeerConnectionFactoryInterface>
CreatePeerConnectionFactory(
rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory);
// Create a new instance of PeerConnectionFactoryInterface.
//
// |network_thread|, |worker_thread| and |signaling_thread| are
// the only mandatory parameters.
//
// If non-null, a reference is added to |default_adm|, and ownership of
// |video_encoder_factory| and |video_decoder_factory| is transferred to the
// returned factory.
// TODO(deadbeef): Use rtc::scoped_refptr<> and std::unique_ptr<> to make this
// ownership transfer and ref counting more obvious.
RTC_EXPORT rtc::scoped_refptr<PeerConnectionFactoryInterface>
CreatePeerConnectionFactory(
rtc::Thread* network_thread,
rtc::Thread* worker_thread,
rtc::Thread* signaling_thread,
AudioDeviceModule* default_adm,
rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
cricket::WebRtcVideoEncoderFactory* video_encoder_factory,
cricket::WebRtcVideoDecoderFactory* video_decoder_factory);
// Create a new instance of PeerConnectionFactoryInterface with optional
// external audio mixed and audio processing modules.
//
// If |audio_mixer| is null, an internal audio mixer will be created and used.
// If |audio_processing| is null, an internal audio processing module will be
// created and used.
RTC_EXPORT rtc::scoped_refptr<PeerConnectionFactoryInterface>
CreatePeerConnectionFactory(
rtc::Thread* network_thread,
rtc::Thread* worker_thread,
rtc::Thread* signaling_thread,
AudioDeviceModule* default_adm,
rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
cricket::WebRtcVideoEncoderFactory* video_encoder_factory,
cricket::WebRtcVideoDecoderFactory* video_decoder_factory,
rtc::scoped_refptr<AudioMixer> audio_mixer,
rtc::scoped_refptr<AudioProcessing> audio_processing);
// Create a new instance of PeerConnectionFactoryInterface with optional
// external audio mixer, audio processing, and fec controller modules.
//
// If |audio_mixer| is null, an internal audio mixer will be created and used.
// If |audio_processing| is null, an internal audio processing module will be
// created and used.
// If |fec_controller_factory| is null, an internal fec controller module will
// be created and used.
// If |network_controller_factory| is provided, it will be used if enabled via
// field trial.
RTC_EXPORT rtc::scoped_refptr<PeerConnectionFactoryInterface>
CreatePeerConnectionFactory(
rtc::Thread* network_thread,
rtc::Thread* worker_thread,
rtc::Thread* signaling_thread,
AudioDeviceModule* default_adm,
rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
cricket::WebRtcVideoEncoderFactory* video_encoder_factory,
cricket::WebRtcVideoDecoderFactory* video_decoder_factory,
rtc::scoped_refptr<AudioMixer> audio_mixer,
rtc::scoped_refptr<AudioProcessing> audio_processing,
std::unique_ptr<FecControllerFactoryInterface> fec_controller_factory,
std::unique_ptr<NetworkControllerFactoryInterface>
network_controller_factory = nullptr);
#endif
// Create a new instance of PeerConnectionFactoryInterface with optional video
// codec factories. These video factories represents all video codecs, i.e. no
// extra internal video codecs will be added.
// When building WebRTC with rtc_use_builtin_sw_codecs = false, this is the
// only available CreatePeerConnectionFactory overload.
RTC_EXPORT rtc::scoped_refptr<PeerConnectionFactoryInterface>
CreatePeerConnectionFactory(
rtc::Thread* network_thread,
rtc::Thread* worker_thread,
rtc::Thread* signaling_thread,
rtc::scoped_refptr<AudioDeviceModule> default_adm,
rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
std::unique_ptr<VideoEncoderFactory> video_encoder_factory,
std::unique_ptr<VideoDecoderFactory> video_decoder_factory,
rtc::scoped_refptr<AudioMixer> audio_mixer,
rtc::scoped_refptr<AudioProcessing> audio_processing);
#if defined(USE_BUILTIN_SW_CODECS)
// Create a new instance of PeerConnectionFactoryInterface with external audio
// mixer.
//
// If |audio_mixer| is null, an internal audio mixer will be created and used.
RTC_EXPORT rtc::scoped_refptr<PeerConnectionFactoryInterface>
CreatePeerConnectionFactoryWithAudioMixer(
rtc::Thread* network_thread,
rtc::Thread* worker_thread,
rtc::Thread* signaling_thread,
AudioDeviceModule* default_adm,
rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
cricket::WebRtcVideoEncoderFactory* video_encoder_factory,
cricket::WebRtcVideoDecoderFactory* video_decoder_factory,
rtc::scoped_refptr<AudioMixer> audio_mixer);
// Create a new instance of PeerConnectionFactoryInterface.
// Same thread is used as worker and network thread.
RTC_EXPORT inline rtc::scoped_refptr<PeerConnectionFactoryInterface>
CreatePeerConnectionFactory(
rtc::Thread* worker_and_network_thread,
rtc::Thread* signaling_thread,
AudioDeviceModule* default_adm,
rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
cricket::WebRtcVideoEncoderFactory* video_encoder_factory,
cricket::WebRtcVideoDecoderFactory* video_decoder_factory) {
return CreatePeerConnectionFactory(
worker_and_network_thread, worker_and_network_thread, signaling_thread,
default_adm, audio_encoder_factory, audio_decoder_factory,
video_encoder_factory, video_decoder_factory);
}
#endif
// This is a lower-level version of the CreatePeerConnectionFactory functions
// above. It's implemented in the "peerconnection" build target, whereas the
// above methods are only implemented in the broader "libjingle_peerconnection"

View File

@ -681,6 +681,7 @@ if (is_linux || is_win) {
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
deps = [
"../api:create_peerconnection_factory",
"../api:libjingle_peerconnection_api",
"../api/video:video_frame_i420",
"../rtc_base:checks",
@ -838,6 +839,7 @@ if (is_win || is_android) {
configs += [ "//build/config/win:windowed" ]
}
deps = [
"../api:create_peerconnection_factory",
"../api:libjingle_peerconnection_api",
"../api/audio_codecs:builtin_audio_decoder_factory",
"../api/audio_codecs:builtin_audio_encoder_factory",

View File

@ -16,6 +16,7 @@
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
#include "api/create_peerconnection_factory.h"
#include "api/video_codecs/builtin_video_decoder_factory.h"
#include "api/video_codecs/builtin_video_encoder_factory.h"
#include "examples/peerconnection/client/defaults.h"

View File

@ -15,6 +15,7 @@
#include "absl/memory/memory.h"
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
#include "api/create_peerconnection_factory.h"
#include "api/videosourceproxy.h"
#include "media/engine/internaldecoderfactory.h"
#include "media/engine/internalencoderfactory.h"

View File

@ -218,42 +218,6 @@ rtc_static_library("peerconnection") {
]
}
# This target implements CreatePeerConnectionFactory methods that will create a
# PeerConnection will full functionality (audio, video and data). Applications
# that wish to reduce their binary size by ommitting functionality they don't
# need should use CreateModularCreatePeerConnectionFactory instead, using the
# "peerconnection" build target and other targets specific to their
# requrements. See comment in peerconnectionfactoryinterface.h.
rtc_static_library("create_pc_factory") {
sources = [
"createpeerconnectionfactory.cc",
]
deps = [
"../api:callfactory_api",
"../api:libjingle_peerconnection_api",
"../api/audio:audio_mixer_api",
"../api/audio_codecs:audio_codecs_api",
"../api/video_codecs:video_codecs_api",
"../call",
"../call:call_interfaces",
"../logging:rtc_event_log_api",
"../logging:rtc_event_log_impl_base",
"../media:rtc_audio_video",
"../media:rtc_media_base",
"../modules/audio_device:audio_device",
"../modules/audio_processing:api",
"../modules/audio_processing:audio_processing",
"../rtc_base:rtc_base",
"../rtc_base:rtc_base_approved",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
}
}
rtc_source_set("libjingle_peerconnection") {
visibility = [ "*" ]
allow_poison = [
@ -261,8 +225,8 @@ rtc_source_set("libjingle_peerconnection") {
"software_video_codecs", # TODO(bugs.webrtc.org/7925): Remove.
]
deps = [
":create_pc_factory",
":peerconnection",
"../api:create_peerconnection_factory",
"../api:libjingle_peerconnection_api",
]
}
@ -343,6 +307,7 @@ if (rtc_include_tests) {
]
deps = [
":pc_test_utils",
"../api:create_peerconnection_factory",
"../api:libjingle_peerconnection_api",
"../api:rtc_stats_api",
"../api/audio_codecs:builtin_audio_decoder_factory",
@ -397,6 +362,7 @@ if (rtc_include_tests) {
":peerconnection",
":rtc_pc_base",
"..:webrtc_common",
"../api:create_peerconnection_factory",
"../api:libjingle_peerconnection_api",
"../api:libjingle_peerconnection_test_api",
"../api:rtc_stats_api",
@ -485,6 +451,7 @@ if (rtc_include_tests) {
deps = [
":peerconnection",
":rtc_pc_base",
"../api:create_peerconnection_factory",
"../api:fake_frame_decryptor",
"../api:fake_frame_encryptor",
"../api:libjingle_peerconnection_api",

View File

@ -1,176 +0,0 @@
/*
* Copyright 2017 The WebRTC project authors. All Rights Reserved.
*
* 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.
*/
#include "api/call/callfactoryinterface.h"
#include "api/peerconnectioninterface.h"
#include "api/video_codecs/video_decoder_factory.h"
#include "api/video_codecs/video_encoder_factory.h"
#include "logging/rtc_event_log/rtc_event_log_factory_interface.h"
#include "media/engine/webrtcmediaengine.h"
#include "modules/audio_device/include/audio_device.h"
#include "modules/audio_processing/include/audio_processing.h"
#include "rtc_base/bind.h"
#include "rtc_base/scoped_ref_ptr.h"
#include "rtc_base/thread.h"
namespace webrtc {
#if defined(USE_BUILTIN_SW_CODECS)
rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory) {
return CreatePeerConnectionFactoryWithAudioMixer(
nullptr /*network_thread*/, nullptr /*worker_thread*/,
nullptr /*signaling_thread*/, nullptr /*default_adm*/,
audio_encoder_factory, audio_decoder_factory,
nullptr /*video_encoder_factory*/, nullptr /*video_decoder_factory*/,
nullptr /*audio_mixer*/);
}
// Note: all the other CreatePeerConnectionFactory variants just end up calling
// this, ultimately.
rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
rtc::Thread* network_thread,
rtc::Thread* worker_thread,
rtc::Thread* signaling_thread,
AudioDeviceModule* default_adm,
rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
cricket::WebRtcVideoEncoderFactory* video_encoder_factory,
cricket::WebRtcVideoDecoderFactory* video_decoder_factory,
rtc::scoped_refptr<AudioMixer> audio_mixer,
rtc::scoped_refptr<AudioProcessing> audio_processing) {
rtc::scoped_refptr<AudioProcessing> audio_processing_use = audio_processing;
if (!audio_processing_use) {
audio_processing_use = AudioProcessingBuilder().Create();
}
std::unique_ptr<cricket::MediaEngineInterface> media_engine(
cricket::WebRtcMediaEngineFactory::Create(
default_adm, audio_encoder_factory, audio_decoder_factory,
video_encoder_factory, video_decoder_factory, audio_mixer,
audio_processing_use));
std::unique_ptr<CallFactoryInterface> call_factory = CreateCallFactory();
std::unique_ptr<RtcEventLogFactoryInterface> event_log_factory =
CreateRtcEventLogFactory();
return CreateModularPeerConnectionFactory(
network_thread, worker_thread, signaling_thread, std::move(media_engine),
std::move(call_factory), std::move(event_log_factory));
}
rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
rtc::Thread* network_thread,
rtc::Thread* worker_thread,
rtc::Thread* signaling_thread,
AudioDeviceModule* default_adm,
rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
cricket::WebRtcVideoEncoderFactory* video_encoder_factory,
cricket::WebRtcVideoDecoderFactory* video_decoder_factory,
rtc::scoped_refptr<AudioMixer> audio_mixer,
rtc::scoped_refptr<AudioProcessing> audio_processing,
std::unique_ptr<FecControllerFactoryInterface> fec_controller_factory,
std::unique_ptr<NetworkControllerFactoryInterface>
network_controller_factory) {
rtc::scoped_refptr<AudioProcessing> audio_processing_use = audio_processing;
if (!audio_processing_use) {
audio_processing_use = AudioProcessingBuilder().Create();
}
std::unique_ptr<cricket::MediaEngineInterface> media_engine(
cricket::WebRtcMediaEngineFactory::Create(
default_adm, audio_encoder_factory, audio_decoder_factory,
video_encoder_factory, video_decoder_factory, audio_mixer,
audio_processing_use));
std::unique_ptr<CallFactoryInterface> call_factory = CreateCallFactory();
std::unique_ptr<RtcEventLogFactoryInterface> event_log_factory =
CreateRtcEventLogFactory();
return CreateModularPeerConnectionFactory(
network_thread, worker_thread, signaling_thread, std::move(media_engine),
std::move(call_factory), std::move(event_log_factory),
std::move(fec_controller_factory), std::move(network_controller_factory));
}
#endif
rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
rtc::Thread* network_thread,
rtc::Thread* worker_thread,
rtc::Thread* signaling_thread,
rtc::scoped_refptr<AudioDeviceModule> default_adm,
rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
std::unique_ptr<VideoEncoderFactory> video_encoder_factory,
std::unique_ptr<VideoDecoderFactory> video_decoder_factory,
rtc::scoped_refptr<AudioMixer> audio_mixer,
rtc::scoped_refptr<AudioProcessing> audio_processing) {
if (!audio_processing)
audio_processing = AudioProcessingBuilder().Create();
std::unique_ptr<cricket::MediaEngineInterface> media_engine =
cricket::WebRtcMediaEngineFactory::Create(
default_adm, audio_encoder_factory, audio_decoder_factory,
std::move(video_encoder_factory), std::move(video_decoder_factory),
audio_mixer, audio_processing);
std::unique_ptr<CallFactoryInterface> call_factory = CreateCallFactory();
std::unique_ptr<RtcEventLogFactoryInterface> event_log_factory =
CreateRtcEventLogFactory();
PeerConnectionFactoryDependencies dependencies;
dependencies.network_thread = network_thread;
dependencies.worker_thread = worker_thread;
dependencies.signaling_thread = signaling_thread;
dependencies.media_engine = std::move(media_engine);
dependencies.call_factory = std::move(call_factory);
dependencies.event_log_factory = std::move(event_log_factory);
return CreateModularPeerConnectionFactory(std::move(dependencies));
}
#if defined(USE_BUILTIN_SW_CODECS)
rtc::scoped_refptr<PeerConnectionFactoryInterface>
CreatePeerConnectionFactoryWithAudioMixer(
rtc::Thread* network_thread,
rtc::Thread* worker_thread,
rtc::Thread* signaling_thread,
AudioDeviceModule* default_adm,
rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
cricket::WebRtcVideoEncoderFactory* video_encoder_factory,
cricket::WebRtcVideoDecoderFactory* video_decoder_factory,
rtc::scoped_refptr<AudioMixer> audio_mixer) {
return CreatePeerConnectionFactory(
network_thread, worker_thread, signaling_thread, default_adm,
audio_encoder_factory, audio_decoder_factory, video_encoder_factory,
video_decoder_factory, audio_mixer, nullptr);
}
rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
rtc::Thread* network_thread,
rtc::Thread* worker_thread,
rtc::Thread* signaling_thread,
AudioDeviceModule* default_adm,
rtc::scoped_refptr<AudioEncoderFactory> audio_encoder_factory,
rtc::scoped_refptr<AudioDecoderFactory> audio_decoder_factory,
cricket::WebRtcVideoEncoderFactory* video_encoder_factory,
cricket::WebRtcVideoDecoderFactory* video_decoder_factory) {
return CreatePeerConnectionFactoryWithAudioMixer(
network_thread, worker_thread, signaling_thread, default_adm,
audio_encoder_factory, audio_decoder_factory, video_encoder_factory,
video_decoder_factory, nullptr);
}
#endif
} // namespace webrtc

View File

@ -10,6 +10,7 @@
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
#include "api/create_peerconnection_factory.h"
#include "api/peerconnectionproxy.h"
#include "api/video_codecs/builtin_video_decoder_factory.h"
#include "api/video_codecs/builtin_video_encoder_factory.h"

View File

@ -10,6 +10,7 @@
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
#include "api/create_peerconnection_factory.h"
#include "api/video_codecs/builtin_video_decoder_factory.h"
#include "api/video_codecs/builtin_video_encoder_factory.h"
#include "p2p/base/fakeportallocator.h"

View File

@ -21,6 +21,7 @@
#include "absl/memory/memory.h"
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
#include "api/create_peerconnection_factory.h"
#include "api/peerconnectionproxy.h"
#include "api/umametrics.h"
#include "api/video_codecs/builtin_video_decoder_factory.h"

View File

@ -10,6 +10,7 @@
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
#include "api/create_peerconnection_factory.h"
#include "api/stats/rtcstats_objects.h"
#include "api/video_codecs/builtin_video_decoder_factory.h"
#include "api/video_codecs/builtin_video_encoder_factory.h"

View File

@ -14,6 +14,7 @@
#include "absl/memory/memory.h"
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
#include "api/create_peerconnection_factory.h"
#include "api/jsep.h"
#include "api/mediastreaminterface.h"
#include "api/peerconnectioninterface.h"

View File

@ -15,6 +15,7 @@
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
#include "api/create_peerconnection_factory.h"
#include "api/peerconnectionproxy.h"
#include "api/video_codecs/builtin_video_decoder_factory.h"
#include "api/video_codecs/builtin_video_encoder_factory.h"

View File

@ -15,6 +15,7 @@
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
#include "api/create_peerconnection_factory.h"
#include "api/mediastreaminterface.h"
#include "api/video_codecs/builtin_video_decoder_factory.h"
#include "api/video_codecs/builtin_video_encoder_factory.h"

View File

@ -17,6 +17,7 @@
#include "absl/memory/memory.h"
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
#include "api/create_peerconnection_factory.h"
#include "api/jsepsessiondescription.h"
#include "api/mediastreaminterface.h"
#include "api/peerconnectioninterface.h"

View File

@ -12,6 +12,7 @@
#include <utility>
#include <vector>
#include "api/create_peerconnection_factory.h"
#include "api/video_codecs/builtin_video_decoder_factory.h"
#include "api/video_codecs/builtin_video_encoder_factory.h"
#include "modules/audio_processing/include/audio_processing.h"

View File

@ -8,8 +8,8 @@
import("../webrtc.gni")
if (is_ios) {
import("//build/config/ios/rules.gni")
import("//build/config/ios/ios_sdk.gni")
import("//build/config/ios/rules.gni")
}
if (is_mac) {
import("//build/config/mac/rules.gni")
@ -910,6 +910,7 @@ if (is_ios || is_mac) {
":videorendereradapter_objc",
":videosource_objc",
":videotoolbox_objc",
"../api:create_peerconnection_factory",
"../api:libjingle_peerconnection_api",
"../api/audio_codecs:audio_codecs_api",
"../api/audio_codecs:builtin_audio_decoder_factory",
@ -923,7 +924,6 @@ if (is_ios || is_mac) {
"../modules/audio_processing:api",
"../modules/audio_processing:audio_processing",
"../modules/video_coding:video_codec_interface",
"../pc:create_pc_factory",
"../pc:peerconnection",
"../rtc_base:checks",
"../rtc_base:rtc_base",

View File

@ -7,9 +7,9 @@
# be found in the AUTHORS file in the root of the source tree.
if (is_android) {
import("../../webrtc.gni")
import("//build/config/android/config.gni")
import("//build/config/android/rules.gni")
import("../../webrtc.gni")
group("android") {
if (!build_with_chromium && is_android) {
@ -118,7 +118,7 @@ if (is_android) {
":media_jni",
":peerconnection_jni",
":video_jni",
"../../pc:create_pc_factory",
"../../api:create_peerconnection_factory",
]
}