blob: c357de9b32b17697e1f28bd7e3735f04f3ae3d34 [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
kwibergd1fe2812016-04-27 06:47:29 -070014#include <memory>
perkj@webrtc.org81134d02015-01-12 08:30:16 +000015#include <string>
kwiberg0eb15ed2015-12-17 03:04:15 -080016#include <utility>
perkj@webrtc.org81134d02015-01-12 08:30:16 +000017
Henrik Kjellander15583c12016-02-10 10:53:12 +010018#include "webrtc/api/peerconnectioninterface.h"
19#include "webrtc/api/proxy.h"
Henrik Boström5e56c592015-08-11 10:33:13 +020020#include "webrtc/base/bind.h"
perkj@webrtc.org81134d02015-01-12 08:30:16 +000021
22namespace webrtc {
23
nisse72c8d2b2016-04-15 03:49:07 -070024BEGIN_SIGNALING_PROXY_MAP(PeerConnectionFactory)
perkj@webrtc.org81134d02015-01-12 08:30:16 +000025 PROXY_METHOD1(void, SetOptions, const Options&)
kwibergd1fe2812016-04-27 06:47:29 -070026 // Can't use PROXY_METHOD5 because unique_ptr must be moved.
27 // TODO(tommi,hbos): Use of templates to support unique_ptr?
Henrik Boström5e56c592015-08-11 10:33:13 +020028 rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection(
29 const PeerConnectionInterface::RTCConfiguration& a1,
30 const MediaConstraintsInterface* a2,
kwibergd1fe2812016-04-27 06:47:29 -070031 std::unique_ptr<cricket::PortAllocator> a3,
hbosd7973cc2016-05-27 06:08:53 -070032 std::unique_ptr<DtlsIdentityStoreInterface> a4,
deadbeef41b07982015-12-01 15:01:24 -080033 PeerConnectionObserver* a5) override {
nisse5b68ab52016-04-07 07:45:54 -070034 return signaling_thread_
35 ->Invoke<rtc::scoped_refptr<PeerConnectionInterface>>(
36 rtc::Bind(&PeerConnectionFactoryProxy::CreatePeerConnection_ot,
37 this, a1, a2, a3.release(), a4.release(), a5));
deadbeef41b07982015-12-01 15:01:24 -080038 }
htaa2a49d92016-03-04 02:51:39 -080039 rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection(
40 const PeerConnectionInterface::RTCConfiguration& a1,
kwibergd1fe2812016-04-27 06:47:29 -070041 std::unique_ptr<cricket::PortAllocator> a3,
hbosd7973cc2016-05-27 06:08:53 -070042 std::unique_ptr<DtlsIdentityStoreInterface> a4,
htaa2a49d92016-03-04 02:51:39 -080043 PeerConnectionObserver* a5) override {
nisse5b68ab52016-04-07 07:45:54 -070044 return signaling_thread_
45 ->Invoke<rtc::scoped_refptr<PeerConnectionInterface>>(
46 rtc::Bind(&PeerConnectionFactoryProxy::CreatePeerConnection_ot,
47 this, a1, a3.release(), a4.release(), a5));
htaa2a49d92016-03-04 02:51:39 -080048 }
perkj@webrtc.org81134d02015-01-12 08:30:16 +000049 PROXY_METHOD1(rtc::scoped_refptr<MediaStreamInterface>,
50 CreateLocalMediaStream, const std::string&)
51 PROXY_METHOD1(rtc::scoped_refptr<AudioSourceInterface>,
52 CreateAudioSource, const MediaConstraintsInterface*)
htaa2a49d92016-03-04 02:51:39 -080053 PROXY_METHOD1(rtc::scoped_refptr<AudioSourceInterface>,
54 CreateAudioSource,
55 const cricket::AudioOptions&)
perkja3ede6c2016-03-08 01:27:48 +010056 PROXY_METHOD2(rtc::scoped_refptr<VideoTrackSourceInterface>,
57 CreateVideoSource,
58 cricket::VideoCapturer*,
perkj@webrtc.org81134d02015-01-12 08:30:16 +000059 const MediaConstraintsInterface*)
perkja3ede6c2016-03-08 01:27:48 +010060 PROXY_METHOD1(rtc::scoped_refptr<VideoTrackSourceInterface>,
htaa2a49d92016-03-04 02:51:39 -080061 CreateVideoSource,
62 cricket::VideoCapturer*)
perkj@webrtc.org81134d02015-01-12 08:30:16 +000063 PROXY_METHOD2(rtc::scoped_refptr<VideoTrackInterface>,
perkja3ede6c2016-03-08 01:27:48 +010064 CreateVideoTrack,
65 const std::string&,
66 VideoTrackSourceInterface*)
perkj@webrtc.org81134d02015-01-12 08:30:16 +000067 PROXY_METHOD2(rtc::scoped_refptr<AudioTrackInterface>,
68 CreateAudioTrack, const std::string&, AudioSourceInterface*)
ivocd66b44d2016-01-15 03:06:36 -080069 PROXY_METHOD2(bool, StartAecDump, rtc::PlatformFile, int64_t)
ivoc797ef122015-10-22 03:25:41 -070070 PROXY_METHOD0(void, StopAecDump)
ivoc112a3d82015-10-16 02:22:18 -070071 PROXY_METHOD1(bool, StartRtcEventLog, rtc::PlatformFile)
ivocc1513ee2016-05-13 08:30:39 -070072 PROXY_METHOD2(bool, StartRtcEventLog, rtc::PlatformFile, int64_t)
ivoc112a3d82015-10-16 02:22:18 -070073 PROXY_METHOD0(void, StopRtcEventLog)
Henrik Boström5e56c592015-08-11 10:33:13 +020074
75 private:
Taylor Brandstetter0c7e9f52015-12-29 14:14:52 -080076 rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection_ot(
deadbeef41b07982015-12-01 15:01:24 -080077 const PeerConnectionInterface::RTCConfiguration& a1,
78 const MediaConstraintsInterface* a2,
79 cricket::PortAllocator* a3,
hbosd7973cc2016-05-27 06:08:53 -070080 DtlsIdentityStoreInterface* a4,
deadbeef41b07982015-12-01 15:01:24 -080081 PeerConnectionObserver* a5) {
kwibergd1fe2812016-04-27 06:47:29 -070082 std::unique_ptr<cricket::PortAllocator> ptr_a3(a3);
hbosd7973cc2016-05-27 06:08:53 -070083 std::unique_ptr<DtlsIdentityStoreInterface> ptr_a4(a4);
kwiberg0eb15ed2015-12-17 03:04:15 -080084 return c_->CreatePeerConnection(a1, a2, std::move(ptr_a3),
85 std::move(ptr_a4), a5);
deadbeef41b07982015-12-01 15:01:24 -080086 }
htaa2a49d92016-03-04 02:51:39 -080087
88 rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection_ot(
89 const PeerConnectionInterface::RTCConfiguration& a1,
90 cricket::PortAllocator* a3,
hbosd7973cc2016-05-27 06:08:53 -070091 DtlsIdentityStoreInterface* a4,
htaa2a49d92016-03-04 02:51:39 -080092 PeerConnectionObserver* a5) {
kwibergd1fe2812016-04-27 06:47:29 -070093 std::unique_ptr<cricket::PortAllocator> ptr_a3(a3);
hbosd7973cc2016-05-27 06:08:53 -070094 std::unique_ptr<DtlsIdentityStoreInterface> ptr_a4(a4);
htaa2a49d92016-03-04 02:51:39 -080095 return c_->CreatePeerConnection(a1, std::move(ptr_a3), std::move(ptr_a4),
96 a5);
97 }
nisse72c8d2b2016-04-15 03:49:07 -070098 END_SIGNALING_PROXY()
perkj@webrtc.org81134d02015-01-12 08:30:16 +000099
100} // namespace webrtc
101
Henrik Kjellander15583c12016-02-10 10:53:12 +0100102#endif // WEBRTC_API_PEERCONNECTIONFACTORYPROXY_H_