1*d9f75844SAndroid Build Coastguard Worker /* 2*d9f75844SAndroid Build Coastguard Worker * Copyright 2012 The WebRTC project authors. All Rights Reserved. 3*d9f75844SAndroid Build Coastguard Worker * 4*d9f75844SAndroid Build Coastguard Worker * Use of this source code is governed by a BSD-style license 5*d9f75844SAndroid Build Coastguard Worker * that can be found in the LICENSE file in the root of the source 6*d9f75844SAndroid Build Coastguard Worker * tree. An additional intellectual property rights grant can be found 7*d9f75844SAndroid Build Coastguard Worker * in the file PATENTS. All contributing project authors may 8*d9f75844SAndroid Build Coastguard Worker * be found in the AUTHORS file in the root of the source tree. 9*d9f75844SAndroid Build Coastguard Worker */ 10*d9f75844SAndroid Build Coastguard Worker 11*d9f75844SAndroid Build Coastguard Worker #ifndef PC_PEER_CONNECTION_PROXY_H_ 12*d9f75844SAndroid Build Coastguard Worker #define PC_PEER_CONNECTION_PROXY_H_ 13*d9f75844SAndroid Build Coastguard Worker 14*d9f75844SAndroid Build Coastguard Worker #include <memory> 15*d9f75844SAndroid Build Coastguard Worker #include <string> 16*d9f75844SAndroid Build Coastguard Worker #include <vector> 17*d9f75844SAndroid Build Coastguard Worker 18*d9f75844SAndroid Build Coastguard Worker #include "api/peer_connection_interface.h" 19*d9f75844SAndroid Build Coastguard Worker #include "pc/proxy.h" 20*d9f75844SAndroid Build Coastguard Worker 21*d9f75844SAndroid Build Coastguard Worker namespace webrtc { 22*d9f75844SAndroid Build Coastguard Worker 23*d9f75844SAndroid Build Coastguard Worker // PeerConnection proxy objects will be constructed with two thread pointers, 24*d9f75844SAndroid Build Coastguard Worker // signaling and network. The proxy macros don't have 'network' specific macros 25*d9f75844SAndroid Build Coastguard Worker // and support for a secondary thread is provided via 'SECONDARY' macros. 26*d9f75844SAndroid Build Coastguard Worker // TODO(deadbeef): Move this to .cc file. What threads methods are called on is 27*d9f75844SAndroid Build Coastguard Worker // an implementation detail. 28*d9f75844SAndroid Build Coastguard Worker BEGIN_PROXY_MAP(PeerConnection) 29*d9f75844SAndroid Build Coastguard Worker PROXY_PRIMARY_THREAD_DESTRUCTOR() 30*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD0(rtc::scoped_refptr<StreamCollectionInterface>, local_streams) 31*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD0(rtc::scoped_refptr<StreamCollectionInterface>, remote_streams) 32*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD1(bool, AddStream, MediaStreamInterface*) 33*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD1(void, RemoveStream, MediaStreamInterface*) 34*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD2(RTCErrorOr<rtc::scoped_refptr<RtpSenderInterface>>, 35*d9f75844SAndroid Build Coastguard Worker AddTrack, 36*d9f75844SAndroid Build Coastguard Worker rtc::scoped_refptr<MediaStreamTrackInterface>, 37*d9f75844SAndroid Build Coastguard Worker const std::vector<std::string>&) 38*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD3(RTCErrorOr<rtc::scoped_refptr<RtpSenderInterface>>, 39*d9f75844SAndroid Build Coastguard Worker AddTrack, 40*d9f75844SAndroid Build Coastguard Worker rtc::scoped_refptr<MediaStreamTrackInterface>, 41*d9f75844SAndroid Build Coastguard Worker const std::vector<std::string>&, 42*d9f75844SAndroid Build Coastguard Worker const std::vector<RtpEncodingParameters>&) 43*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD1(RTCError, 44*d9f75844SAndroid Build Coastguard Worker RemoveTrackOrError, 45*d9f75844SAndroid Build Coastguard Worker rtc::scoped_refptr<RtpSenderInterface>) 46*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD1(RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>, 47*d9f75844SAndroid Build Coastguard Worker AddTransceiver, 48*d9f75844SAndroid Build Coastguard Worker rtc::scoped_refptr<MediaStreamTrackInterface>) 49*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD2(RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>, 50*d9f75844SAndroid Build Coastguard Worker AddTransceiver, 51*d9f75844SAndroid Build Coastguard Worker rtc::scoped_refptr<MediaStreamTrackInterface>, 52*d9f75844SAndroid Build Coastguard Worker const RtpTransceiverInit&) 53*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD1(RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>, 54*d9f75844SAndroid Build Coastguard Worker AddTransceiver, 55*d9f75844SAndroid Build Coastguard Worker cricket::MediaType) 56*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD2(RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>, 57*d9f75844SAndroid Build Coastguard Worker AddTransceiver, 58*d9f75844SAndroid Build Coastguard Worker cricket::MediaType, 59*d9f75844SAndroid Build Coastguard Worker const RtpTransceiverInit&) 60*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD2(rtc::scoped_refptr<RtpSenderInterface>, 61*d9f75844SAndroid Build Coastguard Worker CreateSender, 62*d9f75844SAndroid Build Coastguard Worker const std::string&, 63*d9f75844SAndroid Build Coastguard Worker const std::string&) 64*d9f75844SAndroid Build Coastguard Worker PROXY_CONSTMETHOD0(std::vector<rtc::scoped_refptr<RtpSenderInterface>>, 65*d9f75844SAndroid Build Coastguard Worker GetSenders) 66*d9f75844SAndroid Build Coastguard Worker PROXY_CONSTMETHOD0(std::vector<rtc::scoped_refptr<RtpReceiverInterface>>, 67*d9f75844SAndroid Build Coastguard Worker GetReceivers) 68*d9f75844SAndroid Build Coastguard Worker PROXY_CONSTMETHOD0(std::vector<rtc::scoped_refptr<RtpTransceiverInterface>>, 69*d9f75844SAndroid Build Coastguard Worker GetTransceivers) 70*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD3(bool, 71*d9f75844SAndroid Build Coastguard Worker GetStats, 72*d9f75844SAndroid Build Coastguard Worker StatsObserver*, 73*d9f75844SAndroid Build Coastguard Worker MediaStreamTrackInterface*, 74*d9f75844SAndroid Build Coastguard Worker StatsOutputLevel) 75*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD1(void, GetStats, RTCStatsCollectorCallback*) 76*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD2(void, 77*d9f75844SAndroid Build Coastguard Worker GetStats, 78*d9f75844SAndroid Build Coastguard Worker rtc::scoped_refptr<RtpSenderInterface>, 79*d9f75844SAndroid Build Coastguard Worker rtc::scoped_refptr<RTCStatsCollectorCallback>) 80*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD2(void, 81*d9f75844SAndroid Build Coastguard Worker GetStats, 82*d9f75844SAndroid Build Coastguard Worker rtc::scoped_refptr<RtpReceiverInterface>, 83*d9f75844SAndroid Build Coastguard Worker rtc::scoped_refptr<RTCStatsCollectorCallback>) 84*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD0(void, ClearStatsCache) 85*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD2(RTCErrorOr<rtc::scoped_refptr<DataChannelInterface>>, 86*d9f75844SAndroid Build Coastguard Worker CreateDataChannelOrError, 87*d9f75844SAndroid Build Coastguard Worker const std::string&, 88*d9f75844SAndroid Build Coastguard Worker const DataChannelInit*) 89*d9f75844SAndroid Build Coastguard Worker PROXY_CONSTMETHOD0(const SessionDescriptionInterface*, local_description) 90*d9f75844SAndroid Build Coastguard Worker PROXY_CONSTMETHOD0(const SessionDescriptionInterface*, remote_description) 91*d9f75844SAndroid Build Coastguard Worker PROXY_CONSTMETHOD0(const SessionDescriptionInterface*, 92*d9f75844SAndroid Build Coastguard Worker current_local_description) 93*d9f75844SAndroid Build Coastguard Worker PROXY_CONSTMETHOD0(const SessionDescriptionInterface*, 94*d9f75844SAndroid Build Coastguard Worker current_remote_description) 95*d9f75844SAndroid Build Coastguard Worker PROXY_CONSTMETHOD0(const SessionDescriptionInterface*, 96*d9f75844SAndroid Build Coastguard Worker pending_local_description) 97*d9f75844SAndroid Build Coastguard Worker PROXY_CONSTMETHOD0(const SessionDescriptionInterface*, 98*d9f75844SAndroid Build Coastguard Worker pending_remote_description) 99*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD0(void, RestartIce) 100*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD2(void, 101*d9f75844SAndroid Build Coastguard Worker CreateOffer, 102*d9f75844SAndroid Build Coastguard Worker CreateSessionDescriptionObserver*, 103*d9f75844SAndroid Build Coastguard Worker const RTCOfferAnswerOptions&) 104*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD2(void, 105*d9f75844SAndroid Build Coastguard Worker CreateAnswer, 106*d9f75844SAndroid Build Coastguard Worker CreateSessionDescriptionObserver*, 107*d9f75844SAndroid Build Coastguard Worker const RTCOfferAnswerOptions&) 108*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD2(void, 109*d9f75844SAndroid Build Coastguard Worker SetLocalDescription, 110*d9f75844SAndroid Build Coastguard Worker std::unique_ptr<SessionDescriptionInterface>, 111*d9f75844SAndroid Build Coastguard Worker rtc::scoped_refptr<SetLocalDescriptionObserverInterface>) 112*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD1(void, 113*d9f75844SAndroid Build Coastguard Worker SetLocalDescription, 114*d9f75844SAndroid Build Coastguard Worker rtc::scoped_refptr<SetLocalDescriptionObserverInterface>) 115*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD2(void, 116*d9f75844SAndroid Build Coastguard Worker SetLocalDescription, 117*d9f75844SAndroid Build Coastguard Worker SetSessionDescriptionObserver*, 118*d9f75844SAndroid Build Coastguard Worker SessionDescriptionInterface*) 119*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD1(void, SetLocalDescription, SetSessionDescriptionObserver*) 120*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD2(void, 121*d9f75844SAndroid Build Coastguard Worker SetRemoteDescription, 122*d9f75844SAndroid Build Coastguard Worker std::unique_ptr<SessionDescriptionInterface>, 123*d9f75844SAndroid Build Coastguard Worker rtc::scoped_refptr<SetRemoteDescriptionObserverInterface>) 124*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD2(void, 125*d9f75844SAndroid Build Coastguard Worker SetRemoteDescription, 126*d9f75844SAndroid Build Coastguard Worker SetSessionDescriptionObserver*, 127*d9f75844SAndroid Build Coastguard Worker SessionDescriptionInterface*) 128*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD1(bool, ShouldFireNegotiationNeededEvent, uint32_t) 129*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD0(PeerConnectionInterface::RTCConfiguration, GetConfiguration) 130*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD1(RTCError, 131*d9f75844SAndroid Build Coastguard Worker SetConfiguration, 132*d9f75844SAndroid Build Coastguard Worker const PeerConnectionInterface::RTCConfiguration&) 133*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD1(bool, AddIceCandidate, const IceCandidateInterface*) 134*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD2(void, 135*d9f75844SAndroid Build Coastguard Worker AddIceCandidate, 136*d9f75844SAndroid Build Coastguard Worker std::unique_ptr<IceCandidateInterface>, 137*d9f75844SAndroid Build Coastguard Worker std::function<void(RTCError)>) 138*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD1(bool, RemoveIceCandidates, const std::vector<cricket::Candidate>&) 139*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD1(RTCError, SetBitrate, const BitrateSettings&) 140*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD1(void, SetAudioPlayout, bool) 141*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD1(void, SetAudioRecording, bool) 142*d9f75844SAndroid Build Coastguard Worker // This method will be invoked on the network thread. See 143*d9f75844SAndroid Build Coastguard Worker // PeerConnectionFactory::CreatePeerConnectionOrError for more details. 144*d9f75844SAndroid Build Coastguard Worker PROXY_SECONDARY_METHOD1(rtc::scoped_refptr<DtlsTransportInterface>, 145*d9f75844SAndroid Build Coastguard Worker LookupDtlsTransportByMid, 146*d9f75844SAndroid Build Coastguard Worker const std::string&) 147*d9f75844SAndroid Build Coastguard Worker // This method will be invoked on the network thread. See 148*d9f75844SAndroid Build Coastguard Worker // PeerConnectionFactory::CreatePeerConnectionOrError for more details. 149*d9f75844SAndroid Build Coastguard Worker PROXY_SECONDARY_CONSTMETHOD0(rtc::scoped_refptr<SctpTransportInterface>, 150*d9f75844SAndroid Build Coastguard Worker GetSctpTransport) 151*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD0(SignalingState, signaling_state) 152*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD0(IceConnectionState, ice_connection_state) 153*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD0(IceConnectionState, standardized_ice_connection_state) 154*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD0(PeerConnectionState, peer_connection_state) 155*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD0(IceGatheringState, ice_gathering_state) 156*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD0(absl::optional<bool>, can_trickle_ice_candidates) 157*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD1(void, AddAdaptationResource, rtc::scoped_refptr<Resource>) 158*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD2(bool, 159*d9f75844SAndroid Build Coastguard Worker StartRtcEventLog, 160*d9f75844SAndroid Build Coastguard Worker std::unique_ptr<RtcEventLogOutput>, 161*d9f75844SAndroid Build Coastguard Worker int64_t) 162*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD1(bool, StartRtcEventLog, std::unique_ptr<RtcEventLogOutput>) 163*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD0(void, StopRtcEventLog) 164*d9f75844SAndroid Build Coastguard Worker PROXY_METHOD0(void, Close) 165*d9f75844SAndroid Build Coastguard Worker BYPASS_PROXY_CONSTMETHOD0(rtc::Thread*, signaling_thread) 166*d9f75844SAndroid Build Coastguard Worker END_PROXY_MAP(PeerConnection) 167*d9f75844SAndroid Build Coastguard Worker 168*d9f75844SAndroid Build Coastguard Worker } // namespace webrtc 169*d9f75844SAndroid Build Coastguard Worker 170*d9f75844SAndroid Build Coastguard Worker #endif // PC_PEER_CONNECTION_PROXY_H_ 171