blob: ef47cdb869afccbd90e4b2ff2f7e604eb720d92e [file] [log] [blame]
perkj@webrtc.org81134d02015-01-12 08:30:16 +00001/*
kjellanderb24317b2016-02-10 07:54:43 -08002 * Copyright 2014 The WebRTC project authors. All Rights Reserved.
perkj@webrtc.org81134d02015-01-12 08:30:16 +00003 *
kjellanderb24317b2016-02-10 07:54:43 -08004 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
perkj@webrtc.org81134d02015-01-12 08:30:16 +00009 */
jlmiller@webrtc.org5f93d0a2015-01-20 21:36:13 +000010
Henrik Kjellander15583c12016-02-10 10:53:12 +010011#ifndef WEBRTC_API_PEERCONNECTIONFACTORYPROXY_H_
12#define WEBRTC_API_PEERCONNECTIONFACTORYPROXY_H_
perkj@webrtc.org81134d02015-01-12 08:30:16 +000013
14#include <string>
kwiberg0eb15ed2015-12-17 03:04:15 -080015#include <utility>
perkj@webrtc.org81134d02015-01-12 08:30:16 +000016
Henrik Kjellander15583c12016-02-10 10:53:12 +010017#include "webrtc/api/peerconnectioninterface.h"
18#include "webrtc/api/proxy.h"
Henrik Boström5e56c592015-08-11 10:33:13 +020019#include "webrtc/base/bind.h"
perkj@webrtc.org81134d02015-01-12 08:30:16 +000020
21namespace webrtc {
22
nisse72c8d2b2016-04-15 03:49:07 -070023BEGIN_SIGNALING_PROXY_MAP(PeerConnectionFactory)
perkj@webrtc.org81134d02015-01-12 08:30:16 +000024 PROXY_METHOD1(void, SetOptions, const Options&)
kwiberg0eb15ed2015-12-17 03:04:15 -080025 // Can't use PROXY_METHOD5 because scoped_ptr must be moved.
Henrik Boström5e56c592015-08-11 10:33:13 +020026 // TODO(tommi,hbos): Use of templates to support scoped_ptr?
27 rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection(
28 const PeerConnectionInterface::RTCConfiguration& a1,
29 const MediaConstraintsInterface* a2,
deadbeef41b07982015-12-01 15:01:24 -080030 rtc::scoped_ptr<cricket::PortAllocator> a3,
31 rtc::scoped_ptr<DtlsIdentityStoreInterface> a4,
32 PeerConnectionObserver* a5) override {
nisse5b68ab52016-04-07 07:45:54 -070033 return signaling_thread_
34 ->Invoke<rtc::scoped_refptr<PeerConnectionInterface>>(
35 rtc::Bind(&PeerConnectionFactoryProxy::CreatePeerConnection_ot,
36 this, a1, a2, a3.release(), a4.release(), a5));
deadbeef41b07982015-12-01 15:01:24 -080037 }
htaa2a49d92016-03-04 02:51:39 -080038 rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection(
39 const PeerConnectionInterface::RTCConfiguration& a1,
40 rtc::scoped_ptr<cricket::PortAllocator> a3,
41 rtc::scoped_ptr<DtlsIdentityStoreInterface> a4,
42 PeerConnectionObserver* a5) override {
nisse5b68ab52016-04-07 07:45:54 -070043 return signaling_thread_
44 ->Invoke<rtc::scoped_refptr<PeerConnectionInterface>>(
45 rtc::Bind(&PeerConnectionFactoryProxy::CreatePeerConnection_ot,
46 this, a1, a3.release(), a4.release(), a5));
htaa2a49d92016-03-04 02:51:39 -080047 }
perkj@webrtc.org81134d02015-01-12 08:30:16 +000048 PROXY_METHOD1(rtc::scoped_refptr<MediaStreamInterface>,
49 CreateLocalMediaStream, const std::string&)
50 PROXY_METHOD1(rtc::scoped_refptr<AudioSourceInterface>,
51 CreateAudioSource, const MediaConstraintsInterface*)
htaa2a49d92016-03-04 02:51:39 -080052 PROXY_METHOD1(rtc::scoped_refptr<AudioSourceInterface>,
53 CreateAudioSource,
54 const cricket::AudioOptions&)
perkja3ede6c2016-03-08 01:27:48 +010055 PROXY_METHOD2(rtc::scoped_refptr<VideoTrackSourceInterface>,
56 CreateVideoSource,
57 cricket::VideoCapturer*,
perkj@webrtc.org81134d02015-01-12 08:30:16 +000058 const MediaConstraintsInterface*)
perkja3ede6c2016-03-08 01:27:48 +010059 PROXY_METHOD1(rtc::scoped_refptr<VideoTrackSourceInterface>,
htaa2a49d92016-03-04 02:51:39 -080060 CreateVideoSource,
61 cricket::VideoCapturer*)
perkj@webrtc.org81134d02015-01-12 08:30:16 +000062 PROXY_METHOD2(rtc::scoped_refptr<VideoTrackInterface>,
perkja3ede6c2016-03-08 01:27:48 +010063 CreateVideoTrack,
64 const std::string&,
65 VideoTrackSourceInterface*)
perkj@webrtc.org81134d02015-01-12 08:30:16 +000066 PROXY_METHOD2(rtc::scoped_refptr<AudioTrackInterface>,
67 CreateAudioTrack, const std::string&, AudioSourceInterface*)
ivocd66b44d2016-01-15 03:06:36 -080068 PROXY_METHOD2(bool, StartAecDump, rtc::PlatformFile, int64_t)
ivoc797ef122015-10-22 03:25:41 -070069 PROXY_METHOD0(void, StopAecDump)
ivoc112a3d82015-10-16 02:22:18 -070070 PROXY_METHOD1(bool, StartRtcEventLog, rtc::PlatformFile)
71 PROXY_METHOD0(void, StopRtcEventLog)
Henrik Boström5e56c592015-08-11 10:33:13 +020072
73 private:
Taylor Brandstetter0c7e9f52015-12-29 14:14:52 -080074 rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection_ot(
deadbeef41b07982015-12-01 15:01:24 -080075 const PeerConnectionInterface::RTCConfiguration& a1,
76 const MediaConstraintsInterface* a2,
77 cricket::PortAllocator* a3,
78 DtlsIdentityStoreInterface* a4,
79 PeerConnectionObserver* a5) {
80 rtc::scoped_ptr<cricket::PortAllocator> ptr_a3(a3);
81 rtc::scoped_ptr<DtlsIdentityStoreInterface> ptr_a4(a4);
kwiberg0eb15ed2015-12-17 03:04:15 -080082 return c_->CreatePeerConnection(a1, a2, std::move(ptr_a3),
83 std::move(ptr_a4), a5);
deadbeef41b07982015-12-01 15:01:24 -080084 }
htaa2a49d92016-03-04 02:51:39 -080085
86 rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection_ot(
87 const PeerConnectionInterface::RTCConfiguration& a1,
88 cricket::PortAllocator* a3,
89 DtlsIdentityStoreInterface* a4,
90 PeerConnectionObserver* a5) {
91 rtc::scoped_ptr<cricket::PortAllocator> ptr_a3(a3);
92 rtc::scoped_ptr<DtlsIdentityStoreInterface> ptr_a4(a4);
93 return c_->CreatePeerConnection(a1, std::move(ptr_a3), std::move(ptr_a4),
94 a5);
95 }
nisse72c8d2b2016-04-15 03:49:07 -070096 END_SIGNALING_PROXY()
perkj@webrtc.org81134d02015-01-12 08:30:16 +000097
98} // namespace webrtc
99
Henrik Kjellander15583c12016-02-10 10:53:12 +0100100#endif // WEBRTC_API_PEERCONNECTIONFACTORYPROXY_H_