2013-07-10 00:45:36 +00:00
|
|
|
/*
|
|
|
|
|
* libjingle
|
2016-02-10 10:53:12 +01:00
|
|
|
* Copyright 2004 Google Inc.
|
2013-07-10 00:45:36 +00:00
|
|
|
*
|
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
|
* modification, are permitted provided that the following conditions are met:
|
|
|
|
|
*
|
|
|
|
|
* 1. Redistributions of source code must retain the above copyright notice,
|
|
|
|
|
* this list of conditions and the following disclaimer.
|
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
|
* this list of conditions and the following disclaimer in the documentation
|
|
|
|
|
* and/or other materials provided with the distribution.
|
|
|
|
|
* 3. The name of the author may not be used to endorse or promote products
|
|
|
|
|
* derived from this software without specific prior written permission.
|
|
|
|
|
*
|
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
|
|
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
|
|
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
|
|
|
|
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
|
|
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
|
|
|
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
|
|
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
|
|
|
|
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
|
|
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
*/
|
|
|
|
|
|
2016-02-10 10:53:12 +01:00
|
|
|
#include "webrtc/api/peerconnectionfactory.h"
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2015-12-17 03:04:15 -08:00
|
|
|
#include <utility>
|
|
|
|
|
|
2016-02-10 10:53:12 +01:00
|
|
|
#include "webrtc/api/audiotrack.h"
|
|
|
|
|
#include "webrtc/api/localaudiosource.h"
|
|
|
|
|
#include "webrtc/api/mediastream.h"
|
|
|
|
|
#include "webrtc/api/mediastreamproxy.h"
|
|
|
|
|
#include "webrtc/api/mediastreamtrackproxy.h"
|
|
|
|
|
#include "webrtc/api/peerconnection.h"
|
|
|
|
|
#include "webrtc/api/peerconnectionfactoryproxy.h"
|
|
|
|
|
#include "webrtc/api/peerconnectionproxy.h"
|
|
|
|
|
#include "webrtc/api/videosource.h"
|
|
|
|
|
#include "webrtc/api/videosourceproxy.h"
|
|
|
|
|
#include "webrtc/api/videotrack.h"
|
2014-09-24 17:14:05 +00:00
|
|
|
#include "webrtc/base/bind.h"
|
Move talk/media to webrtc/media
I removed the 'libjingle' target in talk/libjingle.gyp and replaced
all users of it with base/base.gyp:rtc_base. It seems the jsoncpp
and expat dependencies were not used by it's previous references.
The files in talk/media/testdata were uploaded to Google Storage and
added .sha1 files in resources/media instead of simply moving them.
The previously disabled warnings that were inherited from
talk/build/common.gypi are now replaced by target-specific disabling
of only the failing warnings. Additional disabling was needed since the stricter
compilation warnings that applies to code in webrtc/.
License headers will be updated in a follow-up CL in order to not
break Git history.
Other modifications:
* Updated the header guards.
* Sorted the includes using chromium/src/tools/sort-headers.py
except for these files:
talk/app/webrtc/peerconnectionendtoend_unittest.cc
talk/app/webrtc/java/jni/androidmediadecoder_jni.cc
talk/app/webrtc/java/jni/androidmediaencoder_jni.cc
webrtc/media/devices/win32devicemanager.cc.
* Unused GYP reference to libjingle_tests_additional_deps was removed.
* Removed duplicated GYP entries of
webrtc/base/testutils.cc
webrtc/base/testutils.h
The HAVE_WEBRTC_VIDEO and HAVE_WEBRTC_VOICE defines were used by only talk/media,
so they were moved to the media.gyp.
I also checked that none of
EXPAT_RELATIVE_PATH,
FEATURE_ENABLE_VOICEMAIL,
GTEST_RELATIVE_PATH,
JSONCPP_RELATIVE_PATH,
LOGGING=1,
SRTP_RELATIVE_PATH,
FEATURE_ENABLE_SSL,
FEATURE_ENABLE_VOICEMAIL,
FEATURE_ENABLE_PSTN,
HAVE_SCTP,
HAVE_SRTP,
are used by the talk/media code.
For Chromium, the following changes will need to be applied to the roll CL that updates the
DEPS for WebRTC and libjingle: https://codereview.chromium.org/1604303002/
BUG=webrtc:5420
NOPRESUBMIT=True
TBR=tommi@webrtc.org
Review URL: https://codereview.webrtc.org/1587193006
Cr-Commit-Position: refs/heads/master@{#11495}
2016-02-04 23:52:28 -08:00
|
|
|
#include "webrtc/media/webrtc/webrtcmediaengine.h"
|
|
|
|
|
#include "webrtc/media/webrtc/webrtcvideodecoderfactory.h"
|
|
|
|
|
#include "webrtc/media/webrtc/webrtcvideoencoderfactory.h"
|
2013-07-10 00:45:36 +00:00
|
|
|
#include "webrtc/modules/audio_device/include/audio_device.h"
|
2015-12-01 15:01:24 -08:00
|
|
|
#include "webrtc/p2p/base/basicpacketsocketfactory.h"
|
|
|
|
|
#include "webrtc/p2p/client/basicportallocator.h"
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
2015-08-11 10:33:13 +02:00
|
|
|
namespace {
|
|
|
|
|
|
|
|
|
|
// Passes down the calls to |store_|. See usage in CreatePeerConnection.
|
|
|
|
|
class DtlsIdentityStoreWrapper : public DtlsIdentityStoreInterface {
|
|
|
|
|
public:
|
|
|
|
|
DtlsIdentityStoreWrapper(
|
|
|
|
|
const rtc::scoped_refptr<RefCountedDtlsIdentityStore>& store)
|
|
|
|
|
: store_(store) {
|
2015-09-17 00:24:34 -07:00
|
|
|
RTC_DCHECK(store_);
|
2015-08-11 10:33:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RequestIdentity(
|
|
|
|
|
rtc::KeyType key_type,
|
|
|
|
|
const rtc::scoped_refptr<webrtc::DtlsIdentityRequestObserver>&
|
|
|
|
|
observer) override {
|
|
|
|
|
store_->RequestIdentity(key_type, observer);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
rtc::scoped_refptr<RefCountedDtlsIdentityStore> store_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // anonymous namespace
|
|
|
|
|
|
2014-07-29 17:36:52 +00:00
|
|
|
rtc::scoped_refptr<PeerConnectionFactoryInterface>
|
2013-07-10 00:45:36 +00:00
|
|
|
CreatePeerConnectionFactory() {
|
2014-07-29 17:36:52 +00:00
|
|
|
rtc::scoped_refptr<PeerConnectionFactory> pc_factory(
|
|
|
|
|
new rtc::RefCountedObject<PeerConnectionFactory>());
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2015-01-12 08:30:16 +00:00
|
|
|
|
|
|
|
|
// Call Initialize synchronously but make sure its executed on
|
|
|
|
|
// |signaling_thread|.
|
|
|
|
|
MethodCall0<PeerConnectionFactory, bool> call(
|
|
|
|
|
pc_factory.get(),
|
|
|
|
|
&PeerConnectionFactory::Initialize);
|
|
|
|
|
bool result = call.Marshal(pc_factory->signaling_thread());
|
|
|
|
|
|
|
|
|
|
if (!result) {
|
2013-07-10 00:45:36 +00:00
|
|
|
return NULL;
|
|
|
|
|
}
|
2015-01-12 08:30:16 +00:00
|
|
|
return PeerConnectionFactoryProxy::Create(pc_factory->signaling_thread(),
|
|
|
|
|
pc_factory);
|
2013-07-10 00:45:36 +00:00
|
|
|
}
|
|
|
|
|
|
2014-07-29 17:36:52 +00:00
|
|
|
rtc::scoped_refptr<PeerConnectionFactoryInterface>
|
2013-07-10 00:45:36 +00:00
|
|
|
CreatePeerConnectionFactory(
|
2014-07-29 17:36:52 +00:00
|
|
|
rtc::Thread* worker_thread,
|
|
|
|
|
rtc::Thread* signaling_thread,
|
2013-07-10 00:45:36 +00:00
|
|
|
AudioDeviceModule* default_adm,
|
|
|
|
|
cricket::WebRtcVideoEncoderFactory* encoder_factory,
|
|
|
|
|
cricket::WebRtcVideoDecoderFactory* decoder_factory) {
|
2014-07-29 17:36:52 +00:00
|
|
|
rtc::scoped_refptr<PeerConnectionFactory> pc_factory(
|
|
|
|
|
new rtc::RefCountedObject<PeerConnectionFactory>(worker_thread,
|
2015-01-12 08:30:16 +00:00
|
|
|
signaling_thread,
|
|
|
|
|
default_adm,
|
|
|
|
|
encoder_factory,
|
|
|
|
|
decoder_factory));
|
|
|
|
|
|
|
|
|
|
// Call Initialize synchronously but make sure its executed on
|
|
|
|
|
// |signaling_thread|.
|
|
|
|
|
MethodCall0<PeerConnectionFactory, bool> call(
|
|
|
|
|
pc_factory.get(),
|
|
|
|
|
&PeerConnectionFactory::Initialize);
|
|
|
|
|
bool result = call.Marshal(signaling_thread);
|
|
|
|
|
|
|
|
|
|
if (!result) {
|
2013-07-10 00:45:36 +00:00
|
|
|
return NULL;
|
|
|
|
|
}
|
2015-01-12 08:30:16 +00:00
|
|
|
return PeerConnectionFactoryProxy::Create(signaling_thread, pc_factory);
|
2013-07-10 00:45:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PeerConnectionFactory::PeerConnectionFactory()
|
|
|
|
|
: owns_ptrs_(true),
|
2015-01-12 08:30:16 +00:00
|
|
|
wraps_current_thread_(false),
|
|
|
|
|
signaling_thread_(rtc::ThreadManager::Instance()->CurrentThread()),
|
2014-07-29 17:36:52 +00:00
|
|
|
worker_thread_(new rtc::Thread) {
|
2015-01-12 08:30:16 +00:00
|
|
|
if (!signaling_thread_) {
|
|
|
|
|
signaling_thread_ = rtc::ThreadManager::Instance()->WrapCurrentThread();
|
|
|
|
|
wraps_current_thread_ = true;
|
|
|
|
|
}
|
|
|
|
|
worker_thread_->Start();
|
2013-07-10 00:45:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PeerConnectionFactory::PeerConnectionFactory(
|
2014-07-29 17:36:52 +00:00
|
|
|
rtc::Thread* worker_thread,
|
|
|
|
|
rtc::Thread* signaling_thread,
|
2013-07-10 00:45:36 +00:00
|
|
|
AudioDeviceModule* default_adm,
|
|
|
|
|
cricket::WebRtcVideoEncoderFactory* video_encoder_factory,
|
|
|
|
|
cricket::WebRtcVideoDecoderFactory* video_decoder_factory)
|
|
|
|
|
: owns_ptrs_(false),
|
2015-01-12 08:30:16 +00:00
|
|
|
wraps_current_thread_(false),
|
2013-07-10 00:45:36 +00:00
|
|
|
signaling_thread_(signaling_thread),
|
|
|
|
|
worker_thread_(worker_thread),
|
|
|
|
|
default_adm_(default_adm),
|
|
|
|
|
video_encoder_factory_(video_encoder_factory),
|
|
|
|
|
video_decoder_factory_(video_decoder_factory) {
|
|
|
|
|
ASSERT(worker_thread != NULL);
|
|
|
|
|
ASSERT(signaling_thread != NULL);
|
|
|
|
|
// TODO: Currently there is no way creating an external adm in
|
|
|
|
|
// libjingle source tree. So we can 't currently assert if this is NULL.
|
|
|
|
|
// ASSERT(default_adm != NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PeerConnectionFactory::~PeerConnectionFactory() {
|
2015-09-17 00:24:34 -07:00
|
|
|
RTC_DCHECK(signaling_thread_->IsCurrent());
|
2015-08-11 10:33:13 +02:00
|
|
|
channel_manager_.reset(nullptr);
|
2015-03-13 21:26:12 +00:00
|
|
|
|
|
|
|
|
// Make sure |worker_thread_| and |signaling_thread_| outlive
|
2015-12-01 15:01:24 -08:00
|
|
|
// |dtls_identity_store_|, |default_socket_factory_| and
|
|
|
|
|
// |default_network_manager_|.
|
2015-08-11 10:33:13 +02:00
|
|
|
dtls_identity_store_ = nullptr;
|
2015-12-01 15:01:24 -08:00
|
|
|
default_socket_factory_ = nullptr;
|
|
|
|
|
default_network_manager_ = nullptr;
|
2015-03-13 21:26:12 +00:00
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
if (owns_ptrs_) {
|
2015-01-12 08:30:16 +00:00
|
|
|
if (wraps_current_thread_)
|
|
|
|
|
rtc::ThreadManager::Instance()->UnwrapCurrentThread();
|
2014-04-17 22:54:30 +00:00
|
|
|
delete worker_thread_;
|
2013-07-10 00:45:36 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool PeerConnectionFactory::Initialize() {
|
2015-09-17 00:24:34 -07:00
|
|
|
RTC_DCHECK(signaling_thread_->IsCurrent());
|
2014-07-29 17:36:52 +00:00
|
|
|
rtc::InitRandom(rtc::Time());
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2015-12-01 15:01:24 -08:00
|
|
|
default_network_manager_.reset(new rtc::BasicNetworkManager());
|
|
|
|
|
if (!default_network_manager_) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
default_socket_factory_.reset(
|
|
|
|
|
new rtc::BasicPacketSocketFactory(worker_thread_));
|
|
|
|
|
if (!default_socket_factory_) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2013-07-10 00:45:36 +00:00
|
|
|
|
|
|
|
|
// TODO: Need to make sure only one VoE is created inside
|
|
|
|
|
// WebRtcMediaEngine.
|
2015-02-11 08:38:35 +00:00
|
|
|
cricket::MediaEngineInterface* media_engine =
|
|
|
|
|
worker_thread_->Invoke<cricket::MediaEngineInterface*>(rtc::Bind(
|
|
|
|
|
&PeerConnectionFactory::CreateMediaEngine_w, this));
|
2013-07-10 00:45:36 +00:00
|
|
|
|
2015-09-24 00:41:50 -07:00
|
|
|
channel_manager_.reset(
|
|
|
|
|
new cricket::ChannelManager(media_engine, worker_thread_));
|
2015-02-11 08:38:35 +00:00
|
|
|
|
2014-06-09 12:51:39 +00:00
|
|
|
channel_manager_->SetVideoRtxEnabled(true);
|
2013-07-10 00:45:36 +00:00
|
|
|
if (!channel_manager_->Init()) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2015-03-04 22:17:38 +00:00
|
|
|
|
2015-08-11 10:33:13 +02:00
|
|
|
dtls_identity_store_ = new RefCountedDtlsIdentityStore(
|
|
|
|
|
signaling_thread_, worker_thread_);
|
2015-03-04 22:17:38 +00:00
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-29 17:36:52 +00:00
|
|
|
rtc::scoped_refptr<AudioSourceInterface>
|
2015-01-12 08:30:16 +00:00
|
|
|
PeerConnectionFactory::CreateAudioSource(
|
2013-07-10 00:45:36 +00:00
|
|
|
const MediaConstraintsInterface* constraints) {
|
2015-09-17 00:24:34 -07:00
|
|
|
RTC_DCHECK(signaling_thread_->IsCurrent());
|
2014-07-29 17:36:52 +00:00
|
|
|
rtc::scoped_refptr<LocalAudioSource> source(
|
2013-10-25 21:18:33 +00:00
|
|
|
LocalAudioSource::Create(options_, constraints));
|
2013-07-10 00:45:36 +00:00
|
|
|
return source;
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-29 17:36:52 +00:00
|
|
|
rtc::scoped_refptr<VideoSourceInterface>
|
2015-01-12 08:30:16 +00:00
|
|
|
PeerConnectionFactory::CreateVideoSource(
|
2013-07-10 00:45:36 +00:00
|
|
|
cricket::VideoCapturer* capturer,
|
|
|
|
|
const MediaConstraintsInterface* constraints) {
|
2015-09-17 00:24:34 -07:00
|
|
|
RTC_DCHECK(signaling_thread_->IsCurrent());
|
2015-12-15 04:27:11 -08:00
|
|
|
rtc::scoped_refptr<VideoSource> source(VideoSource::Create(
|
|
|
|
|
channel_manager_.get(), capturer, constraints, false));
|
2013-07-10 00:45:36 +00:00
|
|
|
return VideoSourceProxy::Create(signaling_thread_, source);
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-15 03:06:36 -08:00
|
|
|
bool PeerConnectionFactory::StartAecDump(rtc::PlatformFile file,
|
|
|
|
|
int64_t max_size_bytes) {
|
2015-09-17 00:24:34 -07:00
|
|
|
RTC_DCHECK(signaling_thread_->IsCurrent());
|
2016-01-15 03:06:36 -08:00
|
|
|
return channel_manager_->StartAecDump(file, max_size_bytes);
|
2013-12-13 00:21:03 +00:00
|
|
|
}
|
|
|
|
|
|
2015-10-22 03:25:41 -07:00
|
|
|
void PeerConnectionFactory::StopAecDump() {
|
|
|
|
|
RTC_DCHECK(signaling_thread_->IsCurrent());
|
|
|
|
|
channel_manager_->StopAecDump();
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-16 02:22:18 -07:00
|
|
|
bool PeerConnectionFactory::StartRtcEventLog(rtc::PlatformFile file) {
|
|
|
|
|
RTC_DCHECK(signaling_thread_->IsCurrent());
|
|
|
|
|
return channel_manager_->StartRtcEventLog(file);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PeerConnectionFactory::StopRtcEventLog() {
|
|
|
|
|
RTC_DCHECK(signaling_thread_->IsCurrent());
|
|
|
|
|
channel_manager_->StopRtcEventLog();
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-01 15:01:24 -08:00
|
|
|
rtc::scoped_refptr<PeerConnectionInterface>
|
|
|
|
|
PeerConnectionFactory::CreatePeerConnection(
|
|
|
|
|
const PeerConnectionInterface::RTCConfiguration& configuration,
|
|
|
|
|
const MediaConstraintsInterface* constraints,
|
|
|
|
|
rtc::scoped_ptr<cricket::PortAllocator> allocator,
|
|
|
|
|
rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
|
|
|
|
|
PeerConnectionObserver* observer) {
|
|
|
|
|
RTC_DCHECK(signaling_thread_->IsCurrent());
|
|
|
|
|
|
|
|
|
|
if (!dtls_identity_store.get()) {
|
|
|
|
|
// Because |pc|->Initialize takes ownership of the store we need a new
|
|
|
|
|
// wrapper object that can be deleted without deleting the underlying
|
|
|
|
|
// |dtls_identity_store_|, protecting it from being deleted multiple times.
|
|
|
|
|
dtls_identity_store.reset(
|
|
|
|
|
new DtlsIdentityStoreWrapper(dtls_identity_store_));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!allocator) {
|
|
|
|
|
allocator.reset(new cricket::BasicPortAllocator(
|
|
|
|
|
default_network_manager_.get(), default_socket_factory_.get()));
|
|
|
|
|
}
|
2015-12-29 14:14:52 -08:00
|
|
|
allocator->SetNetworkIgnoreMask(options_.network_ignore_mask);
|
2015-12-01 15:01:24 -08:00
|
|
|
|
|
|
|
|
rtc::scoped_refptr<PeerConnection> pc(
|
|
|
|
|
new rtc::RefCountedObject<PeerConnection>(this));
|
|
|
|
|
if (!pc->Initialize(configuration, constraints, std::move(allocator),
|
|
|
|
|
std::move(dtls_identity_store), observer)) {
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
return PeerConnectionProxy::Create(signaling_thread(), pc);
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-29 17:36:52 +00:00
|
|
|
rtc::scoped_refptr<MediaStreamInterface>
|
2013-07-10 00:45:36 +00:00
|
|
|
PeerConnectionFactory::CreateLocalMediaStream(const std::string& label) {
|
2015-09-17 00:24:34 -07:00
|
|
|
RTC_DCHECK(signaling_thread_->IsCurrent());
|
2013-07-10 00:45:36 +00:00
|
|
|
return MediaStreamProxy::Create(signaling_thread_,
|
|
|
|
|
MediaStream::Create(label));
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-29 17:36:52 +00:00
|
|
|
rtc::scoped_refptr<VideoTrackInterface>
|
2013-07-10 00:45:36 +00:00
|
|
|
PeerConnectionFactory::CreateVideoTrack(
|
|
|
|
|
const std::string& id,
|
|
|
|
|
VideoSourceInterface* source) {
|
2015-09-17 00:24:34 -07:00
|
|
|
RTC_DCHECK(signaling_thread_->IsCurrent());
|
2014-07-29 17:36:52 +00:00
|
|
|
rtc::scoped_refptr<VideoTrackInterface> track(
|
2013-07-10 00:45:36 +00:00
|
|
|
VideoTrack::Create(id, source));
|
|
|
|
|
return VideoTrackProxy::Create(signaling_thread_, track);
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-29 17:36:52 +00:00
|
|
|
rtc::scoped_refptr<AudioTrackInterface>
|
2014-05-13 11:07:01 +00:00
|
|
|
PeerConnectionFactory::CreateAudioTrack(const std::string& id,
|
|
|
|
|
AudioSourceInterface* source) {
|
2015-09-17 00:24:34 -07:00
|
|
|
RTC_DCHECK(signaling_thread_->IsCurrent());
|
2015-12-15 04:27:11 -08:00
|
|
|
rtc::scoped_refptr<AudioTrackInterface> track(AudioTrack::Create(id, source));
|
2013-07-10 00:45:36 +00:00
|
|
|
return AudioTrackProxy::Create(signaling_thread_, track);
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-15 07:26:07 -07:00
|
|
|
webrtc::MediaControllerInterface* PeerConnectionFactory::CreateMediaController()
|
|
|
|
|
const {
|
2015-09-17 00:24:34 -07:00
|
|
|
RTC_DCHECK(signaling_thread_->IsCurrent());
|
2015-10-15 07:26:07 -07:00
|
|
|
return MediaControllerInterface::Create(worker_thread_,
|
|
|
|
|
channel_manager_.get());
|
2013-07-10 00:45:36 +00:00
|
|
|
}
|
|
|
|
|
|
2014-07-29 17:36:52 +00:00
|
|
|
rtc::Thread* PeerConnectionFactory::signaling_thread() {
|
2015-01-12 08:30:16 +00:00
|
|
|
// This method can be called on a different thread when the factory is
|
|
|
|
|
// created in CreatePeerConnectionFactory().
|
2013-07-10 00:45:36 +00:00
|
|
|
return signaling_thread_;
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-29 17:36:52 +00:00
|
|
|
rtc::Thread* PeerConnectionFactory::worker_thread() {
|
2015-09-17 00:24:34 -07:00
|
|
|
RTC_DCHECK(signaling_thread_->IsCurrent());
|
2013-07-10 00:45:36 +00:00
|
|
|
return worker_thread_;
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-11 08:38:35 +00:00
|
|
|
cricket::MediaEngineInterface* PeerConnectionFactory::CreateMediaEngine_w() {
|
|
|
|
|
ASSERT(worker_thread_ == rtc::Thread::Current());
|
|
|
|
|
return cricket::WebRtcMediaEngineFactory::Create(
|
2015-05-19 11:37:56 +02:00
|
|
|
default_adm_.get(), video_encoder_factory_.get(),
|
2015-02-11 08:38:35 +00:00
|
|
|
video_decoder_factory_.get());
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-10 00:45:36 +00:00
|
|
|
} // namespace webrtc
|