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 | |
kwiberg | d1fe281 | 2016-04-27 06:47:29 -0700 | [diff] [blame] | 14 | #include <memory> |
perkj@webrtc.org | 81134d0 | 2015-01-12 08:30:16 +0000 | [diff] [blame] | 15 | #include <string> |
kwiberg | 0eb15ed | 2015-12-17 03:04:15 -0800 | [diff] [blame] | 16 | #include <utility> |
perkj@webrtc.org | 81134d0 | 2015-01-12 08:30:16 +0000 | [diff] [blame] | 17 | |
Henrik Kjellander | 15583c1 | 2016-02-10 10:53:12 +0100 | [diff] [blame] | 18 | #include "webrtc/api/peerconnectioninterface.h" |
| 19 | #include "webrtc/api/proxy.h" |
Henrik Boström | 5e56c59 | 2015-08-11 10:33:13 +0200 | [diff] [blame] | 20 | #include "webrtc/base/bind.h" |
perkj@webrtc.org | 81134d0 | 2015-01-12 08:30:16 +0000 | [diff] [blame] | 21 | |
| 22 | namespace webrtc { |
| 23 | |
nisse | 72c8d2b | 2016-04-15 03:49:07 -0700 | [diff] [blame] | 24 | BEGIN_SIGNALING_PROXY_MAP(PeerConnectionFactory) |
perkj@webrtc.org | 81134d0 | 2015-01-12 08:30:16 +0000 | [diff] [blame] | 25 | PROXY_METHOD1(void, SetOptions, const Options&) |
kwiberg | d1fe281 | 2016-04-27 06:47:29 -0700 | [diff] [blame] | 26 | // Can't use PROXY_METHOD5 because unique_ptr must be moved. |
| 27 | // TODO(tommi,hbos): Use of templates to support unique_ptr? |
Henrik Boström | 5e56c59 | 2015-08-11 10:33:13 +0200 | [diff] [blame] | 28 | rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection( |
| 29 | const PeerConnectionInterface::RTCConfiguration& a1, |
| 30 | const MediaConstraintsInterface* a2, |
kwiberg | d1fe281 | 2016-04-27 06:47:29 -0700 | [diff] [blame] | 31 | std::unique_ptr<cricket::PortAllocator> a3, |
Henrik Boström | d03c23b | 2016-06-01 11:44:18 +0200 | [diff] [blame] | 32 | std::unique_ptr<rtc::RTCCertificateGeneratorInterface> a4, |
deadbeef | 41b0798 | 2015-12-01 15:01:24 -0800 | [diff] [blame] | 33 | PeerConnectionObserver* a5) override { |
nisse | 5b68ab5 | 2016-04-07 07:45:54 -0700 | [diff] [blame] | 34 | return signaling_thread_ |
| 35 | ->Invoke<rtc::scoped_refptr<PeerConnectionInterface>>( |
Taylor Brandstetter | 5d97a9a | 2016-06-10 14:17:27 -0700 | [diff] [blame^] | 36 | RTC_FROM_HERE, |
nisse | 5b68ab5 | 2016-04-07 07:45:54 -0700 | [diff] [blame] | 37 | rtc::Bind(&PeerConnectionFactoryProxy::CreatePeerConnection_ot, |
| 38 | this, a1, a2, a3.release(), a4.release(), a5)); |
deadbeef | 41b0798 | 2015-12-01 15:01:24 -0800 | [diff] [blame] | 39 | } |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame] | 40 | rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection( |
| 41 | const PeerConnectionInterface::RTCConfiguration& a1, |
kwiberg | d1fe281 | 2016-04-27 06:47:29 -0700 | [diff] [blame] | 42 | std::unique_ptr<cricket::PortAllocator> a3, |
Henrik Boström | d03c23b | 2016-06-01 11:44:18 +0200 | [diff] [blame] | 43 | std::unique_ptr<rtc::RTCCertificateGeneratorInterface> a4, |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame] | 44 | PeerConnectionObserver* a5) override { |
nisse | 5b68ab5 | 2016-04-07 07:45:54 -0700 | [diff] [blame] | 45 | return signaling_thread_ |
| 46 | ->Invoke<rtc::scoped_refptr<PeerConnectionInterface>>( |
Taylor Brandstetter | 5d97a9a | 2016-06-10 14:17:27 -0700 | [diff] [blame^] | 47 | RTC_FROM_HERE, |
nisse | 5b68ab5 | 2016-04-07 07:45:54 -0700 | [diff] [blame] | 48 | rtc::Bind(&PeerConnectionFactoryProxy::CreatePeerConnection_ot, |
| 49 | this, a1, a3.release(), a4.release(), a5)); |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame] | 50 | } |
perkj@webrtc.org | 81134d0 | 2015-01-12 08:30:16 +0000 | [diff] [blame] | 51 | PROXY_METHOD1(rtc::scoped_refptr<MediaStreamInterface>, |
| 52 | CreateLocalMediaStream, const std::string&) |
| 53 | PROXY_METHOD1(rtc::scoped_refptr<AudioSourceInterface>, |
| 54 | CreateAudioSource, const MediaConstraintsInterface*) |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame] | 55 | PROXY_METHOD1(rtc::scoped_refptr<AudioSourceInterface>, |
| 56 | CreateAudioSource, |
| 57 | const cricket::AudioOptions&) |
perkj | a3ede6c | 2016-03-08 01:27:48 +0100 | [diff] [blame] | 58 | PROXY_METHOD2(rtc::scoped_refptr<VideoTrackSourceInterface>, |
| 59 | CreateVideoSource, |
| 60 | cricket::VideoCapturer*, |
perkj@webrtc.org | 81134d0 | 2015-01-12 08:30:16 +0000 | [diff] [blame] | 61 | const MediaConstraintsInterface*) |
perkj | a3ede6c | 2016-03-08 01:27:48 +0100 | [diff] [blame] | 62 | PROXY_METHOD1(rtc::scoped_refptr<VideoTrackSourceInterface>, |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame] | 63 | CreateVideoSource, |
| 64 | cricket::VideoCapturer*) |
perkj@webrtc.org | 81134d0 | 2015-01-12 08:30:16 +0000 | [diff] [blame] | 65 | PROXY_METHOD2(rtc::scoped_refptr<VideoTrackInterface>, |
perkj | a3ede6c | 2016-03-08 01:27:48 +0100 | [diff] [blame] | 66 | CreateVideoTrack, |
| 67 | const std::string&, |
| 68 | VideoTrackSourceInterface*) |
perkj@webrtc.org | 81134d0 | 2015-01-12 08:30:16 +0000 | [diff] [blame] | 69 | PROXY_METHOD2(rtc::scoped_refptr<AudioTrackInterface>, |
| 70 | CreateAudioTrack, const std::string&, AudioSourceInterface*) |
ivoc | d66b44d | 2016-01-15 03:06:36 -0800 | [diff] [blame] | 71 | PROXY_METHOD2(bool, StartAecDump, rtc::PlatformFile, int64_t) |
ivoc | 797ef12 | 2015-10-22 03:25:41 -0700 | [diff] [blame] | 72 | PROXY_METHOD0(void, StopAecDump) |
ivoc | 112a3d8 | 2015-10-16 02:22:18 -0700 | [diff] [blame] | 73 | PROXY_METHOD1(bool, StartRtcEventLog, rtc::PlatformFile) |
ivoc | c1513ee | 2016-05-13 08:30:39 -0700 | [diff] [blame] | 74 | PROXY_METHOD2(bool, StartRtcEventLog, rtc::PlatformFile, int64_t) |
ivoc | 112a3d8 | 2015-10-16 02:22:18 -0700 | [diff] [blame] | 75 | PROXY_METHOD0(void, StopRtcEventLog) |
Henrik Boström | 5e56c59 | 2015-08-11 10:33:13 +0200 | [diff] [blame] | 76 | |
| 77 | private: |
Taylor Brandstetter | 0c7e9f5 | 2015-12-29 14:14:52 -0800 | [diff] [blame] | 78 | rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection_ot( |
deadbeef | 41b0798 | 2015-12-01 15:01:24 -0800 | [diff] [blame] | 79 | const PeerConnectionInterface::RTCConfiguration& a1, |
| 80 | const MediaConstraintsInterface* a2, |
| 81 | cricket::PortAllocator* a3, |
Henrik Boström | d03c23b | 2016-06-01 11:44:18 +0200 | [diff] [blame] | 82 | rtc::RTCCertificateGeneratorInterface* a4, |
deadbeef | 41b0798 | 2015-12-01 15:01:24 -0800 | [diff] [blame] | 83 | PeerConnectionObserver* a5) { |
kwiberg | d1fe281 | 2016-04-27 06:47:29 -0700 | [diff] [blame] | 84 | std::unique_ptr<cricket::PortAllocator> ptr_a3(a3); |
Henrik Boström | d03c23b | 2016-06-01 11:44:18 +0200 | [diff] [blame] | 85 | std::unique_ptr<rtc::RTCCertificateGeneratorInterface> ptr_a4(a4); |
kwiberg | 0eb15ed | 2015-12-17 03:04:15 -0800 | [diff] [blame] | 86 | return c_->CreatePeerConnection(a1, a2, std::move(ptr_a3), |
| 87 | std::move(ptr_a4), a5); |
deadbeef | 41b0798 | 2015-12-01 15:01:24 -0800 | [diff] [blame] | 88 | } |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame] | 89 | |
| 90 | rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection_ot( |
| 91 | const PeerConnectionInterface::RTCConfiguration& a1, |
| 92 | cricket::PortAllocator* a3, |
Henrik Boström | d03c23b | 2016-06-01 11:44:18 +0200 | [diff] [blame] | 93 | rtc::RTCCertificateGeneratorInterface* a4, |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame] | 94 | PeerConnectionObserver* a5) { |
kwiberg | d1fe281 | 2016-04-27 06:47:29 -0700 | [diff] [blame] | 95 | std::unique_ptr<cricket::PortAllocator> ptr_a3(a3); |
Henrik Boström | d03c23b | 2016-06-01 11:44:18 +0200 | [diff] [blame] | 96 | std::unique_ptr<rtc::RTCCertificateGeneratorInterface> ptr_a4(a4); |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame] | 97 | return c_->CreatePeerConnection(a1, std::move(ptr_a3), std::move(ptr_a4), |
| 98 | a5); |
| 99 | } |
nisse | 72c8d2b | 2016-04-15 03:49:07 -0700 | [diff] [blame] | 100 | END_SIGNALING_PROXY() |
perkj@webrtc.org | 81134d0 | 2015-01-12 08:30:16 +0000 | [diff] [blame] | 101 | |
| 102 | } // namespace webrtc |
| 103 | |
Henrik Kjellander | 15583c1 | 2016-02-10 10:53:12 +0100 | [diff] [blame] | 104 | #endif // WEBRTC_API_PEERCONNECTIONFACTORYPROXY_H_ |