perkj@webrtc.org | 81134d0 | 2015-01-12 08:30:16 +0000 | [diff] [blame] | 1 | /* |
kjellander | b24317b | 2016-02-10 07:54:43 -0800 | [diff] [blame] | 2 | * Copyright 2014 The WebRTC project authors. All Rights Reserved. |
perkj@webrtc.org | 81134d0 | 2015-01-12 08:30:16 +0000 | [diff] [blame] | 3 | * |
kjellander | b24317b | 2016-02-10 07:54:43 -0800 | [diff] [blame] | 4 | * 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.org | 81134d0 | 2015-01-12 08:30:16 +0000 | [diff] [blame] | 9 | */ |
jlmiller@webrtc.org | 5f93d0a | 2015-01-20 21:36:13 +0000 | [diff] [blame] | 10 | |
Henrik Kjellander | 15583c1 | 2016-02-10 10:53:12 +0100 | [diff] [blame] | 11 | #ifndef WEBRTC_API_PEERCONNECTIONFACTORYPROXY_H_ |
| 12 | #define WEBRTC_API_PEERCONNECTIONFACTORYPROXY_H_ |
perkj@webrtc.org | 81134d0 | 2015-01-12 08:30:16 +0000 | [diff] [blame] | 13 | |
| 14 | #include <string> |
kwiberg | 0eb15ed | 2015-12-17 03:04:15 -0800 | [diff] [blame] | 15 | #include <utility> |
perkj@webrtc.org | 81134d0 | 2015-01-12 08:30:16 +0000 | [diff] [blame] | 16 | |
Henrik Kjellander | 15583c1 | 2016-02-10 10:53:12 +0100 | [diff] [blame] | 17 | #include "webrtc/api/peerconnectioninterface.h" |
| 18 | #include "webrtc/api/proxy.h" |
Henrik Boström | 5e56c59 | 2015-08-11 10:33:13 +0200 | [diff] [blame] | 19 | #include "webrtc/base/bind.h" |
perkj@webrtc.org | 81134d0 | 2015-01-12 08:30:16 +0000 | [diff] [blame] | 20 | |
| 21 | namespace webrtc { |
| 22 | |
| 23 | BEGIN_PROXY_MAP(PeerConnectionFactory) |
| 24 | PROXY_METHOD1(void, SetOptions, const Options&) |
kwiberg | 0eb15ed | 2015-12-17 03:04:15 -0800 | [diff] [blame] | 25 | // Can't use PROXY_METHOD5 because scoped_ptr must be moved. |
Henrik Boström | 5e56c59 | 2015-08-11 10:33:13 +0200 | [diff] [blame] | 26 | // 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, |
deadbeef | 41b0798 | 2015-12-01 15:01:24 -0800 | [diff] [blame] | 30 | rtc::scoped_ptr<cricket::PortAllocator> a3, |
| 31 | rtc::scoped_ptr<DtlsIdentityStoreInterface> a4, |
| 32 | PeerConnectionObserver* a5) override { |
| 33 | return owner_thread_->Invoke<rtc::scoped_refptr<PeerConnectionInterface>>( |
Taylor Brandstetter | 0c7e9f5 | 2015-12-29 14:14:52 -0800 | [diff] [blame] | 34 | rtc::Bind(&PeerConnectionFactoryProxy::CreatePeerConnection_ot, this, |
deadbeef | 41b0798 | 2015-12-01 15:01:24 -0800 | [diff] [blame] | 35 | a1, a2, a3.release(), a4.release(), a5)); |
| 36 | } |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame^] | 37 | rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection( |
| 38 | const PeerConnectionInterface::RTCConfiguration& a1, |
| 39 | rtc::scoped_ptr<cricket::PortAllocator> a3, |
| 40 | rtc::scoped_ptr<DtlsIdentityStoreInterface> a4, |
| 41 | PeerConnectionObserver* a5) override { |
| 42 | return owner_thread_->Invoke<rtc::scoped_refptr<PeerConnectionInterface>>( |
| 43 | rtc::Bind(&PeerConnectionFactoryProxy::CreatePeerConnection_ot, this, |
| 44 | a1, a3.release(), a4.release(), a5)); |
| 45 | } |
perkj@webrtc.org | 81134d0 | 2015-01-12 08:30:16 +0000 | [diff] [blame] | 46 | PROXY_METHOD1(rtc::scoped_refptr<MediaStreamInterface>, |
| 47 | CreateLocalMediaStream, const std::string&) |
| 48 | PROXY_METHOD1(rtc::scoped_refptr<AudioSourceInterface>, |
| 49 | CreateAudioSource, const MediaConstraintsInterface*) |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame^] | 50 | PROXY_METHOD1(rtc::scoped_refptr<AudioSourceInterface>, |
| 51 | CreateAudioSource, |
| 52 | const cricket::AudioOptions&) |
perkj@webrtc.org | 81134d0 | 2015-01-12 08:30:16 +0000 | [diff] [blame] | 53 | PROXY_METHOD2(rtc::scoped_refptr<VideoSourceInterface>, |
| 54 | CreateVideoSource, cricket::VideoCapturer*, |
| 55 | const MediaConstraintsInterface*) |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame^] | 56 | PROXY_METHOD1(rtc::scoped_refptr<VideoSourceInterface>, |
| 57 | CreateVideoSource, |
| 58 | cricket::VideoCapturer*) |
perkj@webrtc.org | 81134d0 | 2015-01-12 08:30:16 +0000 | [diff] [blame] | 59 | PROXY_METHOD2(rtc::scoped_refptr<VideoTrackInterface>, |
| 60 | CreateVideoTrack, const std::string&, VideoSourceInterface*) |
| 61 | PROXY_METHOD2(rtc::scoped_refptr<AudioTrackInterface>, |
| 62 | CreateAudioTrack, const std::string&, AudioSourceInterface*) |
ivoc | d66b44d | 2016-01-15 03:06:36 -0800 | [diff] [blame] | 63 | PROXY_METHOD2(bool, StartAecDump, rtc::PlatformFile, int64_t) |
ivoc | 797ef12 | 2015-10-22 03:25:41 -0700 | [diff] [blame] | 64 | PROXY_METHOD0(void, StopAecDump) |
ivoc | 112a3d8 | 2015-10-16 02:22:18 -0700 | [diff] [blame] | 65 | PROXY_METHOD1(bool, StartRtcEventLog, rtc::PlatformFile) |
| 66 | PROXY_METHOD0(void, StopRtcEventLog) |
Henrik Boström | 5e56c59 | 2015-08-11 10:33:13 +0200 | [diff] [blame] | 67 | |
| 68 | private: |
Taylor Brandstetter | 0c7e9f5 | 2015-12-29 14:14:52 -0800 | [diff] [blame] | 69 | rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection_ot( |
deadbeef | 41b0798 | 2015-12-01 15:01:24 -0800 | [diff] [blame] | 70 | const PeerConnectionInterface::RTCConfiguration& a1, |
| 71 | const MediaConstraintsInterface* a2, |
| 72 | cricket::PortAllocator* a3, |
| 73 | DtlsIdentityStoreInterface* a4, |
| 74 | PeerConnectionObserver* a5) { |
| 75 | rtc::scoped_ptr<cricket::PortAllocator> ptr_a3(a3); |
| 76 | rtc::scoped_ptr<DtlsIdentityStoreInterface> ptr_a4(a4); |
kwiberg | 0eb15ed | 2015-12-17 03:04:15 -0800 | [diff] [blame] | 77 | return c_->CreatePeerConnection(a1, a2, std::move(ptr_a3), |
| 78 | std::move(ptr_a4), a5); |
deadbeef | 41b0798 | 2015-12-01 15:01:24 -0800 | [diff] [blame] | 79 | } |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame^] | 80 | |
| 81 | rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection_ot( |
| 82 | const PeerConnectionInterface::RTCConfiguration& a1, |
| 83 | cricket::PortAllocator* a3, |
| 84 | DtlsIdentityStoreInterface* a4, |
| 85 | PeerConnectionObserver* a5) { |
| 86 | rtc::scoped_ptr<cricket::PortAllocator> ptr_a3(a3); |
| 87 | rtc::scoped_ptr<DtlsIdentityStoreInterface> ptr_a4(a4); |
| 88 | return c_->CreatePeerConnection(a1, std::move(ptr_a3), std::move(ptr_a4), |
| 89 | a5); |
| 90 | } |
| 91 | END_PROXY() |
perkj@webrtc.org | 81134d0 | 2015-01-12 08:30:16 +0000 | [diff] [blame] | 92 | |
| 93 | } // namespace webrtc |
| 94 | |
Henrik Kjellander | 15583c1 | 2016-02-10 10:53:12 +0100 | [diff] [blame] | 95 | #endif // WEBRTC_API_PEERCONNECTIONFACTORYPROXY_H_ |