blob: cc9df10eed245ebee6798a09adca8418c2cb8cf7 [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
Steve Anton10542f22019-01-11 09:11:00 -080011#ifndef API_PEER_CONNECTION_PROXY_H_
12#define API_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"
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020019#include "api/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.
deadbeefb10f32f2017-02-08 01:38:21 -080026// TODO(deadbeef): Move this to .cc file and out of api/. What threads methods
27// are called on is 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>&)
Yves Gerey665174f2018-06-19 15:03:05 +020038PROXY_METHOD1(bool, RemoveTrack, RtpSenderInterface*)
Steve Antone9203512018-12-18 16:29:34 -080039PROXY_METHOD1(RTCError, RemoveTrackNew, rtc::scoped_refptr<RtpSenderInterface>)
Yves Gerey665174f2018-06-19 15:03:05 +020040PROXY_METHOD1(RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>,
41 AddTransceiver,
42 rtc::scoped_refptr<MediaStreamTrackInterface>)
43PROXY_METHOD2(RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>,
44 AddTransceiver,
45 rtc::scoped_refptr<MediaStreamTrackInterface>,
46 const RtpTransceiverInit&)
47PROXY_METHOD1(RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>,
48 AddTransceiver,
49 cricket::MediaType)
50PROXY_METHOD2(RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>,
51 AddTransceiver,
52 cricket::MediaType,
53 const RtpTransceiverInit&)
Yves Gerey665174f2018-06-19 15:03:05 +020054PROXY_METHOD2(rtc::scoped_refptr<RtpSenderInterface>,
55 CreateSender,
56 const std::string&,
57 const std::string&)
58PROXY_CONSTMETHOD0(std::vector<rtc::scoped_refptr<RtpSenderInterface>>,
59 GetSenders)
60PROXY_CONSTMETHOD0(std::vector<rtc::scoped_refptr<RtpReceiverInterface>>,
61 GetReceivers)
62PROXY_CONSTMETHOD0(std::vector<rtc::scoped_refptr<RtpTransceiverInterface>>,
63 GetTransceivers)
64PROXY_METHOD3(bool,
65 GetStats,
66 StatsObserver*,
67 MediaStreamTrackInterface*,
68 StatsOutputLevel)
69PROXY_METHOD1(void, GetStats, RTCStatsCollectorCallback*)
70PROXY_METHOD2(void,
71 GetStats,
72 rtc::scoped_refptr<RtpSenderInterface>,
Steve Antone9203512018-12-18 16:29:34 -080073 rtc::scoped_refptr<RTCStatsCollectorCallback>)
Yves Gerey665174f2018-06-19 15:03:05 +020074PROXY_METHOD2(void,
75 GetStats,
76 rtc::scoped_refptr<RtpReceiverInterface>,
Steve Antone9203512018-12-18 16:29:34 -080077 rtc::scoped_refptr<RTCStatsCollectorCallback>)
Niels Möller7b04a912019-09-13 15:41:21 +020078PROXY_METHOD0(void, ClearStatsCache)
Yves Gerey665174f2018-06-19 15:03:05 +020079PROXY_METHOD2(rtc::scoped_refptr<DataChannelInterface>,
80 CreateDataChannel,
81 const std::string&,
82 const DataChannelInit*)
83PROXY_CONSTMETHOD0(const SessionDescriptionInterface*, local_description)
84PROXY_CONSTMETHOD0(const SessionDescriptionInterface*, remote_description)
85PROXY_CONSTMETHOD0(const SessionDescriptionInterface*,
Yves Gerey665174f2018-06-19 15:03:05 +020086 current_local_description)
87PROXY_CONSTMETHOD0(const SessionDescriptionInterface*,
88 current_remote_description)
Steve Antone9203512018-12-18 16:29:34 -080089PROXY_CONSTMETHOD0(const SessionDescriptionInterface*,
90 pending_local_description)
91PROXY_CONSTMETHOD0(const SessionDescriptionInterface*,
92 pending_remote_description)
Henrik Boström79b69802019-07-18 11:16:56 +020093PROXY_METHOD0(void, RestartIce)
Yves Gerey665174f2018-06-19 15:03:05 +020094PROXY_METHOD2(void,
95 CreateOffer,
96 CreateSessionDescriptionObserver*,
Yves Gerey665174f2018-06-19 15:03:05 +020097 const RTCOfferAnswerOptions&)
98PROXY_METHOD2(void,
99 CreateAnswer,
100 CreateSessionDescriptionObserver*,
101 const RTCOfferAnswerOptions&)
102PROXY_METHOD2(void,
103 SetLocalDescription,
Henrik Boström831ae4e2020-07-29 12:04:00 +0200104 std::unique_ptr<SessionDescriptionInterface>,
105 rtc::scoped_refptr<SetLocalDescriptionObserverInterface>)
106PROXY_METHOD1(void,
107 SetLocalDescription,
108 rtc::scoped_refptr<SetLocalDescriptionObserverInterface>)
109PROXY_METHOD2(void,
110 SetLocalDescription,
Yves Gerey665174f2018-06-19 15:03:05 +0200111 SetSessionDescriptionObserver*,
112 SessionDescriptionInterface*)
Henrik Boström4e196702019-10-30 10:35:50 +0100113PROXY_METHOD1(void, SetLocalDescription, SetSessionDescriptionObserver*)
Yves Gerey665174f2018-06-19 15:03:05 +0200114PROXY_METHOD2(void,
115 SetRemoteDescription,
Henrik Boström4c9c75a2020-07-29 09:46:40 +0000116 std::unique_ptr<SessionDescriptionInterface>,
117 rtc::scoped_refptr<SetRemoteDescriptionObserverInterface>)
Henrik Boström831ae4e2020-07-29 12:04:00 +0200118PROXY_METHOD2(void,
119 SetRemoteDescription,
120 SetSessionDescriptionObserver*,
121 SessionDescriptionInterface*)
Henrik Boströme574a312020-08-25 10:20:11 +0200122PROXY_METHOD1(bool, ShouldFireNegotiationNeededEvent, uint32_t)
Steve Antone9203512018-12-18 16:29:34 -0800123PROXY_METHOD0(PeerConnectionInterface::RTCConfiguration, GetConfiguration)
Niels Möller2579f0c2019-08-19 09:58:17 +0200124PROXY_METHOD1(RTCError,
Yves Gerey665174f2018-06-19 15:03:05 +0200125 SetConfiguration,
Steve Antone9203512018-12-18 16:29:34 -0800126 const PeerConnectionInterface::RTCConfiguration&)
Yves Gerey665174f2018-06-19 15:03:05 +0200127PROXY_METHOD1(bool, AddIceCandidate, const IceCandidateInterface*)
Henrik Boströmee6f4f62019-11-06 12:36:12 +0100128PROXY_METHOD2(void,
129 AddIceCandidate,
130 std::unique_ptr<IceCandidateInterface>,
131 std::function<void(RTCError)>)
Steve Antone9203512018-12-18 16:29:34 -0800132PROXY_METHOD1(bool, RemoveIceCandidates, const std::vector<cricket::Candidate>&)
133PROXY_METHOD1(RTCError, SetBitrate, const BitrateSettings&)
Yves Gerey665174f2018-06-19 15:03:05 +0200134PROXY_METHOD1(void, SetAudioPlayout, bool)
135PROXY_METHOD1(void, SetAudioRecording, bool)
Tomas Gunnarsson2aeab5e2021-02-23 21:36:14 +0100136// This method will be invoked on the network thread. See
137// PeerConnectionFactory::CreatePeerConnectionOrError for more details.
Mirko Bonadei9d9b8de2021-02-26 09:51:26 +0100138PROXY_SECONDARY_METHOD1(rtc::scoped_refptr<DtlsTransportInterface>,
139 LookupDtlsTransportByMid,
140 const std::string&)
Tomas Gunnarsson92eebef2021-02-10 13:05:44 +0100141// This method will be invoked on the network thread. See
142// PeerConnectionFactory::CreatePeerConnectionOrError for more details.
Mirko Bonadei9d9b8de2021-02-26 09:51:26 +0100143PROXY_SECONDARY_CONSTMETHOD0(rtc::scoped_refptr<SctpTransportInterface>,
144 GetSctpTransport)
Yves Gerey665174f2018-06-19 15:03:05 +0200145PROXY_METHOD0(SignalingState, signaling_state)
146PROXY_METHOD0(IceConnectionState, ice_connection_state)
Steve Antone9203512018-12-18 16:29:34 -0800147PROXY_METHOD0(IceConnectionState, standardized_ice_connection_state)
148PROXY_METHOD0(PeerConnectionState, peer_connection_state)
Yves Gerey665174f2018-06-19 15:03:05 +0200149PROXY_METHOD0(IceGatheringState, ice_gathering_state)
Harald Alvestrand61f74d92020-03-02 11:20:00 +0100150PROXY_METHOD0(absl::optional<bool>, can_trickle_ice_candidates)
Henrik Boström4c1e7cc2020-06-11 12:26:53 +0200151PROXY_METHOD1(void, AddAdaptationResource, rtc::scoped_refptr<Resource>)
Yves Gerey665174f2018-06-19 15:03:05 +0200152PROXY_METHOD2(bool,
153 StartRtcEventLog,
154 std::unique_ptr<RtcEventLogOutput>,
Steve Antone9203512018-12-18 16:29:34 -0800155 int64_t)
Tim Haloun74e63b82019-06-04 11:23:32 -0700156PROXY_METHOD1(bool, StartRtcEventLog, std::unique_ptr<RtcEventLogOutput>)
Yves Gerey665174f2018-06-19 15:03:05 +0200157PROXY_METHOD0(void, StopRtcEventLog)
158PROXY_METHOD0(void, Close)
Taylor Brandstetterc88fe702020-08-03 16:36:16 -0700159BYPASS_PROXY_CONSTMETHOD0(rtc::Thread*, signaling_thread)
deadbeefd99a2002017-01-18 08:55:23 -0800160END_PROXY_MAP()
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000161
162} // namespace webrtc
163
Steve Anton10542f22019-01-11 09:11:00 -0800164#endif // API_PEER_CONNECTION_PROXY_H_