blob: b97a62e946f29ce7471f5fa3b089839ecdd6011a [file] [log] [blame]
henrike@webrtc.org28e20752013-07-10 00:45:361/*
kjellanderb24317b2016-02-10 15:54:432 * Copyright 2012 The WebRTC project authors. All Rights Reserved.
henrike@webrtc.org28e20752013-07-10 00:45:363 *
kjellanderb24317b2016-02-10 15:54:434 * 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.org28e20752013-07-10 00:45:369 */
10
Markus Handella1b82012021-05-26 16:56:3011#ifndef PC_PEER_CONNECTION_PROXY_H_
12#define PC_PEER_CONNECTION_PROXY_H_
henrike@webrtc.org28e20752013-07-10 00:45:3613
Elad Alon99c3fe52017-10-13 14:29:4014#include <memory>
oprypin803dc292017-02-01 09:55:5915#include <string>
16#include <vector>
17
Steve Anton10542f22019-01-11 17:11:0018#include "api/peer_connection_interface.h"
Per K39ac25d2024-02-07 13:16:2019#include "api/transport/bandwidth_estimation_settings.h"
Markus Handella1b82012021-05-26 16:56:3020#include "pc/proxy.h"
henrike@webrtc.org28e20752013-07-10 00:45:3621
22namespace webrtc {
23
Tomas Gunnarsson92eebef2021-02-10 12:05:4424// PeerConnection proxy objects will be constructed with two thread pointers,
25// signaling and network. The proxy macros don't have 'network' specific macros
Mirko Bonadei9d9b8de2021-02-26 08:51:2626// and support for a secondary thread is provided via 'SECONDARY' macros.
Markus Handella1b82012021-05-26 16:56:3027// TODO(deadbeef): Move this to .cc file. What threads methods are called on is
28// an implementation detail.
Tomas Gunnarsson92eebef2021-02-10 12:05:4429BEGIN_PROXY_MAP(PeerConnection)
Mirko Bonadei9d9b8de2021-02-26 08:51:2630PROXY_PRIMARY_THREAD_DESTRUCTOR()
Yves Gerey665174f2018-06-19 13:03:0531PROXY_METHOD0(rtc::scoped_refptr<StreamCollectionInterface>, local_streams)
32PROXY_METHOD0(rtc::scoped_refptr<StreamCollectionInterface>, remote_streams)
33PROXY_METHOD1(bool, AddStream, MediaStreamInterface*)
34PROXY_METHOD1(void, RemoveStream, MediaStreamInterface*)
35PROXY_METHOD2(RTCErrorOr<rtc::scoped_refptr<RtpSenderInterface>>,
36 AddTrack,
37 rtc::scoped_refptr<MediaStreamTrackInterface>,
Steve Antone9203512018-12-19 00:29:3438 const std::vector<std::string>&)
Jonas Oreland4b2a1062022-10-19 07:24:4239PROXY_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 Alvestrand09a0d012022-01-04 19:42:0744PROXY_METHOD1(RTCError,
45 RemoveTrackOrError,
46 rtc::scoped_refptr<RtpSenderInterface>)
Yves Gerey665174f2018-06-19 13:03:0547PROXY_METHOD1(RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>,
48 AddTransceiver,
49 rtc::scoped_refptr<MediaStreamTrackInterface>)
50PROXY_METHOD2(RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>,
51 AddTransceiver,
52 rtc::scoped_refptr<MediaStreamTrackInterface>,
53 const RtpTransceiverInit&)
54PROXY_METHOD1(RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>,
55 AddTransceiver,
56 cricket::MediaType)
57PROXY_METHOD2(RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>,
58 AddTransceiver,
59 cricket::MediaType,
60 const RtpTransceiverInit&)
Yves Gerey665174f2018-06-19 13:03:0561PROXY_METHOD2(rtc::scoped_refptr<RtpSenderInterface>,
62 CreateSender,
63 const std::string&,
64 const std::string&)
65PROXY_CONSTMETHOD0(std::vector<rtc::scoped_refptr<RtpSenderInterface>>,
66 GetSenders)
67PROXY_CONSTMETHOD0(std::vector<rtc::scoped_refptr<RtpReceiverInterface>>,
68 GetReceivers)
69PROXY_CONSTMETHOD0(std::vector<rtc::scoped_refptr<RtpTransceiverInterface>>,
70 GetTransceivers)
71PROXY_METHOD3(bool,
72 GetStats,
73 StatsObserver*,
74 MediaStreamTrackInterface*,
75 StatsOutputLevel)
76PROXY_METHOD1(void, GetStats, RTCStatsCollectorCallback*)
77PROXY_METHOD2(void,
78 GetStats,
79 rtc::scoped_refptr<RtpSenderInterface>,
Steve Antone9203512018-12-19 00:29:3480 rtc::scoped_refptr<RTCStatsCollectorCallback>)
Yves Gerey665174f2018-06-19 13:03:0581PROXY_METHOD2(void,
82 GetStats,
83 rtc::scoped_refptr<RtpReceiverInterface>,
Steve Antone9203512018-12-19 00:29:3484 rtc::scoped_refptr<RTCStatsCollectorCallback>)
Niels Möller7b04a912019-09-13 13:41:2185PROXY_METHOD0(void, ClearStatsCache)
Harald Alvestranda9af50f2021-05-21 13:33:5186PROXY_METHOD2(RTCErrorOr<rtc::scoped_refptr<DataChannelInterface>>,
87 CreateDataChannelOrError,
Yves Gerey665174f2018-06-19 13:03:0588 const std::string&,
89 const DataChannelInit*)
90PROXY_CONSTMETHOD0(const SessionDescriptionInterface*, local_description)
91PROXY_CONSTMETHOD0(const SessionDescriptionInterface*, remote_description)
92PROXY_CONSTMETHOD0(const SessionDescriptionInterface*,
Yves Gerey665174f2018-06-19 13:03:0593 current_local_description)
94PROXY_CONSTMETHOD0(const SessionDescriptionInterface*,
95 current_remote_description)
Steve Antone9203512018-12-19 00:29:3496PROXY_CONSTMETHOD0(const SessionDescriptionInterface*,
97 pending_local_description)
98PROXY_CONSTMETHOD0(const SessionDescriptionInterface*,
99 pending_remote_description)
Henrik Boström79b69802019-07-18 09:16:56100PROXY_METHOD0(void, RestartIce)
Yves Gerey665174f2018-06-19 13:03:05101PROXY_METHOD2(void,
102 CreateOffer,
103 CreateSessionDescriptionObserver*,
Yves Gerey665174f2018-06-19 13:03:05104 const RTCOfferAnswerOptions&)
105PROXY_METHOD2(void,
106 CreateAnswer,
107 CreateSessionDescriptionObserver*,
108 const RTCOfferAnswerOptions&)
109PROXY_METHOD2(void,
110 SetLocalDescription,
Henrik Boström831ae4e2020-07-29 10:04:00111 std::unique_ptr<SessionDescriptionInterface>,
112 rtc::scoped_refptr<SetLocalDescriptionObserverInterface>)
113PROXY_METHOD1(void,
114 SetLocalDescription,
115 rtc::scoped_refptr<SetLocalDescriptionObserverInterface>)
116PROXY_METHOD2(void,
117 SetLocalDescription,
Yves Gerey665174f2018-06-19 13:03:05118 SetSessionDescriptionObserver*,
119 SessionDescriptionInterface*)
Henrik Boström4e196702019-10-30 09:35:50120PROXY_METHOD1(void, SetLocalDescription, SetSessionDescriptionObserver*)
Yves Gerey665174f2018-06-19 13:03:05121PROXY_METHOD2(void,
122 SetRemoteDescription,
Henrik Boström4c9c75a2020-07-29 09:46:40123 std::unique_ptr<SessionDescriptionInterface>,
124 rtc::scoped_refptr<SetRemoteDescriptionObserverInterface>)
Henrik Boström831ae4e2020-07-29 10:04:00125PROXY_METHOD2(void,
126 SetRemoteDescription,
127 SetSessionDescriptionObserver*,
128 SessionDescriptionInterface*)
Henrik Boströme574a312020-08-25 08:20:11129PROXY_METHOD1(bool, ShouldFireNegotiationNeededEvent, uint32_t)
Steve Antone9203512018-12-19 00:29:34130PROXY_METHOD0(PeerConnectionInterface::RTCConfiguration, GetConfiguration)
Niels Möller2579f0c2019-08-19 07:58:17131PROXY_METHOD1(RTCError,
Yves Gerey665174f2018-06-19 13:03:05132 SetConfiguration,
Steve Antone9203512018-12-19 00:29:34133 const PeerConnectionInterface::RTCConfiguration&)
Yves Gerey665174f2018-06-19 13:03:05134PROXY_METHOD1(bool, AddIceCandidate, const IceCandidateInterface*)
Henrik Boströmee6f4f62019-11-06 11:36:12135PROXY_METHOD2(void,
136 AddIceCandidate,
137 std::unique_ptr<IceCandidateInterface>,
138 std::function<void(RTCError)>)
Steve Antone9203512018-12-19 00:29:34139PROXY_METHOD1(bool, RemoveIceCandidates, const std::vector<cricket::Candidate>&)
140PROXY_METHOD1(RTCError, SetBitrate, const BitrateSettings&)
Per K39ac25d2024-02-07 13:16:20141PROXY_METHOD1(void,
142 ReconfigureBandwidthEstimation,
143 const BandwidthEstimationSettings&)
Yves Gerey665174f2018-06-19 13:03:05144PROXY_METHOD1(void, SetAudioPlayout, bool)
145PROXY_METHOD1(void, SetAudioRecording, bool)
Tomas Gunnarsson2aeab5e2021-02-23 20:36:14146// This method will be invoked on the network thread. See
147// PeerConnectionFactory::CreatePeerConnectionOrError for more details.
Mirko Bonadei9d9b8de2021-02-26 08:51:26148PROXY_SECONDARY_METHOD1(rtc::scoped_refptr<DtlsTransportInterface>,
149 LookupDtlsTransportByMid,
150 const std::string&)
Tomas Gunnarsson92eebef2021-02-10 12:05:44151// This method will be invoked on the network thread. See
152// PeerConnectionFactory::CreatePeerConnectionOrError for more details.
Mirko Bonadei9d9b8de2021-02-26 08:51:26153PROXY_SECONDARY_CONSTMETHOD0(rtc::scoped_refptr<SctpTransportInterface>,
154 GetSctpTransport)
Yves Gerey665174f2018-06-19 13:03:05155PROXY_METHOD0(SignalingState, signaling_state)
156PROXY_METHOD0(IceConnectionState, ice_connection_state)
Steve Antone9203512018-12-19 00:29:34157PROXY_METHOD0(IceConnectionState, standardized_ice_connection_state)
158PROXY_METHOD0(PeerConnectionState, peer_connection_state)
Yves Gerey665174f2018-06-19 13:03:05159PROXY_METHOD0(IceGatheringState, ice_gathering_state)
Florent Castelli8037fc62024-08-29 13:00:40160PROXY_METHOD0(std::optional<bool>, can_trickle_ice_candidates)
Henrik Boström4c1e7cc2020-06-11 10:26:53161PROXY_METHOD1(void, AddAdaptationResource, rtc::scoped_refptr<Resource>)
Yves Gerey665174f2018-06-19 13:03:05162PROXY_METHOD2(bool,
163 StartRtcEventLog,
164 std::unique_ptr<RtcEventLogOutput>,
Steve Antone9203512018-12-19 00:29:34165 int64_t)
Tim Haloun74e63b82019-06-04 18:23:32166PROXY_METHOD1(bool, StartRtcEventLog, std::unique_ptr<RtcEventLogOutput>)
Yves Gerey665174f2018-06-19 13:03:05167PROXY_METHOD0(void, StopRtcEventLog)
168PROXY_METHOD0(void, Close)
Tony Herre418bcf22024-06-17 15:28:40169PROXY_METHOD0(NetworkControllerInterface*, GetNetworkController)
Taylor Brandstetterc88fe702020-08-03 23:36:16170BYPASS_PROXY_CONSTMETHOD0(rtc::Thread*, signaling_thread)
Markus Handell3d46d0b2021-05-27 19:42:57171END_PROXY_MAP(PeerConnection)
henrike@webrtc.org28e20752013-07-10 00:45:36172
173} // namespace webrtc
174
Markus Handella1b82012021-05-26 16:56:30175#endif // PC_PEER_CONNECTION_PROXY_H_