blob: de7664f4bf0ac74fafa5f41baa42037bb62aa7db [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
Steve Anton10542f22019-01-11 17:11:0011#ifndef API_PEER_CONNECTION_PROXY_H_
12#define API_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"
Mirko Bonadei92ea95e2017-09-15 04:47:3119#include "api/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.
deadbeefb10f32f2017-02-08 09:38:2126// 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 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>&)
Yves Gerey665174f2018-06-19 13:03:0538PROXY_METHOD1(bool, RemoveTrack, RtpSenderInterface*)
Steve Antone9203512018-12-19 00:29:3439PROXY_METHOD1(RTCError, RemoveTrackNew, rtc::scoped_refptr<RtpSenderInterface>)
Yves Gerey665174f2018-06-19 13:03:0540PROXY_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 13:03:0554PROXY_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-19 00:29:3473 rtc::scoped_refptr<RTCStatsCollectorCallback>)
Yves Gerey665174f2018-06-19 13:03:0574PROXY_METHOD2(void,
75 GetStats,
76 rtc::scoped_refptr<RtpReceiverInterface>,
Steve Antone9203512018-12-19 00:29:3477 rtc::scoped_refptr<RTCStatsCollectorCallback>)
Niels Möller7b04a912019-09-13 13:41:2178PROXY_METHOD0(void, ClearStatsCache)
Harald Alvestranda9af50f2021-05-21 13:33:5179PROXY_METHOD2(RTCErrorOr<rtc::scoped_refptr<DataChannelInterface>>,
80 CreateDataChannelOrError,
Yves Gerey665174f2018-06-19 13:03:0581 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 13:03:0586 current_local_description)
87PROXY_CONSTMETHOD0(const SessionDescriptionInterface*,
88 current_remote_description)
Steve Antone9203512018-12-19 00:29:3489PROXY_CONSTMETHOD0(const SessionDescriptionInterface*,
90 pending_local_description)
91PROXY_CONSTMETHOD0(const SessionDescriptionInterface*,
92 pending_remote_description)
Henrik Boström79b69802019-07-18 09:16:5693PROXY_METHOD0(void, RestartIce)
Yves Gerey665174f2018-06-19 13:03:0594PROXY_METHOD2(void,
95 CreateOffer,
96 CreateSessionDescriptionObserver*,
Yves Gerey665174f2018-06-19 13:03:0597 const RTCOfferAnswerOptions&)
98PROXY_METHOD2(void,
99 CreateAnswer,
100 CreateSessionDescriptionObserver*,
101 const RTCOfferAnswerOptions&)
102PROXY_METHOD2(void,
103 SetLocalDescription,
Henrik Boström831ae4e2020-07-29 10:04:00104 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 13:03:05111 SetSessionDescriptionObserver*,
112 SessionDescriptionInterface*)
Henrik Boström4e196702019-10-30 09:35:50113PROXY_METHOD1(void, SetLocalDescription, SetSessionDescriptionObserver*)
Yves Gerey665174f2018-06-19 13:03:05114PROXY_METHOD2(void,
115 SetRemoteDescription,
Henrik Boström4c9c75a2020-07-29 09:46:40116 std::unique_ptr<SessionDescriptionInterface>,
117 rtc::scoped_refptr<SetRemoteDescriptionObserverInterface>)
Henrik Boström831ae4e2020-07-29 10:04:00118PROXY_METHOD2(void,
119 SetRemoteDescription,
120 SetSessionDescriptionObserver*,
121 SessionDescriptionInterface*)
Henrik Boströme574a312020-08-25 08:20:11122PROXY_METHOD1(bool, ShouldFireNegotiationNeededEvent, uint32_t)
Steve Antone9203512018-12-19 00:29:34123PROXY_METHOD0(PeerConnectionInterface::RTCConfiguration, GetConfiguration)
Niels Möller2579f0c2019-08-19 07:58:17124PROXY_METHOD1(RTCError,
Yves Gerey665174f2018-06-19 13:03:05125 SetConfiguration,
Steve Antone9203512018-12-19 00:29:34126 const PeerConnectionInterface::RTCConfiguration&)
Yves Gerey665174f2018-06-19 13:03:05127PROXY_METHOD1(bool, AddIceCandidate, const IceCandidateInterface*)
Henrik Boströmee6f4f62019-11-06 11:36:12128PROXY_METHOD2(void,
129 AddIceCandidate,
130 std::unique_ptr<IceCandidateInterface>,
131 std::function<void(RTCError)>)
Steve Antone9203512018-12-19 00:29:34132PROXY_METHOD1(bool, RemoveIceCandidates, const std::vector<cricket::Candidate>&)
133PROXY_METHOD1(RTCError, SetBitrate, const BitrateSettings&)
Yves Gerey665174f2018-06-19 13:03:05134PROXY_METHOD1(void, SetAudioPlayout, bool)
135PROXY_METHOD1(void, SetAudioRecording, bool)
Tomas Gunnarsson2aeab5e2021-02-23 20:36:14136// This method will be invoked on the network thread. See
137// PeerConnectionFactory::CreatePeerConnectionOrError for more details.
Mirko Bonadei9d9b8de2021-02-26 08:51:26138PROXY_SECONDARY_METHOD1(rtc::scoped_refptr<DtlsTransportInterface>,
139 LookupDtlsTransportByMid,
140 const std::string&)
Tomas Gunnarsson92eebef2021-02-10 12:05:44141// This method will be invoked on the network thread. See
142// PeerConnectionFactory::CreatePeerConnectionOrError for more details.
Mirko Bonadei9d9b8de2021-02-26 08:51:26143PROXY_SECONDARY_CONSTMETHOD0(rtc::scoped_refptr<SctpTransportInterface>,
144 GetSctpTransport)
Yves Gerey665174f2018-06-19 13:03:05145PROXY_METHOD0(SignalingState, signaling_state)
146PROXY_METHOD0(IceConnectionState, ice_connection_state)
Steve Antone9203512018-12-19 00:29:34147PROXY_METHOD0(IceConnectionState, standardized_ice_connection_state)
148PROXY_METHOD0(PeerConnectionState, peer_connection_state)
Yves Gerey665174f2018-06-19 13:03:05149PROXY_METHOD0(IceGatheringState, ice_gathering_state)
Harald Alvestrand61f74d92020-03-02 10:20:00150PROXY_METHOD0(absl::optional<bool>, can_trickle_ice_candidates)
Henrik Boström4c1e7cc2020-06-11 10:26:53151PROXY_METHOD1(void, AddAdaptationResource, rtc::scoped_refptr<Resource>)
Yves Gerey665174f2018-06-19 13:03:05152PROXY_METHOD2(bool,
153 StartRtcEventLog,
154 std::unique_ptr<RtcEventLogOutput>,
Steve Antone9203512018-12-19 00:29:34155 int64_t)
Tim Haloun74e63b82019-06-04 18:23:32156PROXY_METHOD1(bool, StartRtcEventLog, std::unique_ptr<RtcEventLogOutput>)
Yves Gerey665174f2018-06-19 13:03:05157PROXY_METHOD0(void, StopRtcEventLog)
158PROXY_METHOD0(void, Close)
Taylor Brandstetterc88fe702020-08-03 23:36:16159BYPASS_PROXY_CONSTMETHOD0(rtc::Thread*, signaling_thread)
deadbeefd99a2002017-01-18 16:55:23160END_PROXY_MAP()
henrike@webrtc.org28e20752013-07-10 00:45:36161
162} // namespace webrtc
163
Steve Anton10542f22019-01-11 17:11:00164#endif // API_PEER_CONNECTION_PROXY_H_