henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 | [diff] [blame] | 1 | /* |
kjellander | b24317b | 2016-02-10 15:54:43 | [diff] [blame] | 2 | * Copyright 2012 The WebRTC project authors. All Rights Reserved. |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 | [diff] [blame] | 3 | * |
kjellander | b24317b | 2016-02-10 15:54:43 | [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. |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 | [diff] [blame] | 9 | */ |
| 10 | |
Steve Anton | 10542f2 | 2019-01-11 17:11:00 | [diff] [blame] | 11 | #ifndef API_PEER_CONNECTION_PROXY_H_ |
| 12 | #define API_PEER_CONNECTION_PROXY_H_ |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 | [diff] [blame] | 13 | |
Elad Alon | 99c3fe5 | 2017-10-13 14:29:40 | [diff] [blame] | 14 | #include <memory> |
oprypin | 803dc29 | 2017-02-01 09:55:59 | [diff] [blame] | 15 | #include <string> |
| 16 | #include <vector> |
| 17 | |
Steve Anton | 10542f2 | 2019-01-11 17:11:00 | [diff] [blame] | 18 | #include "api/peer_connection_interface.h" |
Mirko Bonadei | 92ea95e | 2017-09-15 04:47:31 | [diff] [blame] | 19 | #include "api/proxy.h" |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 | [diff] [blame] | 20 | |
| 21 | namespace webrtc { |
| 22 | |
Tomas Gunnarsson | 92eebef | 2021-02-10 12:05:44 | [diff] [blame] | 23 | // PeerConnection proxy objects will be constructed with two thread pointers, |
| 24 | // signaling and network. The proxy macros don't have 'network' specific macros |
Mirko Bonadei | 9d9b8de | 2021-02-26 08:51:26 | [diff] [blame] | 25 | // and support for a secondary thread is provided via 'SECONDARY' macros. |
deadbeef | b10f32f | 2017-02-08 09:38:21 | [diff] [blame] | 26 | // TODO(deadbeef): Move this to .cc file and out of api/. What threads methods |
| 27 | // are called on is an implementation detail. |
Tomas Gunnarsson | 92eebef | 2021-02-10 12:05:44 | [diff] [blame] | 28 | BEGIN_PROXY_MAP(PeerConnection) |
Mirko Bonadei | 9d9b8de | 2021-02-26 08:51:26 | [diff] [blame] | 29 | PROXY_PRIMARY_THREAD_DESTRUCTOR() |
Yves Gerey | 665174f | 2018-06-19 13:03:05 | [diff] [blame] | 30 | PROXY_METHOD0(rtc::scoped_refptr<StreamCollectionInterface>, local_streams) |
| 31 | PROXY_METHOD0(rtc::scoped_refptr<StreamCollectionInterface>, remote_streams) |
| 32 | PROXY_METHOD1(bool, AddStream, MediaStreamInterface*) |
| 33 | PROXY_METHOD1(void, RemoveStream, MediaStreamInterface*) |
| 34 | PROXY_METHOD2(RTCErrorOr<rtc::scoped_refptr<RtpSenderInterface>>, |
| 35 | AddTrack, |
| 36 | rtc::scoped_refptr<MediaStreamTrackInterface>, |
Steve Anton | e920351 | 2018-12-19 00:29:34 | [diff] [blame] | 37 | const std::vector<std::string>&) |
Yves Gerey | 665174f | 2018-06-19 13:03:05 | [diff] [blame] | 38 | PROXY_METHOD1(bool, RemoveTrack, RtpSenderInterface*) |
Steve Anton | e920351 | 2018-12-19 00:29:34 | [diff] [blame] | 39 | PROXY_METHOD1(RTCError, RemoveTrackNew, rtc::scoped_refptr<RtpSenderInterface>) |
Yves Gerey | 665174f | 2018-06-19 13:03:05 | [diff] [blame] | 40 | PROXY_METHOD1(RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>, |
| 41 | AddTransceiver, |
| 42 | rtc::scoped_refptr<MediaStreamTrackInterface>) |
| 43 | PROXY_METHOD2(RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>, |
| 44 | AddTransceiver, |
| 45 | rtc::scoped_refptr<MediaStreamTrackInterface>, |
| 46 | const RtpTransceiverInit&) |
| 47 | PROXY_METHOD1(RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>, |
| 48 | AddTransceiver, |
| 49 | cricket::MediaType) |
| 50 | PROXY_METHOD2(RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>, |
| 51 | AddTransceiver, |
| 52 | cricket::MediaType, |
| 53 | const RtpTransceiverInit&) |
Yves Gerey | 665174f | 2018-06-19 13:03:05 | [diff] [blame] | 54 | PROXY_METHOD2(rtc::scoped_refptr<RtpSenderInterface>, |
| 55 | CreateSender, |
| 56 | const std::string&, |
| 57 | const std::string&) |
| 58 | PROXY_CONSTMETHOD0(std::vector<rtc::scoped_refptr<RtpSenderInterface>>, |
| 59 | GetSenders) |
| 60 | PROXY_CONSTMETHOD0(std::vector<rtc::scoped_refptr<RtpReceiverInterface>>, |
| 61 | GetReceivers) |
| 62 | PROXY_CONSTMETHOD0(std::vector<rtc::scoped_refptr<RtpTransceiverInterface>>, |
| 63 | GetTransceivers) |
| 64 | PROXY_METHOD3(bool, |
| 65 | GetStats, |
| 66 | StatsObserver*, |
| 67 | MediaStreamTrackInterface*, |
| 68 | StatsOutputLevel) |
| 69 | PROXY_METHOD1(void, GetStats, RTCStatsCollectorCallback*) |
| 70 | PROXY_METHOD2(void, |
| 71 | GetStats, |
| 72 | rtc::scoped_refptr<RtpSenderInterface>, |
Steve Anton | e920351 | 2018-12-19 00:29:34 | [diff] [blame] | 73 | rtc::scoped_refptr<RTCStatsCollectorCallback>) |
Yves Gerey | 665174f | 2018-06-19 13:03:05 | [diff] [blame] | 74 | PROXY_METHOD2(void, |
| 75 | GetStats, |
| 76 | rtc::scoped_refptr<RtpReceiverInterface>, |
Steve Anton | e920351 | 2018-12-19 00:29:34 | [diff] [blame] | 77 | rtc::scoped_refptr<RTCStatsCollectorCallback>) |
Niels Möller | 7b04a91 | 2019-09-13 13:41:21 | [diff] [blame] | 78 | PROXY_METHOD0(void, ClearStatsCache) |
Harald Alvestrand | a9af50f | 2021-05-21 13:33:51 | [diff] [blame^] | 79 | PROXY_METHOD2(RTCErrorOr<rtc::scoped_refptr<DataChannelInterface>>, |
| 80 | CreateDataChannelOrError, |
Yves Gerey | 665174f | 2018-06-19 13:03:05 | [diff] [blame] | 81 | const std::string&, |
| 82 | const DataChannelInit*) |
| 83 | PROXY_CONSTMETHOD0(const SessionDescriptionInterface*, local_description) |
| 84 | PROXY_CONSTMETHOD0(const SessionDescriptionInterface*, remote_description) |
| 85 | PROXY_CONSTMETHOD0(const SessionDescriptionInterface*, |
Yves Gerey | 665174f | 2018-06-19 13:03:05 | [diff] [blame] | 86 | current_local_description) |
| 87 | PROXY_CONSTMETHOD0(const SessionDescriptionInterface*, |
| 88 | current_remote_description) |
Steve Anton | e920351 | 2018-12-19 00:29:34 | [diff] [blame] | 89 | PROXY_CONSTMETHOD0(const SessionDescriptionInterface*, |
| 90 | pending_local_description) |
| 91 | PROXY_CONSTMETHOD0(const SessionDescriptionInterface*, |
| 92 | pending_remote_description) |
Henrik Boström | 79b6980 | 2019-07-18 09:16:56 | [diff] [blame] | 93 | PROXY_METHOD0(void, RestartIce) |
Yves Gerey | 665174f | 2018-06-19 13:03:05 | [diff] [blame] | 94 | PROXY_METHOD2(void, |
| 95 | CreateOffer, |
| 96 | CreateSessionDescriptionObserver*, |
Yves Gerey | 665174f | 2018-06-19 13:03:05 | [diff] [blame] | 97 | const RTCOfferAnswerOptions&) |
| 98 | PROXY_METHOD2(void, |
| 99 | CreateAnswer, |
| 100 | CreateSessionDescriptionObserver*, |
| 101 | const RTCOfferAnswerOptions&) |
| 102 | PROXY_METHOD2(void, |
| 103 | SetLocalDescription, |
Henrik Boström | 831ae4e | 2020-07-29 10:04:00 | [diff] [blame] | 104 | std::unique_ptr<SessionDescriptionInterface>, |
| 105 | rtc::scoped_refptr<SetLocalDescriptionObserverInterface>) |
| 106 | PROXY_METHOD1(void, |
| 107 | SetLocalDescription, |
| 108 | rtc::scoped_refptr<SetLocalDescriptionObserverInterface>) |
| 109 | PROXY_METHOD2(void, |
| 110 | SetLocalDescription, |
Yves Gerey | 665174f | 2018-06-19 13:03:05 | [diff] [blame] | 111 | SetSessionDescriptionObserver*, |
| 112 | SessionDescriptionInterface*) |
Henrik Boström | 4e19670 | 2019-10-30 09:35:50 | [diff] [blame] | 113 | PROXY_METHOD1(void, SetLocalDescription, SetSessionDescriptionObserver*) |
Yves Gerey | 665174f | 2018-06-19 13:03:05 | [diff] [blame] | 114 | PROXY_METHOD2(void, |
| 115 | SetRemoteDescription, |
Henrik Boström | 4c9c75a | 2020-07-29 09:46:40 | [diff] [blame] | 116 | std::unique_ptr<SessionDescriptionInterface>, |
| 117 | rtc::scoped_refptr<SetRemoteDescriptionObserverInterface>) |
Henrik Boström | 831ae4e | 2020-07-29 10:04:00 | [diff] [blame] | 118 | PROXY_METHOD2(void, |
| 119 | SetRemoteDescription, |
| 120 | SetSessionDescriptionObserver*, |
| 121 | SessionDescriptionInterface*) |
Henrik Boström | e574a31 | 2020-08-25 08:20:11 | [diff] [blame] | 122 | PROXY_METHOD1(bool, ShouldFireNegotiationNeededEvent, uint32_t) |
Steve Anton | e920351 | 2018-12-19 00:29:34 | [diff] [blame] | 123 | PROXY_METHOD0(PeerConnectionInterface::RTCConfiguration, GetConfiguration) |
Niels Möller | 2579f0c | 2019-08-19 07:58:17 | [diff] [blame] | 124 | PROXY_METHOD1(RTCError, |
Yves Gerey | 665174f | 2018-06-19 13:03:05 | [diff] [blame] | 125 | SetConfiguration, |
Steve Anton | e920351 | 2018-12-19 00:29:34 | [diff] [blame] | 126 | const PeerConnectionInterface::RTCConfiguration&) |
Yves Gerey | 665174f | 2018-06-19 13:03:05 | [diff] [blame] | 127 | PROXY_METHOD1(bool, AddIceCandidate, const IceCandidateInterface*) |
Henrik Boström | ee6f4f6 | 2019-11-06 11:36:12 | [diff] [blame] | 128 | PROXY_METHOD2(void, |
| 129 | AddIceCandidate, |
| 130 | std::unique_ptr<IceCandidateInterface>, |
| 131 | std::function<void(RTCError)>) |
Steve Anton | e920351 | 2018-12-19 00:29:34 | [diff] [blame] | 132 | PROXY_METHOD1(bool, RemoveIceCandidates, const std::vector<cricket::Candidate>&) |
| 133 | PROXY_METHOD1(RTCError, SetBitrate, const BitrateSettings&) |
Yves Gerey | 665174f | 2018-06-19 13:03:05 | [diff] [blame] | 134 | PROXY_METHOD1(void, SetAudioPlayout, bool) |
| 135 | PROXY_METHOD1(void, SetAudioRecording, bool) |
Tomas Gunnarsson | 2aeab5e | 2021-02-23 20:36:14 | [diff] [blame] | 136 | // This method will be invoked on the network thread. See |
| 137 | // PeerConnectionFactory::CreatePeerConnectionOrError for more details. |
Mirko Bonadei | 9d9b8de | 2021-02-26 08:51:26 | [diff] [blame] | 138 | PROXY_SECONDARY_METHOD1(rtc::scoped_refptr<DtlsTransportInterface>, |
| 139 | LookupDtlsTransportByMid, |
| 140 | const std::string&) |
Tomas Gunnarsson | 92eebef | 2021-02-10 12:05:44 | [diff] [blame] | 141 | // This method will be invoked on the network thread. See |
| 142 | // PeerConnectionFactory::CreatePeerConnectionOrError for more details. |
Mirko Bonadei | 9d9b8de | 2021-02-26 08:51:26 | [diff] [blame] | 143 | PROXY_SECONDARY_CONSTMETHOD0(rtc::scoped_refptr<SctpTransportInterface>, |
| 144 | GetSctpTransport) |
Yves Gerey | 665174f | 2018-06-19 13:03:05 | [diff] [blame] | 145 | PROXY_METHOD0(SignalingState, signaling_state) |
| 146 | PROXY_METHOD0(IceConnectionState, ice_connection_state) |
Steve Anton | e920351 | 2018-12-19 00:29:34 | [diff] [blame] | 147 | PROXY_METHOD0(IceConnectionState, standardized_ice_connection_state) |
| 148 | PROXY_METHOD0(PeerConnectionState, peer_connection_state) |
Yves Gerey | 665174f | 2018-06-19 13:03:05 | [diff] [blame] | 149 | PROXY_METHOD0(IceGatheringState, ice_gathering_state) |
Harald Alvestrand | 61f74d9 | 2020-03-02 10:20:00 | [diff] [blame] | 150 | PROXY_METHOD0(absl::optional<bool>, can_trickle_ice_candidates) |
Henrik Boström | 4c1e7cc | 2020-06-11 10:26:53 | [diff] [blame] | 151 | PROXY_METHOD1(void, AddAdaptationResource, rtc::scoped_refptr<Resource>) |
Yves Gerey | 665174f | 2018-06-19 13:03:05 | [diff] [blame] | 152 | PROXY_METHOD2(bool, |
| 153 | StartRtcEventLog, |
| 154 | std::unique_ptr<RtcEventLogOutput>, |
Steve Anton | e920351 | 2018-12-19 00:29:34 | [diff] [blame] | 155 | int64_t) |
Tim Haloun | 74e63b8 | 2019-06-04 18:23:32 | [diff] [blame] | 156 | PROXY_METHOD1(bool, StartRtcEventLog, std::unique_ptr<RtcEventLogOutput>) |
Yves Gerey | 665174f | 2018-06-19 13:03:05 | [diff] [blame] | 157 | PROXY_METHOD0(void, StopRtcEventLog) |
| 158 | PROXY_METHOD0(void, Close) |
Taylor Brandstetter | c88fe70 | 2020-08-03 23:36:16 | [diff] [blame] | 159 | BYPASS_PROXY_CONSTMETHOD0(rtc::Thread*, signaling_thread) |
deadbeef | d99a200 | 2017-01-18 16:55:23 | [diff] [blame] | 160 | END_PROXY_MAP() |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 | [diff] [blame] | 161 | |
| 162 | } // namespace webrtc |
| 163 | |
Steve Anton | 10542f2 | 2019-01-11 17:11:00 | [diff] [blame] | 164 | #endif // API_PEER_CONNECTION_PROXY_H_ |