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