blob: 643602971a8d6275792c277bd84ab77522626421 [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"
Markus Handella1b82012021-05-26 16:56:3019#include "pc/proxy.h"
henrike@webrtc.org28e20752013-07-10 00:45:3620
21namespace webrtc {
22
Tomas Gunnarsson92eebef2021-02-10 12:05:4423// PeerConnection proxy objects will be constructed with two thread pointers,
24// signaling and network. The proxy macros don't have 'network' specific macros
Mirko Bonadei9d9b8de2021-02-26 08:51:2625// and support for a secondary thread is provided via 'SECONDARY' macros.
Markus Handella1b82012021-05-26 16:56:3026// TODO(deadbeef): Move this to .cc file. What threads methods are called on is
27// an implementation detail.
Tomas Gunnarsson92eebef2021-02-10 12:05:4428BEGIN_PROXY_MAP(PeerConnection)
Mirko Bonadei9d9b8de2021-02-26 08:51:2629PROXY_PRIMARY_THREAD_DESTRUCTOR()
Yves Gerey665174f2018-06-19 13:03:0530PROXY_METHOD0(rtc::scoped_refptr<StreamCollectionInterface>, local_streams)
31PROXY_METHOD0(rtc::scoped_refptr<StreamCollectionInterface>, remote_streams)
32PROXY_METHOD1(bool, AddStream, MediaStreamInterface*)
33PROXY_METHOD1(void, RemoveStream, MediaStreamInterface*)
34PROXY_METHOD2(RTCErrorOr<rtc::scoped_refptr<RtpSenderInterface>>,
35 AddTrack,
36 rtc::scoped_refptr<MediaStreamTrackInterface>,
Steve Antone9203512018-12-19 00:29:3437 const std::vector<std::string>&)
Harald Alvestrand09a0d012022-01-04 19:42:0738PROXY_METHOD1(RTCError,
39 RemoveTrackOrError,
40 rtc::scoped_refptr<RtpSenderInterface>)
Yves Gerey665174f2018-06-19 13:03:0541PROXY_METHOD1(RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>,
42 AddTransceiver,
43 rtc::scoped_refptr<MediaStreamTrackInterface>)
44PROXY_METHOD2(RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>,
45 AddTransceiver,
46 rtc::scoped_refptr<MediaStreamTrackInterface>,
47 const RtpTransceiverInit&)
48PROXY_METHOD1(RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>,
49 AddTransceiver,
50 cricket::MediaType)
51PROXY_METHOD2(RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>,
52 AddTransceiver,
53 cricket::MediaType,
54 const RtpTransceiverInit&)
Yves Gerey665174f2018-06-19 13:03:0555PROXY_METHOD2(rtc::scoped_refptr<RtpSenderInterface>,
56 CreateSender,
57 const std::string&,
58 const std::string&)
59PROXY_CONSTMETHOD0(std::vector<rtc::scoped_refptr<RtpSenderInterface>>,
60 GetSenders)
61PROXY_CONSTMETHOD0(std::vector<rtc::scoped_refptr<RtpReceiverInterface>>,
62 GetReceivers)
63PROXY_CONSTMETHOD0(std::vector<rtc::scoped_refptr<RtpTransceiverInterface>>,
64 GetTransceivers)
65PROXY_METHOD3(bool,
66 GetStats,
67 StatsObserver*,
68 MediaStreamTrackInterface*,
69 StatsOutputLevel)
70PROXY_METHOD1(void, GetStats, RTCStatsCollectorCallback*)
71PROXY_METHOD2(void,
72 GetStats,
73 rtc::scoped_refptr<RtpSenderInterface>,
Steve Antone9203512018-12-19 00:29:3474 rtc::scoped_refptr<RTCStatsCollectorCallback>)
Yves Gerey665174f2018-06-19 13:03:0575PROXY_METHOD2(void,
76 GetStats,
77 rtc::scoped_refptr<RtpReceiverInterface>,
Steve Antone9203512018-12-19 00:29:3478 rtc::scoped_refptr<RTCStatsCollectorCallback>)
Niels Möller7b04a912019-09-13 13:41:2179PROXY_METHOD0(void, ClearStatsCache)
Harald Alvestranda9af50f2021-05-21 13:33:5180PROXY_METHOD2(RTCErrorOr<rtc::scoped_refptr<DataChannelInterface>>,
81 CreateDataChannelOrError,
Yves Gerey665174f2018-06-19 13:03:0582 const std::string&,
83 const DataChannelInit*)
84PROXY_CONSTMETHOD0(const SessionDescriptionInterface*, local_description)
85PROXY_CONSTMETHOD0(const SessionDescriptionInterface*, remote_description)
86PROXY_CONSTMETHOD0(const SessionDescriptionInterface*,
Yves Gerey665174f2018-06-19 13:03:0587 current_local_description)
88PROXY_CONSTMETHOD0(const SessionDescriptionInterface*,
89 current_remote_description)
Steve Antone9203512018-12-19 00:29:3490PROXY_CONSTMETHOD0(const SessionDescriptionInterface*,
91 pending_local_description)
92PROXY_CONSTMETHOD0(const SessionDescriptionInterface*,
93 pending_remote_description)
Henrik Boström79b69802019-07-18 09:16:5694PROXY_METHOD0(void, RestartIce)
Yves Gerey665174f2018-06-19 13:03:0595PROXY_METHOD2(void,
96 CreateOffer,
97 CreateSessionDescriptionObserver*,
Yves Gerey665174f2018-06-19 13:03:0598 const RTCOfferAnswerOptions&)
99PROXY_METHOD2(void,
100 CreateAnswer,
101 CreateSessionDescriptionObserver*,
102 const RTCOfferAnswerOptions&)
103PROXY_METHOD2(void,
104 SetLocalDescription,
Henrik Boström831ae4e2020-07-29 10:04:00105 std::unique_ptr<SessionDescriptionInterface>,
106 rtc::scoped_refptr<SetLocalDescriptionObserverInterface>)
107PROXY_METHOD1(void,
108 SetLocalDescription,
109 rtc::scoped_refptr<SetLocalDescriptionObserverInterface>)
110PROXY_METHOD2(void,
111 SetLocalDescription,
Yves Gerey665174f2018-06-19 13:03:05112 SetSessionDescriptionObserver*,
113 SessionDescriptionInterface*)
Henrik Boström4e196702019-10-30 09:35:50114PROXY_METHOD1(void, SetLocalDescription, SetSessionDescriptionObserver*)
Yves Gerey665174f2018-06-19 13:03:05115PROXY_METHOD2(void,
116 SetRemoteDescription,
Henrik Boström4c9c75a2020-07-29 09:46:40117 std::unique_ptr<SessionDescriptionInterface>,
118 rtc::scoped_refptr<SetRemoteDescriptionObserverInterface>)
Henrik Boström831ae4e2020-07-29 10:04:00119PROXY_METHOD2(void,
120 SetRemoteDescription,
121 SetSessionDescriptionObserver*,
122 SessionDescriptionInterface*)
Henrik Boströme574a312020-08-25 08:20:11123PROXY_METHOD1(bool, ShouldFireNegotiationNeededEvent, uint32_t)
Steve Antone9203512018-12-19 00:29:34124PROXY_METHOD0(PeerConnectionInterface::RTCConfiguration, GetConfiguration)
Niels Möller2579f0c2019-08-19 07:58:17125PROXY_METHOD1(RTCError,
Yves Gerey665174f2018-06-19 13:03:05126 SetConfiguration,
Steve Antone9203512018-12-19 00:29:34127 const PeerConnectionInterface::RTCConfiguration&)
Yves Gerey665174f2018-06-19 13:03:05128PROXY_METHOD1(bool, AddIceCandidate, const IceCandidateInterface*)
Henrik Boströmee6f4f62019-11-06 11:36:12129PROXY_METHOD2(void,
130 AddIceCandidate,
131 std::unique_ptr<IceCandidateInterface>,
132 std::function<void(RTCError)>)
Steve Antone9203512018-12-19 00:29:34133PROXY_METHOD1(bool, RemoveIceCandidates, const std::vector<cricket::Candidate>&)
134PROXY_METHOD1(RTCError, SetBitrate, const BitrateSettings&)
Yves Gerey665174f2018-06-19 13:03:05135PROXY_METHOD1(void, SetAudioPlayout, bool)
136PROXY_METHOD1(void, SetAudioRecording, bool)
Tomas Gunnarsson2aeab5e2021-02-23 20:36:14137// This method will be invoked on the network thread. See
138// PeerConnectionFactory::CreatePeerConnectionOrError for more details.
Mirko Bonadei9d9b8de2021-02-26 08:51:26139PROXY_SECONDARY_METHOD1(rtc::scoped_refptr<DtlsTransportInterface>,
140 LookupDtlsTransportByMid,
141 const std::string&)
Tomas Gunnarsson92eebef2021-02-10 12:05:44142// This method will be invoked on the network thread. See
143// PeerConnectionFactory::CreatePeerConnectionOrError for more details.
Mirko Bonadei9d9b8de2021-02-26 08:51:26144PROXY_SECONDARY_CONSTMETHOD0(rtc::scoped_refptr<SctpTransportInterface>,
145 GetSctpTransport)
Yves Gerey665174f2018-06-19 13:03:05146PROXY_METHOD0(SignalingState, signaling_state)
147PROXY_METHOD0(IceConnectionState, ice_connection_state)
Steve Antone9203512018-12-19 00:29:34148PROXY_METHOD0(IceConnectionState, standardized_ice_connection_state)
149PROXY_METHOD0(PeerConnectionState, peer_connection_state)
Yves Gerey665174f2018-06-19 13:03:05150PROXY_METHOD0(IceGatheringState, ice_gathering_state)
Harald Alvestrand61f74d92020-03-02 10:20:00151PROXY_METHOD0(absl::optional<bool>, can_trickle_ice_candidates)
Henrik Boström4c1e7cc2020-06-11 10:26:53152PROXY_METHOD1(void, AddAdaptationResource, rtc::scoped_refptr<Resource>)
Yves Gerey665174f2018-06-19 13:03:05153PROXY_METHOD2(bool,
154 StartRtcEventLog,
155 std::unique_ptr<RtcEventLogOutput>,
Steve Antone9203512018-12-19 00:29:34156 int64_t)
Tim Haloun74e63b82019-06-04 18:23:32157PROXY_METHOD1(bool, StartRtcEventLog, std::unique_ptr<RtcEventLogOutput>)
Yves Gerey665174f2018-06-19 13:03:05158PROXY_METHOD0(void, StopRtcEventLog)
159PROXY_METHOD0(void, Close)
Taylor Brandstetterc88fe702020-08-03 23:36:16160BYPASS_PROXY_CONSTMETHOD0(rtc::Thread*, signaling_thread)
Markus Handell3d46d0b2021-05-27 19:42:57161END_PROXY_MAP(PeerConnection)
henrike@webrtc.org28e20752013-07-10 00:45:36162
163} // namespace webrtc
164
Markus Handella1b82012021-05-26 16:56:30165#endif // PC_PEER_CONNECTION_PROXY_H_