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