Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2014 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #ifndef WEBRTC_API_PEERCONNECTIONFACTORYPROXY_H_ | 11 #ifndef WEBRTC_API_PEERCONNECTIONFACTORYPROXY_H_ |
| 12 #define WEBRTC_API_PEERCONNECTIONFACTORYPROXY_H_ | 12 #define WEBRTC_API_PEERCONNECTIONFACTORYPROXY_H_ |
| 13 | 13 |
| 14 #include <memory> | 14 #include <memory> |
| 15 #include <string> | 15 #include <string> |
| 16 #include <utility> | 16 #include <utility> |
| 17 | 17 |
| 18 #include "webrtc/api/peerconnectioninterface.h" | 18 #include "webrtc/api/peerconnectioninterface.h" |
| 19 #include "webrtc/api/proxy.h" | 19 #include "webrtc/api/proxy.h" |
| 20 #include "webrtc/base/bind.h" | 20 #include "webrtc/base/bind.h" |
| 21 | 21 |
| 22 namespace webrtc { | 22 namespace webrtc { |
| 23 | 23 |
| 24 BEGIN_SIGNALING_PROXY_MAP(PeerConnectionFactory) | 24 BEGIN_SIGNALING_PROXY_MAP(PeerConnectionFactory) |
| 25 PROXY_SIGNALING_THREAD_DESTRUCTOR() | |
| 25 PROXY_METHOD1(void, SetOptions, const Options&) | 26 PROXY_METHOD1(void, SetOptions, const Options&) |
| 26 // Can't use PROXY_METHOD5 because unique_ptr must be moved. | 27 PROXY_METHOD5(rtc::scoped_refptr<PeerConnectionInterface>, |
|
tommi
2017/01/18 12:18:02
nice to get rid of the other hack
| |
| 27 // TODO(tommi,hbos): Use of templates to support unique_ptr? | 28 CreatePeerConnection, |
| 28 rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection( | 29 const PeerConnectionInterface::RTCConfiguration&, |
| 29 const PeerConnectionInterface::RTCConfiguration& a1, | 30 const MediaConstraintsInterface*, |
| 30 const MediaConstraintsInterface* a2, | 31 std::unique_ptr<cricket::PortAllocator>, |
| 31 std::unique_ptr<cricket::PortAllocator> a3, | 32 std::unique_ptr<rtc::RTCCertificateGeneratorInterface>, |
| 32 std::unique_ptr<rtc::RTCCertificateGeneratorInterface> a4, | 33 PeerConnectionObserver*); |
| 33 PeerConnectionObserver* a5) override { | 34 PROXY_METHOD4(rtc::scoped_refptr<PeerConnectionInterface>, |
| 34 return signaling_thread_ | 35 CreatePeerConnection, |
| 35 ->Invoke<rtc::scoped_refptr<PeerConnectionInterface>>( | 36 const PeerConnectionInterface::RTCConfiguration&, |
| 36 RTC_FROM_HERE, | 37 std::unique_ptr<cricket::PortAllocator>, |
| 37 rtc::Bind(&PeerConnectionFactoryProxy::CreatePeerConnection_ot, | 38 std::unique_ptr<rtc::RTCCertificateGeneratorInterface>, |
| 38 this, a1, a2, a3.release(), a4.release(), a5)); | 39 PeerConnectionObserver*); |
| 39 } | |
| 40 rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection( | |
| 41 const PeerConnectionInterface::RTCConfiguration& a1, | |
| 42 std::unique_ptr<cricket::PortAllocator> a3, | |
| 43 std::unique_ptr<rtc::RTCCertificateGeneratorInterface> a4, | |
| 44 PeerConnectionObserver* a5) override { | |
| 45 return signaling_thread_ | |
| 46 ->Invoke<rtc::scoped_refptr<PeerConnectionInterface>>( | |
| 47 RTC_FROM_HERE, | |
| 48 rtc::Bind(&PeerConnectionFactoryProxy::CreatePeerConnection_ot, | |
| 49 this, a1, a3.release(), a4.release(), a5)); | |
| 50 } | |
| 51 PROXY_METHOD1(rtc::scoped_refptr<MediaStreamInterface>, | 40 PROXY_METHOD1(rtc::scoped_refptr<MediaStreamInterface>, |
| 52 CreateLocalMediaStream, const std::string&) | 41 CreateLocalMediaStream, const std::string&) |
| 53 PROXY_METHOD1(rtc::scoped_refptr<AudioSourceInterface>, | 42 PROXY_METHOD1(rtc::scoped_refptr<AudioSourceInterface>, |
| 54 CreateAudioSource, const MediaConstraintsInterface*) | 43 CreateAudioSource, const MediaConstraintsInterface*) |
| 55 PROXY_METHOD1(rtc::scoped_refptr<AudioSourceInterface>, | 44 PROXY_METHOD1(rtc::scoped_refptr<AudioSourceInterface>, |
| 56 CreateAudioSource, | 45 CreateAudioSource, |
| 57 const cricket::AudioOptions&) | 46 const cricket::AudioOptions&) |
| 58 PROXY_METHOD2(rtc::scoped_refptr<VideoTrackSourceInterface>, | 47 PROXY_METHOD2(rtc::scoped_refptr<VideoTrackSourceInterface>, |
| 59 CreateVideoSource, | 48 CreateVideoSource, |
| 60 cricket::VideoCapturer*, | 49 cricket::VideoCapturer*, |
| 61 const MediaConstraintsInterface*) | 50 const MediaConstraintsInterface*) |
| 62 PROXY_METHOD1(rtc::scoped_refptr<VideoTrackSourceInterface>, | 51 PROXY_METHOD1(rtc::scoped_refptr<VideoTrackSourceInterface>, |
| 63 CreateVideoSource, | 52 CreateVideoSource, |
| 64 cricket::VideoCapturer*) | 53 cricket::VideoCapturer*) |
| 65 PROXY_METHOD2(rtc::scoped_refptr<VideoTrackInterface>, | 54 PROXY_METHOD2(rtc::scoped_refptr<VideoTrackInterface>, |
| 66 CreateVideoTrack, | 55 CreateVideoTrack, |
| 67 const std::string&, | 56 const std::string&, |
| 68 VideoTrackSourceInterface*) | 57 VideoTrackSourceInterface*) |
| 69 PROXY_METHOD2(rtc::scoped_refptr<AudioTrackInterface>, | 58 PROXY_METHOD2(rtc::scoped_refptr<AudioTrackInterface>, |
| 70 CreateAudioTrack, const std::string&, AudioSourceInterface*) | 59 CreateAudioTrack, const std::string&, AudioSourceInterface*) |
| 71 PROXY_METHOD2(bool, StartAecDump, rtc::PlatformFile, int64_t) | 60 PROXY_METHOD2(bool, StartAecDump, rtc::PlatformFile, int64_t) |
| 72 PROXY_METHOD0(void, StopAecDump) | 61 PROXY_METHOD0(void, StopAecDump) |
| 73 // TODO(ivoc): Remove the StartRtcEventLog and StopRtcEventLog functions as | 62 // TODO(ivoc): Remove the StartRtcEventLog and StopRtcEventLog functions as |
| 74 // soon as they are removed from PeerConnectionFactoryInterface. | 63 // soon as they are removed from PeerConnectionFactoryInterface. |
| 75 PROXY_METHOD1(bool, StartRtcEventLog, rtc::PlatformFile) | 64 PROXY_METHOD1(bool, StartRtcEventLog, rtc::PlatformFile) |
| 76 PROXY_METHOD2(bool, StartRtcEventLog, rtc::PlatformFile, int64_t) | 65 PROXY_METHOD2(bool, StartRtcEventLog, rtc::PlatformFile, int64_t) |
| 77 PROXY_METHOD0(void, StopRtcEventLog) | 66 PROXY_METHOD0(void, StopRtcEventLog) |
| 78 | 67 END_PROXY_MAP() |
| 79 private: | |
| 80 rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection_ot( | |
| 81 const PeerConnectionInterface::RTCConfiguration& a1, | |
| 82 const MediaConstraintsInterface* a2, | |
| 83 cricket::PortAllocator* a3, | |
| 84 rtc::RTCCertificateGeneratorInterface* a4, | |
| 85 PeerConnectionObserver* a5) { | |
| 86 std::unique_ptr<cricket::PortAllocator> ptr_a3(a3); | |
| 87 std::unique_ptr<rtc::RTCCertificateGeneratorInterface> ptr_a4(a4); | |
| 88 return c_->CreatePeerConnection(a1, a2, std::move(ptr_a3), | |
| 89 std::move(ptr_a4), a5); | |
| 90 } | |
| 91 | |
| 92 rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection_ot( | |
| 93 const PeerConnectionInterface::RTCConfiguration& a1, | |
| 94 cricket::PortAllocator* a3, | |
| 95 rtc::RTCCertificateGeneratorInterface* a4, | |
| 96 PeerConnectionObserver* a5) { | |
| 97 std::unique_ptr<cricket::PortAllocator> ptr_a3(a3); | |
| 98 std::unique_ptr<rtc::RTCCertificateGeneratorInterface> ptr_a4(a4); | |
| 99 return c_->CreatePeerConnection(a1, std::move(ptr_a3), std::move(ptr_a4), | |
| 100 a5); | |
| 101 } | |
| 102 END_SIGNALING_PROXY() | |
| 103 | 68 |
| 104 } // namespace webrtc | 69 } // namespace webrtc |
| 105 | 70 |
| 106 #endif // WEBRTC_API_PEERCONNECTIONFACTORYPROXY_H_ | 71 #endif // WEBRTC_API_PEERCONNECTIONFACTORYPROXY_H_ |
| OLD | NEW |