blob: 643602971a8d6275792c277bd84ab77522626421 [file] [log] [blame]
henrike@webrtc.org28e20752013-07-10 00:45:36 +00001/*
kjellanderb24317b2016-02-10 07:54:43 -08002 * Copyright 2012 The WebRTC project authors. All Rights Reserved.
henrike@webrtc.org28e20752013-07-10 00:45:36 +00003 *
kjellanderb24317b2016-02-10 07:54:43 -08004 * 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:36 +00009 */
10
Markus Handella1b82012021-05-26 18:56:30 +020011#ifndef PC_PEER_CONNECTION_PROXY_H_
12#define PC_PEER_CONNECTION_PROXY_H_
henrike@webrtc.org28e20752013-07-10 00:45:36 +000013
Elad Alon99c3fe52017-10-13 16:29:40 +020014#include <memory>
oprypin803dc292017-02-01 01:55:59 -080015#include <string>
16#include <vector>
17
Steve Anton10542f22019-01-11 09:11:00 -080018#include "api/peer_connection_interface.h"
Markus Handella1b82012021-05-26 18:56:30 +020019#include "pc/proxy.h"
henrike@webrtc.org28e20752013-07-10 00:45:36 +000020
21namespace webrtc {
22
Tomas Gunnarsson92eebef2021-02-10 13:05:44 +010023// 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 09:51:26 +010025// and support for a secondary thread is provided via 'SECONDARY' macros.
Markus Handella1b82012021-05-26 18:56:30 +020026// TODO(deadbeef): Move this to .cc file. What threads methods are called on is
27// an implementation detail.
Tomas Gunnarsson92eebef2021-02-10 13:05:44 +010028BEGIN_PROXY_MAP(PeerConnection)
Mirko Bonadei9d9b8de2021-02-26 09:51:26 +010029PROXY_PRIMARY_THREAD_DESTRUCTOR()
Yves Gerey665174f2018-06-19 15:03:05 +020030PROXY_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-18 16:29:34 -080037 const std::vector<std::string>&)
Harald Alvestrand09a0d012022-01-04 19:42:07 +000038PROXY_METHOD1(RTCError,
39 RemoveTrackOrError,
40 rtc::scoped_refptr<RtpSenderInterface>)
Yves Gerey665174f2018-06-19 15:03:05 +020041PROXY_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 15:03:05 +020055PROXY_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-18 16:29:34 -080074 rtc::scoped_refptr<RTCStatsCollectorCallback>)
Yves Gerey665174f2018-06-19 15:03:05 +020075PROXY_METHOD2(void,
76 GetStats,
77 rtc::scoped_refptr<RtpReceiverInterface>,
Steve Antone9203512018-12-18 16:29:34 -080078 rtc::scoped_refptr<RTCStatsCollectorCallback>)
Niels Möller7b04a912019-09-13 15:41:21 +020079PROXY_METHOD0(void, ClearStatsCache)
Harald Alvestranda9af50f2021-05-21 13:33:51 +000080PROXY_METHOD2(RTCErrorOr<rtc::scoped_refptr<DataChannelInterface>>,
81 CreateDataChannelOrError,
Yves Gerey665174f2018-06-19 15:03:05 +020082 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 15:03:05 +020087 current_local_description)
88PROXY_CONSTMETHOD0(const SessionDescriptionInterface*,
89 current_remote_description)
Steve Antone9203512018-12-18 16:29:34 -080090PROXY_CONSTMETHOD0(const SessionDescriptionInterface*,
91 pending_local_description)
92PROXY_CONSTMETHOD0(const SessionDescriptionInterface*,
93 pending_remote_description)
Henrik Boström79b69802019-07-18 11:16:56 +020094PROXY_METHOD0(void, RestartIce)
Yves Gerey665174f2018-06-19 15:03:05 +020095PROXY_METHOD2(void,
96 CreateOffer,
97 CreateSessionDescriptionObserver*,
Yves Gerey665174f2018-06-19 15:03:05 +020098 const RTCOfferAnswerOptions&)
99PROXY_METHOD2(void,
100 CreateAnswer,
101 CreateSessionDescriptionObserver*,
102 const RTCOfferAnswerOptions&)
103PROXY_METHOD2(void,
104 SetLocalDescription,
Henrik Boström831ae4e2020-07-29 12:04:00 +0200105 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 15:03:05 +0200112 SetSessionDescriptionObserver*,
113 SessionDescriptionInterface*)
Henrik Boström4e196702019-10-30 10:35:50 +0100114PROXY_METHOD1(void, SetLocalDescription, SetSessionDescriptionObserver*)
Yves Gerey665174f2018-06-19 15:03:05 +0200115PROXY_METHOD2(void,
116 SetRemoteDescription,
Henrik Boström4c9c75a2020-07-29 09:46:40 +0000117 std::unique_ptr<SessionDescriptionInterface>,
118 rtc::scoped_refptr<SetRemoteDescriptionObserverInterface>)
Henrik Boström831ae4e2020-07-29 12:04:00 +0200119PROXY_METHOD2(void,
120 SetRemoteDescription,
121 SetSessionDescriptionObserver*,
122 SessionDescriptionInterface*)
Henrik Boströme574a312020-08-25 10:20:11 +0200123PROXY_METHOD1(bool, ShouldFireNegotiationNeededEvent, uint32_t)
Steve Antone9203512018-12-18 16:29:34 -0800124PROXY_METHOD0(PeerConnectionInterface::RTCConfiguration, GetConfiguration)
Niels Möller2579f0c2019-08-19 09:58:17 +0200125PROXY_METHOD1(RTCError,
Yves Gerey665174f2018-06-19 15:03:05 +0200126 SetConfiguration,
Steve Antone9203512018-12-18 16:29:34 -0800127 const PeerConnectionInterface::RTCConfiguration&)
Yves Gerey665174f2018-06-19 15:03:05 +0200128PROXY_METHOD1(bool, AddIceCandidate, const IceCandidateInterface*)
Henrik Boströmee6f4f62019-11-06 12:36:12 +0100129PROXY_METHOD2(void,
130 AddIceCandidate,
131 std::unique_ptr<IceCandidateInterface>,
132 std::function<void(RTCError)>)
Steve Antone9203512018-12-18 16:29:34 -0800133PROXY_METHOD1(bool, RemoveIceCandidates, const std::vector<cricket::Candidate>&)
134PROXY_METHOD1(RTCError, SetBitrate, const BitrateSettings&)
Yves Gerey665174f2018-06-19 15:03:05 +0200135PROXY_METHOD1(void, SetAudioPlayout, bool)
136PROXY_METHOD1(void, SetAudioRecording, bool)
Tomas Gunnarsson2aeab5e2021-02-23 21:36:14 +0100137// This method will be invoked on the network thread. See
138// PeerConnectionFactory::CreatePeerConnectionOrError for more details.
Mirko Bonadei9d9b8de2021-02-26 09:51:26 +0100139PROXY_SECONDARY_METHOD1(rtc::scoped_refptr<DtlsTransportInterface>,
140 LookupDtlsTransportByMid,
141 const std::string&)
Tomas Gunnarsson92eebef2021-02-10 13:05:44 +0100142// This method will be invoked on the network thread. See
143// PeerConnectionFactory::CreatePeerConnectionOrError for more details.
Mirko Bonadei9d9b8de2021-02-26 09:51:26 +0100144PROXY_SECONDARY_CONSTMETHOD0(rtc::scoped_refptr<SctpTransportInterface>,
145 GetSctpTransport)
Yves Gerey665174f2018-06-19 15:03:05 +0200146PROXY_METHOD0(SignalingState, signaling_state)
147PROXY_METHOD0(IceConnectionState, ice_connection_state)
Steve Antone9203512018-12-18 16:29:34 -0800148PROXY_METHOD0(IceConnectionState, standardized_ice_connection_state)
149PROXY_METHOD0(PeerConnectionState, peer_connection_state)
Yves Gerey665174f2018-06-19 15:03:05 +0200150PROXY_METHOD0(IceGatheringState, ice_gathering_state)
Harald Alvestrand61f74d92020-03-02 11:20:00 +0100151PROXY_METHOD0(absl::optional<bool>, can_trickle_ice_candidates)
Henrik Boström4c1e7cc2020-06-11 12:26:53 +0200152PROXY_METHOD1(void, AddAdaptationResource, rtc::scoped_refptr<Resource>)
Yves Gerey665174f2018-06-19 15:03:05 +0200153PROXY_METHOD2(bool,
154 StartRtcEventLog,
155 std::unique_ptr<RtcEventLogOutput>,
Steve Antone9203512018-12-18 16:29:34 -0800156 int64_t)
Tim Haloun74e63b82019-06-04 11:23:32 -0700157PROXY_METHOD1(bool, StartRtcEventLog, std::unique_ptr<RtcEventLogOutput>)
Yves Gerey665174f2018-06-19 15:03:05 +0200158PROXY_METHOD0(void, StopRtcEventLog)
159PROXY_METHOD0(void, Close)
Taylor Brandstetterc88fe702020-08-03 16:36:16 -0700160BYPASS_PROXY_CONSTMETHOD0(rtc::Thread*, signaling_thread)
Markus Handell3d46d0b2021-05-27 21:42:57 +0200161END_PROXY_MAP(PeerConnection)
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000162
163} // namespace webrtc
164
Markus Handella1b82012021-05-26 18:56:30 +0200165#endif // PC_PEER_CONNECTION_PROXY_H_