henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 1 | /* |
kjellander | b24317b | 2016-02-10 07:54:43 -0800 | [diff] [blame] | 2 | * Copyright 2012 The WebRTC project authors. All Rights Reserved. |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 3 | * |
kjellander | b24317b | 2016-02-10 07:54:43 -0800 | [diff] [blame] | 4 | * 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.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 9 | */ |
| 10 | |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 11 | #ifndef PC_PEER_CONNECTION_H_ |
| 12 | #define PC_PEER_CONNECTION_H_ |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 13 | |
perkj | d61bf80 | 2016-03-24 03:16:19 -0700 | [diff] [blame] | 14 | #include <map> |
kwiberg | d1fe281 | 2016-04-27 06:47:29 -0700 | [diff] [blame] | 15 | #include <memory> |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 16 | #include <set> |
| 17 | #include <string> |
Henrik Boström | 79b6980 | 2019-07-18 11:16:56 +0200 | [diff] [blame] | 18 | #include <utility> |
perkj | d61bf80 | 2016-03-24 03:16:19 -0700 | [diff] [blame] | 19 | #include <vector> |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 20 | |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 21 | #include "api/peer_connection_interface.h" |
Niels Möller | 65f17ca | 2019-09-12 13:59:36 +0200 | [diff] [blame] | 22 | #include "api/transport/data_channel_transport_interface.h" |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 23 | #include "api/turn_customizer.h" |
Harald Alvestrand | 05e4d08 | 2019-12-03 14:04:21 +0100 | [diff] [blame] | 24 | #include "pc/data_channel_controller.h" |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 25 | #include "pc/ice_server_parsing.h" |
| 26 | #include "pc/jsep_transport_controller.h" |
| 27 | #include "pc/peer_connection_factory.h" |
| 28 | #include "pc/peer_connection_internal.h" |
| 29 | #include "pc/rtc_stats_collector.h" |
Guido Urdaneta | 1ff16c8 | 2019-05-20 19:31:53 +0200 | [diff] [blame] | 30 | #include "pc/rtp_sender.h" |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 31 | #include "pc/rtp_transceiver.h" |
Harald Alvestrand | c85328f | 2019-02-28 07:51:00 +0100 | [diff] [blame] | 32 | #include "pc/sctp_transport.h" |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 33 | #include "pc/stats_collector.h" |
| 34 | #include "pc/stream_collection.h" |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 35 | #include "pc/webrtc_session_description_factory.h" |
Jonas Olsson | 0182a03 | 2019-07-09 12:31:20 +0200 | [diff] [blame] | 36 | #include "rtc_base/experiments/field_trial_parser.h" |
Henrik Boström | a3728d3 | 2019-10-28 12:09:49 +0100 | [diff] [blame] | 37 | #include "rtc_base/operations_chain.h" |
Karl Wiberg | 5966c50 | 2019-02-21 23:55:09 +0100 | [diff] [blame] | 38 | #include "rtc_base/race_checker.h" |
Amit Hilbuch | dbb49df | 2019-01-23 14:54:24 -0800 | [diff] [blame] | 39 | #include "rtc_base/unique_id_generator.h" |
Henrik Boström | a3728d3 | 2019-10-28 12:09:49 +0100 | [diff] [blame] | 40 | #include "rtc_base/weak_ptr.h" |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 41 | |
| 42 | namespace webrtc { |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 43 | |
deadbeef | eb45981 | 2015-12-15 19:24:43 -0800 | [diff] [blame] | 44 | class MediaStreamObserver; |
perkj | f0dcfe2 | 2016-03-10 18:32:00 +0100 | [diff] [blame] | 45 | class VideoRtpReceiver; |
skvlad | 11a9cbf | 2016-10-07 11:53:05 -0700 | [diff] [blame] | 46 | class RtcEventLog; |
deadbeef | ab9b2d1 | 2015-10-14 11:33:11 -0700 | [diff] [blame] | 47 | |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 48 | // PeerConnection is the implementation of the PeerConnection object as defined |
| 49 | // by the PeerConnectionInterface API surface. |
| 50 | // The class currently is solely responsible for the following: |
| 51 | // - Managing the session state machine (signaling state). |
| 52 | // - Creating and initializing lower-level objects, like PortAllocator and |
| 53 | // BaseChannels. |
| 54 | // - Owning and managing the life cycle of the RtpSender/RtpReceiver and track |
| 55 | // objects. |
| 56 | // - Tracking the current and pending local/remote session descriptions. |
| 57 | // The class currently is jointly responsible for the following: |
| 58 | // - Parsing and interpreting SDP. |
| 59 | // - Generating offers and answers based on the current state. |
| 60 | // - The ICE state machine. |
| 61 | // - Generating stats. |
Steve Anton | 2d8609c | 2018-01-23 16:38:46 -0800 | [diff] [blame] | 62 | class PeerConnection : public PeerConnectionInternal, |
Zhi Huang | 365381f | 2018-04-13 16:44:34 -0700 | [diff] [blame] | 63 | public JsepTransportController::Observer, |
Guido Urdaneta | 1ff16c8 | 2019-05-20 19:31:53 +0200 | [diff] [blame] | 64 | public RtpSenderBase::SetStreamsObserver, |
Steve Anton | ad18276 | 2018-09-05 20:22:40 +0000 | [diff] [blame] | 65 | public rtc::MessageHandler, |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 66 | public sigslot::has_slots<> { |
| 67 | public: |
Qingsi Wang | 1ba5dec | 2019-08-19 11:57:17 -0700 | [diff] [blame] | 68 | // A bit in the usage pattern is registered when its defining event occurs at |
| 69 | // least once. |
Harald Alvestrand | 8ebba74 | 2018-05-31 14:00:34 +0200 | [diff] [blame] | 70 | enum class UsageEvent : int { |
| 71 | TURN_SERVER_ADDED = 0x01, |
| 72 | STUN_SERVER_ADDED = 0x02, |
| 73 | DATA_ADDED = 0x04, |
| 74 | AUDIO_ADDED = 0x08, |
| 75 | VIDEO_ADDED = 0x10, |
Qingsi Wang | 1ba5dec | 2019-08-19 11:57:17 -0700 | [diff] [blame] | 76 | // |SetLocalDescription| returns successfully. |
| 77 | SET_LOCAL_DESCRIPTION_SUCCEEDED = 0x20, |
| 78 | // |SetRemoteDescription| returns successfully. |
| 79 | SET_REMOTE_DESCRIPTION_SUCCEEDED = 0x40, |
| 80 | // A local candidate (with type host, server-reflexive, or relay) is |
| 81 | // collected. |
Harald Alvestrand | 8ebba74 | 2018-05-31 14:00:34 +0200 | [diff] [blame] | 82 | CANDIDATE_COLLECTED = 0x80, |
Qingsi Wang | 1ba5dec | 2019-08-19 11:57:17 -0700 | [diff] [blame] | 83 | // A remote candidate is successfully added via |AddIceCandidate|. |
| 84 | ADD_ICE_CANDIDATE_SUCCEEDED = 0x100, |
Harald Alvestrand | 8ebba74 | 2018-05-31 14:00:34 +0200 | [diff] [blame] | 85 | ICE_STATE_CONNECTED = 0x200, |
Qingsi Wang | 7fc821d | 2018-07-12 12:54:53 -0700 | [diff] [blame] | 86 | CLOSE_CALLED = 0x400, |
Qingsi Wang | 1ba5dec | 2019-08-19 11:57:17 -0700 | [diff] [blame] | 87 | // A local candidate with private IP is collected. |
Harald Alvestrand | 056d811 | 2018-07-16 19:18:58 +0200 | [diff] [blame] | 88 | PRIVATE_CANDIDATE_COLLECTED = 0x800, |
Qingsi Wang | 1ba5dec | 2019-08-19 11:57:17 -0700 | [diff] [blame] | 89 | // A remote candidate with private IP is added, either via AddiceCandidate |
| 90 | // or from the remote description. |
Jeroen de Borst | af242c8 | 2019-04-24 13:13:48 -0700 | [diff] [blame] | 91 | REMOTE_PRIVATE_CANDIDATE_ADDED = 0x1000, |
Qingsi Wang | 1ba5dec | 2019-08-19 11:57:17 -0700 | [diff] [blame] | 92 | // A local mDNS candidate is collected. |
Jeroen de Borst | af242c8 | 2019-04-24 13:13:48 -0700 | [diff] [blame] | 93 | MDNS_CANDIDATE_COLLECTED = 0x2000, |
Qingsi Wang | 1ba5dec | 2019-08-19 11:57:17 -0700 | [diff] [blame] | 94 | // A remote mDNS candidate is added, either via AddIceCandidate or from the |
| 95 | // remote description. |
Jeroen de Borst | af242c8 | 2019-04-24 13:13:48 -0700 | [diff] [blame] | 96 | REMOTE_MDNS_CANDIDATE_ADDED = 0x4000, |
Qingsi Wang | 1ba5dec | 2019-08-19 11:57:17 -0700 | [diff] [blame] | 97 | // A local candidate with IPv6 address is collected. |
| 98 | IPV6_CANDIDATE_COLLECTED = 0x8000, |
| 99 | // A remote candidate with IPv6 address is added, either via AddIceCandidate |
| 100 | // or from the remote description. |
| 101 | REMOTE_IPV6_CANDIDATE_ADDED = 0x10000, |
| 102 | // A remote candidate (with type host, server-reflexive, or relay) is |
| 103 | // successfully added, either via AddIceCandidate or from the remote |
| 104 | // description. |
| 105 | REMOTE_CANDIDATE_ADDED = 0x20000, |
Qingsi Wang | cc46b10 | 2019-09-12 11:19:01 -0700 | [diff] [blame] | 106 | // An explicit host-host candidate pair is selected, i.e. both the local and |
| 107 | // the remote candidates have the host type. This does not include candidate |
| 108 | // pairs formed with equivalent prflx remote candidates, e.g. a host-prflx |
| 109 | // pair where the prflx candidate has the same base as a host candidate of |
| 110 | // the remote peer. |
| 111 | DIRECT_CONNECTION_SELECTED = 0x40000, |
| 112 | MAX_VALUE = 0x80000, |
Harald Alvestrand | 8ebba74 | 2018-05-31 14:00:34 +0200 | [diff] [blame] | 113 | }; |
| 114 | |
zhihuang | 38ede13 | 2017-06-15 12:52:32 -0700 | [diff] [blame] | 115 | explicit PeerConnection(PeerConnectionFactory* factory, |
| 116 | std::unique_ptr<RtcEventLog> event_log, |
| 117 | std::unique_ptr<Call> call); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 118 | |
deadbeef | 653b8e0 | 2015-11-11 12:55:10 -0800 | [diff] [blame] | 119 | bool Initialize( |
| 120 | const PeerConnectionInterface::RTCConfiguration& configuration, |
Benjamin Wright | cab5888 | 2018-05-02 15:12:47 -0700 | [diff] [blame] | 121 | PeerConnectionDependencies dependencies); |
deadbeef | 653b8e0 | 2015-11-11 12:55:10 -0800 | [diff] [blame] | 122 | |
deadbeef | a67696b | 2015-09-29 11:56:26 -0700 | [diff] [blame] | 123 | rtc::scoped_refptr<StreamCollectionInterface> local_streams() override; |
| 124 | rtc::scoped_refptr<StreamCollectionInterface> remote_streams() override; |
| 125 | bool AddStream(MediaStreamInterface* local_stream) override; |
| 126 | void RemoveStream(MediaStreamInterface* local_stream) override; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 127 | |
Steve Anton | 2d6c76a | 2018-01-05 17:10:52 -0800 | [diff] [blame] | 128 | RTCErrorOr<rtc::scoped_refptr<RtpSenderInterface>> AddTrack( |
Steve Anton | f9381f0 | 2017-12-14 10:23:57 -0800 | [diff] [blame] | 129 | rtc::scoped_refptr<MediaStreamTrackInterface> track, |
Seth Hampson | 845e878 | 2018-03-02 11:34:10 -0800 | [diff] [blame] | 130 | const std::vector<std::string>& stream_ids) override; |
deadbeef | e1f9d83 | 2016-01-14 15:35:42 -0800 | [diff] [blame] | 131 | bool RemoveTrack(RtpSenderInterface* sender) override; |
Steve Anton | 24db573 | 2018-07-23 10:27:33 -0700 | [diff] [blame] | 132 | RTCError RemoveTrackNew( |
| 133 | rtc::scoped_refptr<RtpSenderInterface> sender) override; |
deadbeef | e1f9d83 | 2016-01-14 15:35:42 -0800 | [diff] [blame] | 134 | |
Steve Anton | 9158ef6 | 2017-11-27 13:01:52 -0800 | [diff] [blame] | 135 | RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>> AddTransceiver( |
| 136 | rtc::scoped_refptr<MediaStreamTrackInterface> track) override; |
| 137 | RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>> AddTransceiver( |
| 138 | rtc::scoped_refptr<MediaStreamTrackInterface> track, |
| 139 | const RtpTransceiverInit& init) override; |
| 140 | RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>> AddTransceiver( |
| 141 | cricket::MediaType media_type) override; |
| 142 | RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>> AddTransceiver( |
| 143 | cricket::MediaType media_type, |
| 144 | const RtpTransceiverInit& init) override; |
| 145 | |
Steve Anton | 8c0f7a7 | 2017-10-03 10:03:10 -0700 | [diff] [blame] | 146 | // Gets the DTLS SSL certificate associated with the audio transport on the |
| 147 | // remote side. This will become populated once the DTLS connection with the |
| 148 | // peer has been completed, as indicated by the ICE connection state |
| 149 | // transitioning to kIceConnectionCompleted. |
| 150 | // Note that this will be removed once we implement RTCDtlsTransport which |
| 151 | // has standardized method for getting this information. |
| 152 | // See https://www.w3.org/TR/webrtc/#rtcdtlstransport-interface |
| 153 | std::unique_ptr<rtc::SSLCertificate> GetRemoteAudioSSLCertificate(); |
| 154 | |
Zhi Huang | 70b820f | 2018-01-27 14:16:15 -0800 | [diff] [blame] | 155 | // Version of the above method that returns the full certificate chain. |
| 156 | std::unique_ptr<rtc::SSLCertChain> GetRemoteAudioSSLCertChain(); |
| 157 | |
deadbeef | fac0655 | 2015-11-25 11:26:01 -0800 | [diff] [blame] | 158 | rtc::scoped_refptr<RtpSenderInterface> CreateSender( |
deadbeef | bd7d8f7 | 2015-12-18 16:58:44 -0800 | [diff] [blame] | 159 | const std::string& kind, |
| 160 | const std::string& stream_id) override; |
deadbeef | fac0655 | 2015-11-25 11:26:01 -0800 | [diff] [blame] | 161 | |
deadbeef | 70ab1a1 | 2015-09-28 16:53:55 -0700 | [diff] [blame] | 162 | std::vector<rtc::scoped_refptr<RtpSenderInterface>> GetSenders() |
| 163 | const override; |
| 164 | std::vector<rtc::scoped_refptr<RtpReceiverInterface>> GetReceivers() |
| 165 | const override; |
Steve Anton | 9158ef6 | 2017-11-27 13:01:52 -0800 | [diff] [blame] | 166 | std::vector<rtc::scoped_refptr<RtpTransceiverInterface>> GetTransceivers() |
| 167 | const override; |
deadbeef | 70ab1a1 | 2015-09-28 16:53:55 -0700 | [diff] [blame] | 168 | |
deadbeef | a67696b | 2015-09-29 11:56:26 -0700 | [diff] [blame] | 169 | rtc::scoped_refptr<DataChannelInterface> CreateDataChannel( |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 170 | const std::string& label, |
deadbeef | a67696b | 2015-09-29 11:56:26 -0700 | [diff] [blame] | 171 | const DataChannelInit* config) override; |
Henrik Boström | 1df1bf8 | 2018-03-20 13:24:20 +0100 | [diff] [blame] | 172 | // WARNING: LEGACY. See peerconnectioninterface.h |
deadbeef | a67696b | 2015-09-29 11:56:26 -0700 | [diff] [blame] | 173 | bool GetStats(StatsObserver* observer, |
| 174 | webrtc::MediaStreamTrackInterface* track, |
| 175 | StatsOutputLevel level) override; |
Henrik Boström | 1df1bf8 | 2018-03-20 13:24:20 +0100 | [diff] [blame] | 176 | // Spec-complaint GetStats(). See peerconnectioninterface.h |
hbos | 74e1a4f | 2016-09-15 23:33:01 -0700 | [diff] [blame] | 177 | void GetStats(RTCStatsCollectorCallback* callback) override; |
Henrik Boström | 1df1bf8 | 2018-03-20 13:24:20 +0100 | [diff] [blame] | 178 | void GetStats( |
| 179 | rtc::scoped_refptr<RtpSenderInterface> selector, |
| 180 | rtc::scoped_refptr<RTCStatsCollectorCallback> callback) override; |
| 181 | void GetStats( |
| 182 | rtc::scoped_refptr<RtpReceiverInterface> selector, |
| 183 | rtc::scoped_refptr<RTCStatsCollectorCallback> callback) override; |
Harald Alvestrand | 8906187 | 2018-01-02 14:08:34 +0100 | [diff] [blame] | 184 | void ClearStatsCache() override; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 185 | |
deadbeef | a67696b | 2015-09-29 11:56:26 -0700 | [diff] [blame] | 186 | SignalingState signaling_state() override; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 187 | |
deadbeef | a67696b | 2015-09-29 11:56:26 -0700 | [diff] [blame] | 188 | IceConnectionState ice_connection_state() override; |
Jonas Olsson | 1204690 | 2018-12-06 11:25:14 +0100 | [diff] [blame] | 189 | IceConnectionState standardized_ice_connection_state() override; |
Jonas Olsson | 635474e | 2018-10-18 15:58:17 +0200 | [diff] [blame] | 190 | PeerConnectionState peer_connection_state() override; |
deadbeef | a67696b | 2015-09-29 11:56:26 -0700 | [diff] [blame] | 191 | IceGatheringState ice_gathering_state() override; |
Harald Alvestrand | 61f74d9 | 2020-03-02 11:20:00 +0100 | [diff] [blame] | 192 | absl::optional<bool> can_trickle_ice_candidates() override; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 193 | |
deadbeef | a67696b | 2015-09-29 11:56:26 -0700 | [diff] [blame] | 194 | const SessionDescriptionInterface* local_description() const override; |
| 195 | const SessionDescriptionInterface* remote_description() const override; |
deadbeef | fe4a8a4 | 2016-12-20 17:56:17 -0800 | [diff] [blame] | 196 | const SessionDescriptionInterface* current_local_description() const override; |
| 197 | const SessionDescriptionInterface* current_remote_description() |
| 198 | const override; |
| 199 | const SessionDescriptionInterface* pending_local_description() const override; |
| 200 | const SessionDescriptionInterface* pending_remote_description() |
| 201 | const override; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 202 | |
Henrik Boström | 79b6980 | 2019-07-18 11:16:56 +0200 | [diff] [blame] | 203 | void RestartIce() override; |
| 204 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 205 | // JSEP01 |
deadbeef | a67696b | 2015-09-29 11:56:26 -0700 | [diff] [blame] | 206 | void CreateOffer(CreateSessionDescriptionObserver* observer, |
| 207 | const RTCOfferAnswerOptions& options) override; |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame] | 208 | void CreateAnswer(CreateSessionDescriptionObserver* observer, |
| 209 | const RTCOfferAnswerOptions& options) override; |
deadbeef | a67696b | 2015-09-29 11:56:26 -0700 | [diff] [blame] | 210 | void SetLocalDescription(SetSessionDescriptionObserver* observer, |
| 211 | SessionDescriptionInterface* desc) override; |
Henrik Boström | 4e19670 | 2019-10-30 10:35:50 +0100 | [diff] [blame] | 212 | void SetLocalDescription(SetSessionDescriptionObserver* observer) override; |
Henrik Boström | a4ecf55 | 2017-11-23 14:17:07 +0000 | [diff] [blame] | 213 | void SetRemoteDescription(SetSessionDescriptionObserver* observer, |
| 214 | SessionDescriptionInterface* desc) override; |
Henrik Boström | 3163867 | 2017-11-23 17:48:32 +0100 | [diff] [blame] | 215 | void SetRemoteDescription( |
| 216 | std::unique_ptr<SessionDescriptionInterface> desc, |
| 217 | rtc::scoped_refptr<SetRemoteDescriptionObserverInterface> observer) |
| 218 | override; |
deadbeef | 46c7389 | 2016-11-16 19:42:04 -0800 | [diff] [blame] | 219 | PeerConnectionInterface::RTCConfiguration GetConfiguration() override; |
Niels Möller | 2579f0c | 2019-08-19 09:58:17 +0200 | [diff] [blame] | 220 | RTCError SetConfiguration( |
| 221 | const PeerConnectionInterface::RTCConfiguration& configuration) override; |
deadbeef | a67696b | 2015-09-29 11:56:26 -0700 | [diff] [blame] | 222 | bool AddIceCandidate(const IceCandidateInterface* candidate) override; |
Henrik Boström | ee6f4f6 | 2019-11-06 12:36:12 +0100 | [diff] [blame] | 223 | void AddIceCandidate(std::unique_ptr<IceCandidateInterface> candidate, |
| 224 | std::function<void(RTCError)> callback) override; |
Honghai Zhang | 7fb69db | 2016-03-14 11:59:18 -0700 | [diff] [blame] | 225 | bool RemoveIceCandidates( |
| 226 | const std::vector<cricket::Candidate>& candidates) override; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 227 | |
Niels Möller | 0c4f7be | 2018-05-07 14:01:37 +0200 | [diff] [blame] | 228 | RTCError SetBitrate(const BitrateSettings& bitrate) override; |
zstein | 4b97980 | 2017-06-02 14:37:37 -0700 | [diff] [blame] | 229 | |
henrika | 5f6bf24 | 2017-11-01 11:06:56 +0100 | [diff] [blame] | 230 | void SetAudioPlayout(bool playout) override; |
| 231 | void SetAudioRecording(bool recording) override; |
| 232 | |
Harald Alvestrand | ad88c88 | 2018-11-28 16:47:46 +0100 | [diff] [blame] | 233 | rtc::scoped_refptr<DtlsTransportInterface> LookupDtlsTransportByMid( |
| 234 | const std::string& mid) override; |
Harald Alvestrand | 4a7b3ac | 2019-01-17 10:39:40 +0100 | [diff] [blame] | 235 | rtc::scoped_refptr<DtlsTransport> LookupDtlsTransportByMidInternal( |
| 236 | const std::string& mid); |
Harald Alvestrand | ad88c88 | 2018-11-28 16:47:46 +0100 | [diff] [blame] | 237 | |
Harald Alvestrand | c85328f | 2019-02-28 07:51:00 +0100 | [diff] [blame] | 238 | rtc::scoped_refptr<SctpTransportInterface> GetSctpTransport() const override; |
| 239 | |
Bjorn Terelius | de93943 | 2017-11-20 17:38:14 +0100 | [diff] [blame] | 240 | bool StartRtcEventLog(std::unique_ptr<RtcEventLogOutput> output, |
| 241 | int64_t output_period_ms) override; |
Niels Möller | f00ca1a | 2019-05-10 11:33:12 +0200 | [diff] [blame] | 242 | bool StartRtcEventLog(std::unique_ptr<RtcEventLogOutput> output) override; |
ivoc | 14d5dbe | 2016-07-04 07:06:55 -0700 | [diff] [blame] | 243 | void StopRtcEventLog() override; |
| 244 | |
deadbeef | a67696b | 2015-09-29 11:56:26 -0700 | [diff] [blame] | 245 | void Close() override; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 246 | |
Steve Anton | 2d8609c | 2018-01-23 16:38:46 -0800 | [diff] [blame] | 247 | // PeerConnectionInternal implementation. |
Karl Wiberg | 4ae6347 | 2019-02-22 00:57:06 +0100 | [diff] [blame] | 248 | rtc::Thread* network_thread() const final { |
Steve Anton | 2d8609c | 2018-01-23 16:38:46 -0800 | [diff] [blame] | 249 | return factory_->network_thread(); |
| 250 | } |
Karl Wiberg | 4ae6347 | 2019-02-22 00:57:06 +0100 | [diff] [blame] | 251 | rtc::Thread* worker_thread() const final { return factory_->worker_thread(); } |
| 252 | rtc::Thread* signaling_thread() const final { |
Steve Anton | 2d8609c | 2018-01-23 16:38:46 -0800 | [diff] [blame] | 253 | return factory_->signaling_thread(); |
perkj | d61bf80 | 2016-03-24 03:16:19 -0700 | [diff] [blame] | 254 | } |
deadbeef | ab9b2d1 | 2015-10-14 11:33:11 -0700 | [diff] [blame] | 255 | |
Karl Wiberg | a58e169 | 2019-03-26 13:33:43 +0100 | [diff] [blame] | 256 | std::string session_id() const override { |
| 257 | RTC_DCHECK_RUN_ON(signaling_thread()); |
| 258 | return session_id_; |
| 259 | } |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 260 | |
Steve Anton | 2d8609c | 2018-01-23 16:38:46 -0800 | [diff] [blame] | 261 | bool initial_offerer() const override { |
Karl Wiberg | 2cc368f | 2019-04-02 11:31:56 +0200 | [diff] [blame] | 262 | RTC_DCHECK_RUN_ON(signaling_thread()); |
Zhi Huang | e830e68 | 2018-03-30 10:48:35 -0700 | [diff] [blame] | 263 | return transport_controller_ && transport_controller_->initial_offerer(); |
Steve Anton | 2d8609c | 2018-01-23 16:38:46 -0800 | [diff] [blame] | 264 | } |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 265 | |
Steve Anton | 2d8609c | 2018-01-23 16:38:46 -0800 | [diff] [blame] | 266 | std::vector< |
| 267 | rtc::scoped_refptr<RtpTransceiverProxyWithInternal<RtpTransceiver>>> |
Steve Anton | b886711 | 2018-02-13 10:07:54 -0800 | [diff] [blame] | 268 | GetTransceiversInternal() const override { |
Karl Wiberg | a58e169 | 2019-03-26 13:33:43 +0100 | [diff] [blame] | 269 | RTC_DCHECK_RUN_ON(signaling_thread()); |
Steve Anton | 2d8609c | 2018-01-23 16:38:46 -0800 | [diff] [blame] | 270 | return transceivers_; |
| 271 | } |
| 272 | |
Steve Anton | 2d8609c | 2018-01-23 16:38:46 -0800 | [diff] [blame] | 273 | sigslot::signal1<DataChannel*>& SignalDataChannelCreated() override { |
Harald Alvestrand | 05e4d08 | 2019-12-03 14:04:21 +0100 | [diff] [blame] | 274 | return data_channel_controller_.SignalDataChannelCreated(); |
Steve Anton | 2d8609c | 2018-01-23 16:38:46 -0800 | [diff] [blame] | 275 | } |
| 276 | |
| 277 | cricket::RtpDataChannel* rtp_data_channel() const override { |
Harald Alvestrand | 00cf34c | 2019-12-02 09:56:02 +0100 | [diff] [blame] | 278 | return data_channel_controller_.rtp_data_channel(); |
Steve Anton | 978b876 | 2017-09-29 12:15:02 -0700 | [diff] [blame] | 279 | } |
Steve Anton | 2d8609c | 2018-01-23 16:38:46 -0800 | [diff] [blame] | 280 | |
Steve Anton | be5e208 | 2018-01-24 15:29:17 -0800 | [diff] [blame] | 281 | std::vector<rtc::scoped_refptr<DataChannel>> sctp_data_channels() |
Steve Anton | 2d8609c | 2018-01-23 16:38:46 -0800 | [diff] [blame] | 282 | const override { |
Karl Wiberg | 85a4a93 | 2019-03-22 15:29:58 +0100 | [diff] [blame] | 283 | RTC_DCHECK_RUN_ON(signaling_thread()); |
Harald Alvestrand | 05e4d08 | 2019-12-03 14:04:21 +0100 | [diff] [blame] | 284 | return *data_channel_controller_.sctp_data_channels(); |
Steve Anton | 2d8609c | 2018-01-23 16:38:46 -0800 | [diff] [blame] | 285 | } |
| 286 | |
Danil Chapovalov | 66cadcc | 2018-06-19 16:47:43 +0200 | [diff] [blame] | 287 | absl::optional<std::string> sctp_transport_name() const override; |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 288 | |
Qingsi Wang | 72a43a1 | 2018-02-20 16:03:18 -0800 | [diff] [blame] | 289 | cricket::CandidateStatsList GetPooledCandidateStats() const override; |
Steve Anton | 5dfde18 | 2018-02-06 10:34:40 -0800 | [diff] [blame] | 290 | std::map<std::string, std::string> GetTransportNamesByMid() const override; |
| 291 | std::map<std::string, cricket::TransportStats> GetTransportStatsByNames( |
| 292 | const std::set<std::string>& transport_names) override; |
Steve Anton | 2d8609c | 2018-01-23 16:38:46 -0800 | [diff] [blame] | 293 | Call::Stats GetCallStats() override; |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 294 | |
Steve Anton | 2d8609c | 2018-01-23 16:38:46 -0800 | [diff] [blame] | 295 | bool GetLocalCertificate( |
| 296 | const std::string& transport_name, |
| 297 | rtc::scoped_refptr<rtc::RTCCertificate>* certificate) override; |
Taylor Brandstetter | c392866 | 2018-02-23 13:04:51 -0800 | [diff] [blame] | 298 | std::unique_ptr<rtc::SSLCertChain> GetRemoteSSLCertChain( |
Steve Anton | 2d8609c | 2018-01-23 16:38:46 -0800 | [diff] [blame] | 299 | const std::string& transport_name) override; |
| 300 | bool IceRestartPending(const std::string& content_name) const override; |
| 301 | bool NeedsIceRestart(const std::string& content_name) const override; |
| 302 | bool GetSslRole(const std::string& content_name, rtc::SSLRole* role) override; |
Steve Anton | 7464fca | 2018-01-19 11:10:37 -0800 | [diff] [blame] | 303 | |
Harald Alvestrand | 05e4d08 | 2019-12-03 14:04:21 +0100 | [diff] [blame] | 304 | // Functions needed by DataChannelController |
| 305 | void NoteDataAddedEvent() { NoteUsageEvent(UsageEvent::DATA_ADDED); } |
| 306 | // Returns the observer. Will crash on CHECK if the observer is removed. |
| 307 | PeerConnectionObserver* Observer() const; |
| 308 | bool IsClosed() const { |
| 309 | RTC_DCHECK_RUN_ON(signaling_thread()); |
| 310 | return signaling_state_ == PeerConnectionInterface::kClosed; |
| 311 | } |
| 312 | // Get current SSL role used by SCTP's underlying transport. |
| 313 | bool GetSctpSslRole(rtc::SSLRole* role); |
| 314 | // Handler for the "channel closed" signal |
| 315 | void OnSctpDataChannelClosed(DataChannel* channel); |
Harald Alvestrand | 05e4d08 | 2019-12-03 14:04:21 +0100 | [diff] [blame] | 316 | |
| 317 | // Functions made public for testing. |
Harald Alvestrand | 1979384 | 2018-06-25 12:03:50 +0200 | [diff] [blame] | 318 | void ReturnHistogramVeryQuicklyForTesting() { |
Karl Wiberg | f73f7d6 | 2019-04-08 15:36:53 +0200 | [diff] [blame] | 319 | RTC_DCHECK_RUN_ON(signaling_thread()); |
Harald Alvestrand | 1979384 | 2018-06-25 12:03:50 +0200 | [diff] [blame] | 320 | return_histogram_very_quickly_ = true; |
| 321 | } |
Harald Alvestrand | 7a1c7f7 | 2018-08-01 10:50:16 +0200 | [diff] [blame] | 322 | void RequestUsagePatternReportForTesting(); |
Harald Alvestrand | 1cb929f | 2020-02-05 12:07:33 +0100 | [diff] [blame] | 323 | absl::optional<std::string> sctp_mid() { |
| 324 | RTC_DCHECK_RUN_ON(signaling_thread()); |
Harald Alvestrand | 7a829a8 | 2020-02-12 07:38:21 +0100 | [diff] [blame] | 325 | return sctp_mid_s_; |
Harald Alvestrand | 1cb929f | 2020-02-05 12:07:33 +0100 | [diff] [blame] | 326 | } |
Harald Alvestrand | 1979384 | 2018-06-25 12:03:50 +0200 | [diff] [blame] | 327 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 328 | protected: |
deadbeef | a67696b | 2015-09-29 11:56:26 -0700 | [diff] [blame] | 329 | ~PeerConnection() override; |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 330 | |
| 331 | private: |
Henrik Boström | 4e19670 | 2019-10-30 10:35:50 +0100 | [diff] [blame] | 332 | class ImplicitCreateSessionDescriptionObserver; |
| 333 | friend class ImplicitCreateSessionDescriptionObserver; |
Henrik Boström | 3163867 | 2017-11-23 17:48:32 +0100 | [diff] [blame] | 334 | class SetRemoteDescriptionObserverAdapter; |
| 335 | friend class SetRemoteDescriptionObserverAdapter; |
Harald Alvestrand | 05e4d08 | 2019-12-03 14:04:21 +0100 | [diff] [blame] | 336 | |
Henrik Boström | 79b6980 | 2019-07-18 11:16:56 +0200 | [diff] [blame] | 337 | // Represents the [[LocalIceCredentialsToReplace]] internal slot in the spec. |
| 338 | // It makes the next CreateOffer() produce new ICE credentials even if |
| 339 | // RTCOfferAnswerOptions::ice_restart is false. |
| 340 | // https://w3c.github.io/webrtc-pc/#dfn-localufragstoreplace |
| 341 | // TODO(hbos): When JsepTransportController/JsepTransport supports rollback, |
| 342 | // move this type of logic to JsepTransportController/JsepTransport. |
| 343 | class LocalIceCredentialsToReplace; |
Henrik Boström | 3163867 | 2017-11-23 17:48:32 +0100 | [diff] [blame] | 344 | |
Steve Anton | 4171afb | 2017-11-20 10:20:22 -0800 | [diff] [blame] | 345 | struct RtpSenderInfo { |
| 346 | RtpSenderInfo() : first_ssrc(0) {} |
Seth Hampson | 845e878 | 2018-03-02 11:34:10 -0800 | [diff] [blame] | 347 | RtpSenderInfo(const std::string& stream_id, |
Steve Anton | 4171afb | 2017-11-20 10:20:22 -0800 | [diff] [blame] | 348 | const std::string sender_id, |
| 349 | uint32_t ssrc) |
Seth Hampson | 845e878 | 2018-03-02 11:34:10 -0800 | [diff] [blame] | 350 | : stream_id(stream_id), sender_id(sender_id), first_ssrc(ssrc) {} |
Steve Anton | 4171afb | 2017-11-20 10:20:22 -0800 | [diff] [blame] | 351 | bool operator==(const RtpSenderInfo& other) { |
Seth Hampson | 845e878 | 2018-03-02 11:34:10 -0800 | [diff] [blame] | 352 | return this->stream_id == other.stream_id && |
Steve Anton | 4171afb | 2017-11-20 10:20:22 -0800 | [diff] [blame] | 353 | this->sender_id == other.sender_id && |
| 354 | this->first_ssrc == other.first_ssrc; |
deadbeef | bda7e0b | 2015-12-08 17:13:40 -0800 | [diff] [blame] | 355 | } |
Seth Hampson | 845e878 | 2018-03-02 11:34:10 -0800 | [diff] [blame] | 356 | std::string stream_id; |
Steve Anton | 4171afb | 2017-11-20 10:20:22 -0800 | [diff] [blame] | 357 | std::string sender_id; |
| 358 | // An RtpSender can have many SSRCs. The first one is used as a sort of ID |
| 359 | // for communicating with the lower layers. |
| 360 | uint32_t first_ssrc; |
deadbeef | ab9b2d1 | 2015-10-14 11:33:11 -0700 | [diff] [blame] | 361 | }; |
deadbeef | ab9b2d1 | 2015-10-14 11:33:11 -0700 | [diff] [blame] | 362 | |
Bjorn A Mellem | 5985a04 | 2019-06-28 14:19:38 -0700 | [diff] [blame] | 363 | // Field-trial based configuration for datagram transport. |
| 364 | struct DatagramTransportConfig { |
| 365 | explicit DatagramTransportConfig(const std::string& field_trial) |
| 366 | : enabled("enabled", true), default_value("default_value", false) { |
| 367 | ParseFieldTrial({&enabled, &default_value}, field_trial); |
| 368 | } |
| 369 | |
| 370 | // Whether datagram transport support is enabled at all. Defaults to true, |
| 371 | // allowing datagram transport to be used if (a) the application provides a |
| 372 | // factory for it and (b) the configuration specifies its use. This flag |
| 373 | // provides a kill-switch to force-disable datagram transport across all |
| 374 | // applications, without code changes. |
| 375 | FieldTrialFlag enabled; |
| 376 | |
| 377 | // Whether the datagram transport is enabled or disabled by default. |
| 378 | // Defaults to false, meaning that applications must configure use of |
| 379 | // datagram transport through RTCConfiguration. If set to true, |
| 380 | // applications will use the datagram transport by default (but may still |
| 381 | // explicitly configure themselves not to use it through RTCConfiguration). |
| 382 | FieldTrialFlag default_value; |
| 383 | }; |
| 384 | |
Bjorn A Mellem | b689af4 | 2019-08-21 10:44:59 -0700 | [diff] [blame] | 385 | // Field-trial based configuration for datagram transport data channels. |
| 386 | struct DatagramTransportDataChannelConfig { |
| 387 | explicit DatagramTransportDataChannelConfig(const std::string& field_trial) |
Bjorn A Mellem | 7da4e56 | 2019-09-26 11:02:11 -0700 | [diff] [blame] | 388 | : enabled("enabled", true), |
| 389 | default_value("default_value", false), |
| 390 | receive_only("receive_only", false) { |
| 391 | ParseFieldTrial({&enabled, &default_value, &receive_only}, field_trial); |
Bjorn A Mellem | b689af4 | 2019-08-21 10:44:59 -0700 | [diff] [blame] | 392 | } |
| 393 | |
| 394 | // Whether datagram transport data channel support is enabled at all. |
| 395 | // Defaults to true, allowing datagram transport to be used if (a) the |
| 396 | // application provides a factory for it and (b) the configuration specifies |
| 397 | // its use. This flag provides a kill-switch to force-disable datagram |
| 398 | // transport across all applications, without code changes. |
| 399 | FieldTrialFlag enabled; |
| 400 | |
| 401 | // Whether the datagram transport data channels are enabled or disabled by |
| 402 | // default. Defaults to false, meaning that applications must configure use |
| 403 | // of datagram transport through RTCConfiguration. If set to true, |
| 404 | // applications will use the datagram transport by default (but may still |
| 405 | // explicitly configure themselves not to use it through RTCConfiguration). |
| 406 | FieldTrialFlag default_value; |
Bjorn A Mellem | 7da4e56 | 2019-09-26 11:02:11 -0700 | [diff] [blame] | 407 | |
| 408 | // Whether the datagram transport is enabled in receive-only mode. If true, |
| 409 | // and if the datagram transport is enabled, it will only be used when |
| 410 | // receiving incoming calls, not when placing outgoing calls. |
| 411 | FieldTrialFlag receive_only; |
Bjorn A Mellem | b689af4 | 2019-08-21 10:44:59 -0700 | [diff] [blame] | 412 | }; |
| 413 | |
Eldar Rello | 5ab79e6 | 2019-10-09 18:29:44 +0300 | [diff] [blame] | 414 | // Captures partial state to be used for rollback. Applicable only in |
| 415 | // Unified Plan. |
| 416 | class TransceiverStableState { |
| 417 | public: |
| 418 | TransceiverStableState() {} |
Eldar Rello | 353a718 | 2019-11-25 18:49:44 +0200 | [diff] [blame] | 419 | void set_newly_created(); |
| 420 | void SetMSectionIfUnset(absl::optional<std::string> mid, |
| 421 | absl::optional<size_t> mline_index); |
| 422 | void SetRemoteStreamIdsIfUnset(const std::vector<std::string>& ids); |
Eldar Rello | 5ab79e6 | 2019-10-09 18:29:44 +0300 | [diff] [blame] | 423 | absl::optional<std::string> mid() const { return mid_; } |
| 424 | absl::optional<size_t> mline_index() const { return mline_index_; } |
Eldar Rello | 353a718 | 2019-11-25 18:49:44 +0200 | [diff] [blame] | 425 | absl::optional<std::vector<std::string>> remote_stream_ids() const { |
| 426 | return remote_stream_ids_; |
| 427 | } |
| 428 | bool has_m_section() const { return has_m_section_; } |
Eldar Rello | 5ab79e6 | 2019-10-09 18:29:44 +0300 | [diff] [blame] | 429 | bool newly_created() const { return newly_created_; } |
| 430 | |
| 431 | private: |
Eldar Rello | 5ab79e6 | 2019-10-09 18:29:44 +0300 | [diff] [blame] | 432 | absl::optional<std::string> mid_; |
| 433 | absl::optional<size_t> mline_index_; |
Eldar Rello | 353a718 | 2019-11-25 18:49:44 +0200 | [diff] [blame] | 434 | absl::optional<std::vector<std::string>> remote_stream_ids_; |
| 435 | // Indicates that mid value from stable state has been captured and |
| 436 | // that rollback has to restore the transceiver. Also protects against |
| 437 | // subsequent overwrites. |
| 438 | bool has_m_section_ = false; |
Eldar Rello | 5ab79e6 | 2019-10-09 18:29:44 +0300 | [diff] [blame] | 439 | // Indicates that the transceiver was created as part of applying a |
| 440 | // description to track potential need for removing transceiver during |
| 441 | // rollback. |
| 442 | bool newly_created_ = false; |
| 443 | }; |
| 444 | |
Steve Anton | ad18276 | 2018-09-05 20:22:40 +0000 | [diff] [blame] | 445 | // Implements MessageHandler. |
| 446 | void OnMessage(rtc::Message* msg) override; |
| 447 | |
Steve Anton | afb0bb7 | 2018-02-20 11:35:37 -0800 | [diff] [blame] | 448 | // Plan B helpers for getting the voice/video media channels for the single |
| 449 | // audio/video transceiver, if it exists. |
Karl Wiberg | 5966c50 | 2019-02-21 23:55:09 +0100 | [diff] [blame] | 450 | cricket::VoiceMediaChannel* voice_media_channel() const |
| 451 | RTC_RUN_ON(signaling_thread()); |
| 452 | cricket::VideoMediaChannel* video_media_channel() const |
| 453 | RTC_RUN_ON(signaling_thread()); |
Steve Anton | 6077675 | 2018-01-10 11:51:34 -0800 | [diff] [blame] | 454 | |
Steve Anton | 4171afb | 2017-11-20 10:20:22 -0800 | [diff] [blame] | 455 | std::vector<rtc::scoped_refptr<RtpSenderProxyWithInternal<RtpSenderInternal>>> |
Karl Wiberg | a58e169 | 2019-03-26 13:33:43 +0100 | [diff] [blame] | 456 | GetSendersInternal() const RTC_RUN_ON(signaling_thread()); |
Steve Anton | 4171afb | 2017-11-20 10:20:22 -0800 | [diff] [blame] | 457 | std::vector< |
| 458 | rtc::scoped_refptr<RtpReceiverProxyWithInternal<RtpReceiverInternal>>> |
Karl Wiberg | a58e169 | 2019-03-26 13:33:43 +0100 | [diff] [blame] | 459 | GetReceiversInternal() const RTC_RUN_ON(signaling_thread()); |
Steve Anton | 4171afb | 2017-11-20 10:20:22 -0800 | [diff] [blame] | 460 | |
| 461 | rtc::scoped_refptr<RtpTransceiverProxyWithInternal<RtpTransceiver>> |
Karl Wiberg | 5966c50 | 2019-02-21 23:55:09 +0100 | [diff] [blame] | 462 | GetAudioTransceiver() const RTC_RUN_ON(signaling_thread()); |
Steve Anton | 4171afb | 2017-11-20 10:20:22 -0800 | [diff] [blame] | 463 | rtc::scoped_refptr<RtpTransceiverProxyWithInternal<RtpTransceiver>> |
Karl Wiberg | 5966c50 | 2019-02-21 23:55:09 +0100 | [diff] [blame] | 464 | GetVideoTransceiver() const RTC_RUN_ON(signaling_thread()); |
Steve Anton | 4171afb | 2017-11-20 10:20:22 -0800 | [diff] [blame] | 465 | |
Steve Anton | afb0bb7 | 2018-02-20 11:35:37 -0800 | [diff] [blame] | 466 | rtc::scoped_refptr<RtpTransceiverProxyWithInternal<RtpTransceiver>> |
Karl Wiberg | a58e169 | 2019-03-26 13:33:43 +0100 | [diff] [blame] | 467 | GetFirstAudioTransceiver() const RTC_RUN_ON(signaling_thread()); |
Steve Anton | afb0bb7 | 2018-02-20 11:35:37 -0800 | [diff] [blame] | 468 | |
Henrik Boström | a3728d3 | 2019-10-28 12:09:49 +0100 | [diff] [blame] | 469 | // Implementation of the offer/answer exchange operations. These are chained |
| 470 | // onto the |operations_chain_| when the public CreateOffer(), CreateAnswer(), |
| 471 | // SetLocalDescription() and SetRemoteDescription() methods are invoked. |
| 472 | void DoCreateOffer( |
| 473 | const RTCOfferAnswerOptions& options, |
| 474 | rtc::scoped_refptr<CreateSessionDescriptionObserver> observer); |
| 475 | void DoCreateAnswer( |
| 476 | const RTCOfferAnswerOptions& options, |
| 477 | rtc::scoped_refptr<CreateSessionDescriptionObserver> observer); |
| 478 | void DoSetLocalDescription( |
| 479 | std::unique_ptr<SessionDescriptionInterface> desc, |
| 480 | rtc::scoped_refptr<SetSessionDescriptionObserver> observer); |
| 481 | void DoSetRemoteDescription( |
| 482 | std::unique_ptr<SessionDescriptionInterface> desc, |
| 483 | rtc::scoped_refptr<SetRemoteDescriptionObserverInterface> observer); |
| 484 | |
deadbeef | ab9b2d1 | 2015-10-14 11:33:11 -0700 | [diff] [blame] | 485 | void CreateAudioReceiver(MediaStreamInterface* stream, |
Karl Wiberg | 744310f | 2019-02-14 10:18:56 +0100 | [diff] [blame] | 486 | const RtpSenderInfo& remote_sender_info) |
| 487 | RTC_RUN_ON(signaling_thread()); |
perkj | f0dcfe2 | 2016-03-10 18:32:00 +0100 | [diff] [blame] | 488 | |
deadbeef | ab9b2d1 | 2015-10-14 11:33:11 -0700 | [diff] [blame] | 489 | void CreateVideoReceiver(MediaStreamInterface* stream, |
Karl Wiberg | 744310f | 2019-02-14 10:18:56 +0100 | [diff] [blame] | 490 | const RtpSenderInfo& remote_sender_info) |
| 491 | RTC_RUN_ON(signaling_thread()); |
Henrik Boström | 933d8b0 | 2017-10-10 10:05:16 -0700 | [diff] [blame] | 492 | rtc::scoped_refptr<RtpReceiverInterface> RemoveAndStopReceiver( |
Karl Wiberg | 5966c50 | 2019-02-21 23:55:09 +0100 | [diff] [blame] | 493 | const RtpSenderInfo& remote_sender_info) RTC_RUN_ON(signaling_thread()); |
korniltsev.anatoly | ec390b5 | 2017-07-24 17:00:25 -0700 | [diff] [blame] | 494 | |
| 495 | // May be called either by AddStream/RemoveStream, or when a track is |
| 496 | // added/removed from a stream previously added via AddStream. |
Karl Wiberg | 5966c50 | 2019-02-21 23:55:09 +0100 | [diff] [blame] | 497 | void AddAudioTrack(AudioTrackInterface* track, MediaStreamInterface* stream) |
| 498 | RTC_RUN_ON(signaling_thread()); |
korniltsev.anatoly | ec390b5 | 2017-07-24 17:00:25 -0700 | [diff] [blame] | 499 | void RemoveAudioTrack(AudioTrackInterface* track, |
Karl Wiberg | 5966c50 | 2019-02-21 23:55:09 +0100 | [diff] [blame] | 500 | MediaStreamInterface* stream) |
| 501 | RTC_RUN_ON(signaling_thread()); |
| 502 | void AddVideoTrack(VideoTrackInterface* track, MediaStreamInterface* stream) |
| 503 | RTC_RUN_ON(signaling_thread()); |
korniltsev.anatoly | ec390b5 | 2017-07-24 17:00:25 -0700 | [diff] [blame] | 504 | void RemoveVideoTrack(VideoTrackInterface* track, |
Karl Wiberg | 5966c50 | 2019-02-21 23:55:09 +0100 | [diff] [blame] | 505 | MediaStreamInterface* stream) |
| 506 | RTC_RUN_ON(signaling_thread()); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 507 | |
Steve Anton | f9381f0 | 2017-12-14 10:23:57 -0800 | [diff] [blame] | 508 | // AddTrack implementation when Unified Plan is specified. |
| 509 | RTCErrorOr<rtc::scoped_refptr<RtpSenderInterface>> AddTrackUnifiedPlan( |
| 510 | rtc::scoped_refptr<MediaStreamTrackInterface> track, |
Karl Wiberg | a58e169 | 2019-03-26 13:33:43 +0100 | [diff] [blame] | 511 | const std::vector<std::string>& stream_ids) |
| 512 | RTC_RUN_ON(signaling_thread()); |
Steve Anton | f9381f0 | 2017-12-14 10:23:57 -0800 | [diff] [blame] | 513 | // AddTrack implementation when Plan B is specified. |
| 514 | RTCErrorOr<rtc::scoped_refptr<RtpSenderInterface>> AddTrackPlanB( |
| 515 | rtc::scoped_refptr<MediaStreamTrackInterface> track, |
Karl Wiberg | 5966c50 | 2019-02-21 23:55:09 +0100 | [diff] [blame] | 516 | const std::vector<std::string>& stream_ids) |
| 517 | RTC_RUN_ON(signaling_thread()); |
Steve Anton | f9381f0 | 2017-12-14 10:23:57 -0800 | [diff] [blame] | 518 | |
| 519 | // Returns the first RtpTransceiver suitable for a newly added track, if such |
| 520 | // transceiver is available. |
| 521 | rtc::scoped_refptr<RtpTransceiverProxyWithInternal<RtpTransceiver>> |
| 522 | FindFirstTransceiverForAddedTrack( |
Karl Wiberg | a58e169 | 2019-03-26 13:33:43 +0100 | [diff] [blame] | 523 | rtc::scoped_refptr<MediaStreamTrackInterface> track) |
| 524 | RTC_RUN_ON(signaling_thread()); |
Steve Anton | f9381f0 | 2017-12-14 10:23:57 -0800 | [diff] [blame] | 525 | |
Steve Anton | f9381f0 | 2017-12-14 10:23:57 -0800 | [diff] [blame] | 526 | rtc::scoped_refptr<RtpTransceiverProxyWithInternal<RtpTransceiver>> |
Karl Wiberg | a58e169 | 2019-03-26 13:33:43 +0100 | [diff] [blame] | 527 | FindTransceiverBySender(rtc::scoped_refptr<RtpSenderInterface> sender) |
| 528 | RTC_RUN_ON(signaling_thread()); |
Steve Anton | f9381f0 | 2017-12-14 10:23:57 -0800 | [diff] [blame] | 529 | |
Steve Anton | 22da89f | 2018-01-25 13:58:07 -0800 | [diff] [blame] | 530 | // Internal implementation for AddTransceiver family of methods. If |
| 531 | // |fire_callback| is set, fires OnRenegotiationNeeded callback if successful. |
Steve Anton | 9158ef6 | 2017-11-27 13:01:52 -0800 | [diff] [blame] | 532 | RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>> AddTransceiver( |
| 533 | cricket::MediaType media_type, |
| 534 | rtc::scoped_refptr<MediaStreamTrackInterface> track, |
Steve Anton | 22da89f | 2018-01-25 13:58:07 -0800 | [diff] [blame] | 535 | const RtpTransceiverInit& init, |
Karl Wiberg | 744310f | 2019-02-14 10:18:56 +0100 | [diff] [blame] | 536 | bool fire_callback = true) RTC_RUN_ON(signaling_thread()); |
Steve Anton | 9158ef6 | 2017-11-27 13:01:52 -0800 | [diff] [blame] | 537 | |
Steve Anton | 02ee47c | 2018-01-10 16:26:06 -0800 | [diff] [blame] | 538 | rtc::scoped_refptr<RtpSenderProxyWithInternal<RtpSenderInternal>> |
| 539 | CreateSender(cricket::MediaType media_type, |
Steve Anton | 111fdfd | 2018-06-25 13:03:36 -0700 | [diff] [blame] | 540 | const std::string& id, |
Steve Anton | 02ee47c | 2018-01-10 16:26:06 -0800 | [diff] [blame] | 541 | rtc::scoped_refptr<MediaStreamTrackInterface> track, |
Florent Castelli | 892acf0 | 2018-10-01 22:47:20 +0200 | [diff] [blame] | 542 | const std::vector<std::string>& stream_ids, |
| 543 | const std::vector<RtpEncodingParameters>& send_encodings); |
Steve Anton | 02ee47c | 2018-01-10 16:26:06 -0800 | [diff] [blame] | 544 | |
| 545 | rtc::scoped_refptr<RtpReceiverProxyWithInternal<RtpReceiverInternal>> |
| 546 | CreateReceiver(cricket::MediaType media_type, const std::string& receiver_id); |
| 547 | |
Steve Anton | f9381f0 | 2017-12-14 10:23:57 -0800 | [diff] [blame] | 548 | // Create a new RtpTransceiver of the given type and add it to the list of |
| 549 | // transceivers. |
| 550 | rtc::scoped_refptr<RtpTransceiverProxyWithInternal<RtpTransceiver>> |
Steve Anton | 02ee47c | 2018-01-10 16:26:06 -0800 | [diff] [blame] | 551 | CreateAndAddTransceiver( |
| 552 | rtc::scoped_refptr<RtpSenderProxyWithInternal<RtpSenderInternal>> sender, |
| 553 | rtc::scoped_refptr<RtpReceiverProxyWithInternal<RtpReceiverInternal>> |
Karl Wiberg | a58e169 | 2019-03-26 13:33:43 +0100 | [diff] [blame] | 554 | receiver) RTC_RUN_ON(signaling_thread()); |
Steve Anton | f9381f0 | 2017-12-14 10:23:57 -0800 | [diff] [blame] | 555 | |
Karl Wiberg | 744310f | 2019-02-14 10:18:56 +0100 | [diff] [blame] | 556 | void SetIceConnectionState(IceConnectionState new_state) |
| 557 | RTC_RUN_ON(signaling_thread()); |
Jonas Olsson | 635474e | 2018-10-18 15:58:17 +0200 | [diff] [blame] | 558 | void SetStandardizedIceConnectionState( |
Karl Wiberg | 744310f | 2019-02-14 10:18:56 +0100 | [diff] [blame] | 559 | PeerConnectionInterface::IceConnectionState new_state) |
| 560 | RTC_RUN_ON(signaling_thread()); |
Jonas Olsson | 635474e | 2018-10-18 15:58:17 +0200 | [diff] [blame] | 561 | void SetConnectionState( |
Karl Wiberg | 744310f | 2019-02-14 10:18:56 +0100 | [diff] [blame] | 562 | PeerConnectionInterface::PeerConnectionState new_state) |
| 563 | RTC_RUN_ON(signaling_thread()); |
Jonas Olsson | 635474e | 2018-10-18 15:58:17 +0200 | [diff] [blame] | 564 | |
Eldar Rello | da13ea2 | 2019-06-01 12:23:43 +0300 | [diff] [blame] | 565 | // Called any time the IceGatheringState changes. |
Karl Wiberg | 744310f | 2019-02-14 10:18:56 +0100 | [diff] [blame] | 566 | void OnIceGatheringChange(IceGatheringState new_state) |
| 567 | RTC_RUN_ON(signaling_thread()); |
Steve Anton | ba81867 | 2017-11-06 10:21:57 -0800 | [diff] [blame] | 568 | // New ICE candidate has been gathered. |
Karl Wiberg | 744310f | 2019-02-14 10:18:56 +0100 | [diff] [blame] | 569 | void OnIceCandidate(std::unique_ptr<IceCandidateInterface> candidate) |
| 570 | RTC_RUN_ON(signaling_thread()); |
Eldar Rello | da13ea2 | 2019-06-01 12:23:43 +0300 | [diff] [blame] | 571 | // Gathering of an ICE candidate failed. |
Eldar Rello | 0095d37 | 2019-12-02 22:22:07 +0200 | [diff] [blame] | 572 | void OnIceCandidateError(const std::string& address, |
| 573 | int port, |
Eldar Rello | da13ea2 | 2019-06-01 12:23:43 +0300 | [diff] [blame] | 574 | const std::string& url, |
| 575 | int error_code, |
| 576 | const std::string& error_text) |
| 577 | RTC_RUN_ON(signaling_thread()); |
Steve Anton | ba81867 | 2017-11-06 10:21:57 -0800 | [diff] [blame] | 578 | // Some local ICE candidates have been removed. |
Karl Wiberg | 744310f | 2019-02-14 10:18:56 +0100 | [diff] [blame] | 579 | void OnIceCandidatesRemoved(const std::vector<cricket::Candidate>& candidates) |
| 580 | RTC_RUN_ON(signaling_thread()); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 581 | |
Alex Drake | 00c7ecf | 2019-08-06 10:54:47 -0700 | [diff] [blame] | 582 | void OnSelectedCandidatePairChanged( |
| 583 | const cricket::CandidatePairChangeEvent& event) |
| 584 | RTC_RUN_ON(signaling_thread()); |
| 585 | |
Steve Anton | ba81867 | 2017-11-06 10:21:57 -0800 | [diff] [blame] | 586 | // Update the state, signaling if necessary. |
Karl Wiberg | 744310f | 2019-02-14 10:18:56 +0100 | [diff] [blame] | 587 | void ChangeSignalingState(SignalingState signaling_state) |
| 588 | RTC_RUN_ON(signaling_thread()); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 589 | |
deadbeef | eb45981 | 2015-12-15 19:24:43 -0800 | [diff] [blame] | 590 | // Signals from MediaStreamObserver. |
| 591 | void OnAudioTrackAdded(AudioTrackInterface* track, |
Karl Wiberg | 744310f | 2019-02-14 10:18:56 +0100 | [diff] [blame] | 592 | MediaStreamInterface* stream) |
| 593 | RTC_RUN_ON(signaling_thread()); |
deadbeef | eb45981 | 2015-12-15 19:24:43 -0800 | [diff] [blame] | 594 | void OnAudioTrackRemoved(AudioTrackInterface* track, |
Karl Wiberg | 744310f | 2019-02-14 10:18:56 +0100 | [diff] [blame] | 595 | MediaStreamInterface* stream) |
| 596 | RTC_RUN_ON(signaling_thread()); |
deadbeef | eb45981 | 2015-12-15 19:24:43 -0800 | [diff] [blame] | 597 | void OnVideoTrackAdded(VideoTrackInterface* track, |
Karl Wiberg | 744310f | 2019-02-14 10:18:56 +0100 | [diff] [blame] | 598 | MediaStreamInterface* stream) |
| 599 | RTC_RUN_ON(signaling_thread()); |
deadbeef | eb45981 | 2015-12-15 19:24:43 -0800 | [diff] [blame] | 600 | void OnVideoTrackRemoved(VideoTrackInterface* track, |
Karl Wiberg | 744310f | 2019-02-14 10:18:56 +0100 | [diff] [blame] | 601 | MediaStreamInterface* stream) |
| 602 | RTC_RUN_ON(signaling_thread()); |
deadbeef | eb45981 | 2015-12-15 19:24:43 -0800 | [diff] [blame] | 603 | |
Henrik Boström | 3163867 | 2017-11-23 17:48:32 +0100 | [diff] [blame] | 604 | void PostSetSessionDescriptionSuccess( |
| 605 | SetSessionDescriptionObserver* observer); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 606 | void PostSetSessionDescriptionFailure(SetSessionDescriptionObserver* observer, |
Steve Anton | ad18276 | 2018-09-05 20:22:40 +0000 | [diff] [blame] | 607 | RTCError&& error); |
deadbeef | ab9b2d1 | 2015-10-14 11:33:11 -0700 | [diff] [blame] | 608 | void PostCreateSessionDescriptionFailure( |
| 609 | CreateSessionDescriptionObserver* observer, |
Harald Alvestrand | 5081c0c | 2018-03-09 15:18:03 +0100 | [diff] [blame] | 610 | RTCError error); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 611 | |
Steve Anton | 8a00691 | 2017-12-04 15:25:56 -0800 | [diff] [blame] | 612 | // Synchronous implementations of SetLocalDescription/SetRemoteDescription |
| 613 | // that return an RTCError instead of invoking a callback. |
| 614 | RTCError ApplyLocalDescription( |
| 615 | std::unique_ptr<SessionDescriptionInterface> desc); |
| 616 | RTCError ApplyRemoteDescription( |
| 617 | std::unique_ptr<SessionDescriptionInterface> desc); |
| 618 | |
Steve Anton | dcc3c02 | 2017-12-22 16:02:54 -0800 | [diff] [blame] | 619 | // Updates the local RtpTransceivers according to the JSEP rules. Called as |
| 620 | // part of setting the local/remote description. |
| 621 | RTCError UpdateTransceiversAndDataChannels( |
| 622 | cricket::ContentSource source, |
Seth Hampson | ae8a90a | 2018-02-13 15:33:48 -0800 | [diff] [blame] | 623 | const SessionDescriptionInterface& new_session, |
| 624 | const SessionDescriptionInterface* old_local_description, |
Karl Wiberg | 106d92d | 2019-02-14 10:17:47 +0100 | [diff] [blame] | 625 | const SessionDescriptionInterface* old_remote_description) |
| 626 | RTC_RUN_ON(signaling_thread()); |
Steve Anton | dcc3c02 | 2017-12-22 16:02:54 -0800 | [diff] [blame] | 627 | |
| 628 | // Either creates or destroys the transceiver's BaseChannel according to the |
| 629 | // given media section. |
| 630 | RTCError UpdateTransceiverChannel( |
| 631 | rtc::scoped_refptr<RtpTransceiverProxyWithInternal<RtpTransceiver>> |
| 632 | transceiver, |
| 633 | const cricket::ContentInfo& content, |
Karl Wiberg | 5966c50 | 2019-02-21 23:55:09 +0100 | [diff] [blame] | 634 | const cricket::ContentGroup* bundle_group) RTC_RUN_ON(signaling_thread()); |
Steve Anton | dcc3c02 | 2017-12-22 16:02:54 -0800 | [diff] [blame] | 635 | |
Steve Anton | fa2260d | 2017-12-28 16:38:23 -0800 | [diff] [blame] | 636 | // Either creates or destroys the local data channel according to the given |
| 637 | // media section. |
| 638 | RTCError UpdateDataChannel(cricket::ContentSource source, |
| 639 | const cricket::ContentInfo& content, |
Karl Wiberg | 106d92d | 2019-02-14 10:17:47 +0100 | [diff] [blame] | 640 | const cricket::ContentGroup* bundle_group) |
| 641 | RTC_RUN_ON(signaling_thread()); |
Steve Anton | fa2260d | 2017-12-28 16:38:23 -0800 | [diff] [blame] | 642 | |
Steve Anton | dcc3c02 | 2017-12-22 16:02:54 -0800 | [diff] [blame] | 643 | // Associate the given transceiver according to the JSEP rules. |
| 644 | RTCErrorOr< |
| 645 | rtc::scoped_refptr<RtpTransceiverProxyWithInternal<RtpTransceiver>>> |
| 646 | AssociateTransceiver(cricket::ContentSource source, |
Seth Hampson | ae8a90a | 2018-02-13 15:33:48 -0800 | [diff] [blame] | 647 | SdpType type, |
Steve Anton | dcc3c02 | 2017-12-22 16:02:54 -0800 | [diff] [blame] | 648 | size_t mline_index, |
| 649 | const cricket::ContentInfo& content, |
Seth Hampson | ae8a90a | 2018-02-13 15:33:48 -0800 | [diff] [blame] | 650 | const cricket::ContentInfo* old_local_content, |
Karl Wiberg | 5966c50 | 2019-02-21 23:55:09 +0100 | [diff] [blame] | 651 | const cricket::ContentInfo* old_remote_content) |
| 652 | RTC_RUN_ON(signaling_thread()); |
Steve Anton | dcc3c02 | 2017-12-22 16:02:54 -0800 | [diff] [blame] | 653 | |
| 654 | // Returns the RtpTransceiver, if found, that is associated to the given MID. |
| 655 | rtc::scoped_refptr<RtpTransceiverProxyWithInternal<RtpTransceiver>> |
Karl Wiberg | 5966c50 | 2019-02-21 23:55:09 +0100 | [diff] [blame] | 656 | GetAssociatedTransceiver(const std::string& mid) const |
| 657 | RTC_RUN_ON(signaling_thread()); |
Steve Anton | dcc3c02 | 2017-12-22 16:02:54 -0800 | [diff] [blame] | 658 | |
| 659 | // Returns the RtpTransceiver, if found, that was assigned to the given mline |
| 660 | // index in CreateOffer. |
| 661 | rtc::scoped_refptr<RtpTransceiverProxyWithInternal<RtpTransceiver>> |
Karl Wiberg | 5966c50 | 2019-02-21 23:55:09 +0100 | [diff] [blame] | 662 | GetTransceiverByMLineIndex(size_t mline_index) const |
| 663 | RTC_RUN_ON(signaling_thread()); |
Steve Anton | dcc3c02 | 2017-12-22 16:02:54 -0800 | [diff] [blame] | 664 | |
| 665 | // Returns an RtpTransciever, if available, that can be used to receive the |
| 666 | // given media type according to JSEP rules. |
| 667 | rtc::scoped_refptr<RtpTransceiverProxyWithInternal<RtpTransceiver>> |
Karl Wiberg | 5966c50 | 2019-02-21 23:55:09 +0100 | [diff] [blame] | 668 | FindAvailableTransceiverToReceive(cricket::MediaType media_type) const |
| 669 | RTC_RUN_ON(signaling_thread()); |
Steve Anton | dcc3c02 | 2017-12-22 16:02:54 -0800 | [diff] [blame] | 670 | |
Steve Anton | ed10bd9 | 2017-12-05 10:52:59 -0800 | [diff] [blame] | 671 | // Returns the media section in the given session description that is |
| 672 | // associated with the RtpTransceiver. Returns null if none found or this |
| 673 | // RtpTransceiver is not associated. Logic varies depending on the |
| 674 | // SdpSemantics specified in the configuration. |
| 675 | const cricket::ContentInfo* FindMediaSectionForTransceiver( |
| 676 | rtc::scoped_refptr<RtpTransceiverProxyWithInternal<RtpTransceiver>> |
| 677 | transceiver, |
Karl Wiberg | 5966c50 | 2019-02-21 23:55:09 +0100 | [diff] [blame] | 678 | const SessionDescriptionInterface* sdesc) const |
| 679 | RTC_RUN_ON(signaling_thread()); |
Steve Anton | ed10bd9 | 2017-12-05 10:52:59 -0800 | [diff] [blame] | 680 | |
Henrik Boström | afa07dd | 2018-12-20 11:06:02 +0100 | [diff] [blame] | 681 | // Runs the algorithm **set the associated remote streams** specified in |
| 682 | // https://w3c.github.io/webrtc-pc/#set-associated-remote-streams. |
| 683 | void SetAssociatedRemoteStreams( |
| 684 | rtc::scoped_refptr<RtpReceiverInternal> receiver, |
| 685 | const std::vector<std::string>& stream_ids, |
| 686 | std::vector<rtc::scoped_refptr<MediaStreamInterface>>* added_streams, |
Karl Wiberg | 1e1e102 | 2019-03-22 14:27:22 +0100 | [diff] [blame] | 687 | std::vector<rtc::scoped_refptr<MediaStreamInterface>>* removed_streams) |
| 688 | RTC_RUN_ON(signaling_thread()); |
Henrik Boström | afa07dd | 2018-12-20 11:06:02 +0100 | [diff] [blame] | 689 | |
Steve Anton | 0f5400a | 2018-07-17 14:25:36 -0700 | [diff] [blame] | 690 | // Runs the algorithm **process the removal of a remote track** specified in |
| 691 | // the WebRTC specification. |
| 692 | // This method will update the following lists: |
| 693 | // |remove_list| is the list of transceivers for which the receiving track is |
| 694 | // being removed. |
| 695 | // |removed_streams| is the list of streams which no longer have a receiving |
| 696 | // track so should be removed. |
| 697 | // https://w3c.github.io/webrtc-pc/#process-remote-track-removal |
| 698 | void ProcessRemovalOfRemoteTrack( |
| 699 | rtc::scoped_refptr<RtpTransceiverProxyWithInternal<RtpTransceiver>> |
| 700 | transceiver, |
| 701 | std::vector<rtc::scoped_refptr<RtpTransceiverInterface>>* remove_list, |
Karl Wiberg | 1e1e102 | 2019-03-22 14:27:22 +0100 | [diff] [blame] | 702 | std::vector<rtc::scoped_refptr<MediaStreamInterface>>* removed_streams) |
| 703 | RTC_RUN_ON(signaling_thread()); |
Steve Anton | 0f5400a | 2018-07-17 14:25:36 -0700 | [diff] [blame] | 704 | |
Henrik Boström | afa07dd | 2018-12-20 11:06:02 +0100 | [diff] [blame] | 705 | void RemoveRemoteStreamsIfEmpty( |
| 706 | const std::vector<rtc::scoped_refptr<MediaStreamInterface>>& |
| 707 | remote_streams, |
Karl Wiberg | 1e1e102 | 2019-03-22 14:27:22 +0100 | [diff] [blame] | 708 | std::vector<rtc::scoped_refptr<MediaStreamInterface>>* removed_streams) |
| 709 | RTC_RUN_ON(signaling_thread()); |
Henrik Boström | afa07dd | 2018-12-20 11:06:02 +0100 | [diff] [blame] | 710 | |
Steve Anton | 52d8677 | 2018-02-20 15:48:12 -0800 | [diff] [blame] | 711 | void OnNegotiationNeeded(); |
| 712 | |
deadbeef | ab9b2d1 | 2015-10-14 11:33:11 -0700 | [diff] [blame] | 713 | // Returns a MediaSessionOptions struct with options decided by |options|, |
| 714 | // the local MediaStreams and DataChannels. |
Steve Anton | dcc3c02 | 2017-12-22 16:02:54 -0800 | [diff] [blame] | 715 | void GetOptionsForOffer(const PeerConnectionInterface::RTCOfferAnswerOptions& |
| 716 | offer_answer_options, |
Karl Wiberg | 5966c50 | 2019-02-21 23:55:09 +0100 | [diff] [blame] | 717 | cricket::MediaSessionOptions* session_options) |
| 718 | RTC_RUN_ON(signaling_thread()); |
Steve Anton | dcc3c02 | 2017-12-22 16:02:54 -0800 | [diff] [blame] | 719 | void GetOptionsForPlanBOffer( |
| 720 | const PeerConnectionInterface::RTCOfferAnswerOptions& |
| 721 | offer_answer_options, |
Karl Wiberg | 5966c50 | 2019-02-21 23:55:09 +0100 | [diff] [blame] | 722 | cricket::MediaSessionOptions* session_options) |
| 723 | RTC_RUN_ON(signaling_thread()); |
Steve Anton | dcc3c02 | 2017-12-22 16:02:54 -0800 | [diff] [blame] | 724 | void GetOptionsForUnifiedPlanOffer( |
| 725 | const PeerConnectionInterface::RTCOfferAnswerOptions& |
| 726 | offer_answer_options, |
Karl Wiberg | 5966c50 | 2019-02-21 23:55:09 +0100 | [diff] [blame] | 727 | cricket::MediaSessionOptions* session_options) |
| 728 | RTC_RUN_ON(signaling_thread()); |
deadbeef | ab9b2d1 | 2015-10-14 11:33:11 -0700 | [diff] [blame] | 729 | |
Karl Wiberg | 5966c50 | 2019-02-21 23:55:09 +0100 | [diff] [blame] | 730 | RTCError HandleLegacyOfferOptions(const RTCOfferAnswerOptions& options) |
| 731 | RTC_RUN_ON(signaling_thread()); |
Steve Anton | 22da89f | 2018-01-25 13:58:07 -0800 | [diff] [blame] | 732 | void RemoveRecvDirectionFromReceivingTransceiversOfType( |
Karl Wiberg | a58e169 | 2019-03-26 13:33:43 +0100 | [diff] [blame] | 733 | cricket::MediaType media_type) RTC_RUN_ON(signaling_thread()); |
Steve Anton | 22da89f | 2018-01-25 13:58:07 -0800 | [diff] [blame] | 734 | void AddUpToOneReceivingTransceiverOfType(cricket::MediaType media_type); |
| 735 | std::vector< |
| 736 | rtc::scoped_refptr<RtpTransceiverProxyWithInternal<RtpTransceiver>>> |
Karl Wiberg | a58e169 | 2019-03-26 13:33:43 +0100 | [diff] [blame] | 737 | GetReceivingTransceiversOfType(cricket::MediaType media_type) |
| 738 | RTC_RUN_ON(signaling_thread()); |
Steve Anton | 22da89f | 2018-01-25 13:58:07 -0800 | [diff] [blame] | 739 | |
deadbeef | ab9b2d1 | 2015-10-14 11:33:11 -0700 | [diff] [blame] | 740 | // Returns a MediaSessionOptions struct with options decided by |
| 741 | // |constraints|, the local MediaStreams and DataChannels. |
Steve Anton | dcc3c02 | 2017-12-22 16:02:54 -0800 | [diff] [blame] | 742 | void GetOptionsForAnswer(const RTCOfferAnswerOptions& offer_answer_options, |
Karl Wiberg | 5966c50 | 2019-02-21 23:55:09 +0100 | [diff] [blame] | 743 | cricket::MediaSessionOptions* session_options) |
| 744 | RTC_RUN_ON(signaling_thread()); |
Steve Anton | dcc3c02 | 2017-12-22 16:02:54 -0800 | [diff] [blame] | 745 | void GetOptionsForPlanBAnswer( |
| 746 | const PeerConnectionInterface::RTCOfferAnswerOptions& |
| 747 | offer_answer_options, |
Karl Wiberg | 5966c50 | 2019-02-21 23:55:09 +0100 | [diff] [blame] | 748 | cricket::MediaSessionOptions* session_options) |
| 749 | RTC_RUN_ON(signaling_thread()); |
Steve Anton | dcc3c02 | 2017-12-22 16:02:54 -0800 | [diff] [blame] | 750 | void GetOptionsForUnifiedPlanAnswer( |
| 751 | const PeerConnectionInterface::RTCOfferAnswerOptions& |
| 752 | offer_answer_options, |
Karl Wiberg | 5966c50 | 2019-02-21 23:55:09 +0100 | [diff] [blame] | 753 | cricket::MediaSessionOptions* session_options) |
| 754 | RTC_RUN_ON(signaling_thread()); |
hta | a2a49d9 | 2016-03-04 02:51:39 -0800 | [diff] [blame] | 755 | |
zhihuang | 1c378ed | 2017-08-17 14:10:50 -0700 | [diff] [blame] | 756 | // Generates MediaDescriptionOptions for the |session_opts| based on existing |
| 757 | // local description or remote description. |
| 758 | void GenerateMediaDescriptionOptions( |
| 759 | const SessionDescriptionInterface* session_desc, |
Steve Anton | 1d03a75 | 2017-11-27 14:30:09 -0800 | [diff] [blame] | 760 | RtpTransceiverDirection audio_direction, |
| 761 | RtpTransceiverDirection video_direction, |
Danil Chapovalov | 66cadcc | 2018-06-19 16:47:43 +0200 | [diff] [blame] | 762 | absl::optional<size_t>* audio_index, |
| 763 | absl::optional<size_t>* video_index, |
| 764 | absl::optional<size_t>* data_index, |
Karl Wiberg | 85a4a93 | 2019-03-22 15:29:58 +0100 | [diff] [blame] | 765 | cricket::MediaSessionOptions* session_options) |
| 766 | RTC_RUN_ON(signaling_thread()); |
deadbeef | ab9b2d1 | 2015-10-14 11:33:11 -0700 | [diff] [blame] | 767 | |
Steve Anton | fa2260d | 2017-12-28 16:38:23 -0800 | [diff] [blame] | 768 | // Generates the active MediaDescriptionOptions for the local data channel |
| 769 | // given the specified MID. |
| 770 | cricket::MediaDescriptionOptions GetMediaDescriptionOptionsForActiveData( |
Karl Wiberg | 85a4a93 | 2019-03-22 15:29:58 +0100 | [diff] [blame] | 771 | const std::string& mid) const RTC_RUN_ON(signaling_thread()); |
Steve Anton | fa2260d | 2017-12-28 16:38:23 -0800 | [diff] [blame] | 772 | |
| 773 | // Generates the rejected MediaDescriptionOptions for the local data channel |
| 774 | // given the specified MID. |
| 775 | cricket::MediaDescriptionOptions GetMediaDescriptionOptionsForRejectedData( |
Karl Wiberg | 85a4a93 | 2019-03-22 15:29:58 +0100 | [diff] [blame] | 776 | const std::string& mid) const RTC_RUN_ON(signaling_thread()); |
Steve Anton | fa2260d | 2017-12-28 16:38:23 -0800 | [diff] [blame] | 777 | |
| 778 | // Returns the MID for the data section associated with either the |
| 779 | // RtpDataChannel or SCTP data channel, if it has been set. If no data |
| 780 | // channels are configured this will return nullopt. |
Karl Wiberg | 2cc368f | 2019-04-02 11:31:56 +0200 | [diff] [blame] | 781 | absl::optional<std::string> GetDataMid() const RTC_RUN_ON(signaling_thread()); |
Steve Anton | fa2260d | 2017-12-28 16:38:23 -0800 | [diff] [blame] | 782 | |
Steve Anton | 4171afb | 2017-11-20 10:20:22 -0800 | [diff] [blame] | 783 | // Remove all local and remote senders of type |media_type|. |
deadbeef | faac497 | 2015-11-12 15:33:07 -0800 | [diff] [blame] | 784 | // Called when a media type is rejected (m-line set to port 0). |
Karl Wiberg | 744310f | 2019-02-14 10:18:56 +0100 | [diff] [blame] | 785 | void RemoveSenders(cricket::MediaType media_type) |
| 786 | RTC_RUN_ON(signaling_thread()); |
deadbeef | faac497 | 2015-11-12 15:33:07 -0800 | [diff] [blame] | 787 | |
deadbeef | bda7e0b | 2015-12-08 17:13:40 -0800 | [diff] [blame] | 788 | // Makes sure a MediaStreamTrack is created for each StreamParam in |streams|, |
| 789 | // and existing MediaStreamTracks are removed if there is no corresponding |
| 790 | // StreamParam. If |default_track_needed| is true, a default MediaStreamTrack |
| 791 | // is created if it doesn't exist; if false, it's removed if it exists. |
| 792 | // |media_type| is the type of the |streams| and can be either audio or video. |
deadbeef | ab9b2d1 | 2015-10-14 11:33:11 -0700 | [diff] [blame] | 793 | // If a new MediaStream is created it is added to |new_streams|. |
Steve Anton | 4171afb | 2017-11-20 10:20:22 -0800 | [diff] [blame] | 794 | void UpdateRemoteSendersList( |
deadbeef | ab9b2d1 | 2015-10-14 11:33:11 -0700 | [diff] [blame] | 795 | const std::vector<cricket::StreamParams>& streams, |
deadbeef | bda7e0b | 2015-12-08 17:13:40 -0800 | [diff] [blame] | 796 | bool default_track_needed, |
deadbeef | ab9b2d1 | 2015-10-14 11:33:11 -0700 | [diff] [blame] | 797 | cricket::MediaType media_type, |
Karl Wiberg | 744310f | 2019-02-14 10:18:56 +0100 | [diff] [blame] | 798 | StreamCollection* new_streams) RTC_RUN_ON(signaling_thread()); |
deadbeef | ab9b2d1 | 2015-10-14 11:33:11 -0700 | [diff] [blame] | 799 | |
Steve Anton | 4171afb | 2017-11-20 10:20:22 -0800 | [diff] [blame] | 800 | // Triggered when a remote sender has been seen for the first time in a remote |
deadbeef | ab9b2d1 | 2015-10-14 11:33:11 -0700 | [diff] [blame] | 801 | // session description. It creates a remote MediaStreamTrackInterface |
| 802 | // implementation and triggers CreateAudioReceiver or CreateVideoReceiver. |
Steve Anton | 4171afb | 2017-11-20 10:20:22 -0800 | [diff] [blame] | 803 | void OnRemoteSenderAdded(const RtpSenderInfo& sender_info, |
Karl Wiberg | 744310f | 2019-02-14 10:18:56 +0100 | [diff] [blame] | 804 | cricket::MediaType media_type) |
| 805 | RTC_RUN_ON(signaling_thread()); |
deadbeef | ab9b2d1 | 2015-10-14 11:33:11 -0700 | [diff] [blame] | 806 | |
Steve Anton | 4171afb | 2017-11-20 10:20:22 -0800 | [diff] [blame] | 807 | // Triggered when a remote sender has been removed from a remote session |
| 808 | // description. It removes the remote sender with id |sender_id| from a remote |
deadbeef | ab9b2d1 | 2015-10-14 11:33:11 -0700 | [diff] [blame] | 809 | // MediaStream and triggers DestroyAudioReceiver or DestroyVideoReceiver. |
Steve Anton | 4171afb | 2017-11-20 10:20:22 -0800 | [diff] [blame] | 810 | void OnRemoteSenderRemoved(const RtpSenderInfo& sender_info, |
Karl Wiberg | 744310f | 2019-02-14 10:18:56 +0100 | [diff] [blame] | 811 | cricket::MediaType media_type) |
| 812 | RTC_RUN_ON(signaling_thread()); |
deadbeef | ab9b2d1 | 2015-10-14 11:33:11 -0700 | [diff] [blame] | 813 | |
| 814 | // Finds remote MediaStreams without any tracks and removes them from |
| 815 | // |remote_streams_| and notifies the observer that the MediaStreams no longer |
| 816 | // exist. |
Karl Wiberg | 744310f | 2019-02-14 10:18:56 +0100 | [diff] [blame] | 817 | void UpdateEndedRemoteMediaStreams() RTC_RUN_ON(signaling_thread()); |
deadbeef | ab9b2d1 | 2015-10-14 11:33:11 -0700 | [diff] [blame] | 818 | |
deadbeef | ab9b2d1 | 2015-10-14 11:33:11 -0700 | [diff] [blame] | 819 | // Loops through the vector of |streams| and finds added and removed |
| 820 | // StreamParams since last time this method was called. |
Steve Anton | 4171afb | 2017-11-20 10:20:22 -0800 | [diff] [blame] | 821 | // For each new or removed StreamParam, OnLocalSenderSeen or |
| 822 | // OnLocalSenderRemoved is invoked. |
| 823 | void UpdateLocalSenders(const std::vector<cricket::StreamParams>& streams, |
Karl Wiberg | 5966c50 | 2019-02-21 23:55:09 +0100 | [diff] [blame] | 824 | cricket::MediaType media_type) |
| 825 | RTC_RUN_ON(signaling_thread()); |
deadbeef | ab9b2d1 | 2015-10-14 11:33:11 -0700 | [diff] [blame] | 826 | |
Steve Anton | 4171afb | 2017-11-20 10:20:22 -0800 | [diff] [blame] | 827 | // Triggered when a local sender has been seen for the first time in a local |
deadbeef | ab9b2d1 | 2015-10-14 11:33:11 -0700 | [diff] [blame] | 828 | // session description. |
| 829 | // This method triggers CreateAudioSender or CreateVideoSender if the rtp |
| 830 | // streams in the local SessionDescription can be mapped to a MediaStreamTrack |
| 831 | // in a MediaStream in |local_streams_| |
Steve Anton | 4171afb | 2017-11-20 10:20:22 -0800 | [diff] [blame] | 832 | void OnLocalSenderAdded(const RtpSenderInfo& sender_info, |
Karl Wiberg | 5966c50 | 2019-02-21 23:55:09 +0100 | [diff] [blame] | 833 | cricket::MediaType media_type) |
| 834 | RTC_RUN_ON(signaling_thread()); |
deadbeef | ab9b2d1 | 2015-10-14 11:33:11 -0700 | [diff] [blame] | 835 | |
Steve Anton | 4171afb | 2017-11-20 10:20:22 -0800 | [diff] [blame] | 836 | // Triggered when a local sender has been removed from a local session |
deadbeef | ab9b2d1 | 2015-10-14 11:33:11 -0700 | [diff] [blame] | 837 | // description. |
| 838 | // This method triggers DestroyAudioSender or DestroyVideoSender if a stream |
| 839 | // has been removed from the local SessionDescription and the stream can be |
| 840 | // mapped to a MediaStreamTrack in a MediaStream in |local_streams_|. |
Steve Anton | 4171afb | 2017-11-20 10:20:22 -0800 | [diff] [blame] | 841 | void OnLocalSenderRemoved(const RtpSenderInfo& sender_info, |
Karl Wiberg | a58e169 | 2019-03-26 13:33:43 +0100 | [diff] [blame] | 842 | cricket::MediaType media_type) |
| 843 | RTC_RUN_ON(signaling_thread()); |
deadbeef | ab9b2d1 | 2015-10-14 11:33:11 -0700 | [diff] [blame] | 844 | |
Steve Anton | 4171afb | 2017-11-20 10:20:22 -0800 | [diff] [blame] | 845 | // Returns true if the PeerConnection is configured to use Unified Plan |
| 846 | // semantics for creating offers/answers and setting local/remote |
| 847 | // descriptions. If this is true the RtpTransceiver API will also be available |
| 848 | // to the user. If this is false, Plan B semantics are assumed. |
Steve Anton | 79e7960 | 2017-11-20 10:25:56 -0800 | [diff] [blame] | 849 | // TODO(bugs.webrtc.org/8530): Flip the default to be Unified Plan once |
| 850 | // sufficient time has passed. |
Karl Wiberg | 5966c50 | 2019-02-21 23:55:09 +0100 | [diff] [blame] | 851 | bool IsUnifiedPlan() const RTC_RUN_ON(signaling_thread()) { |
Steve Anton | 79e7960 | 2017-11-20 10:25:56 -0800 | [diff] [blame] | 852 | return configuration_.sdp_semantics == SdpSemantics::kUnifiedPlan; |
| 853 | } |
Steve Anton | 4171afb | 2017-11-20 10:20:22 -0800 | [diff] [blame] | 854 | |
Steve Anton | 06817cd | 2018-12-18 15:55:30 -0800 | [diff] [blame] | 855 | // The offer/answer machinery assumes the media section MID is present and |
| 856 | // unique. To support legacy end points that do not supply a=mid lines, this |
| 857 | // method will modify the session description to add MIDs generated according |
| 858 | // to the SDP semantics. |
Karl Wiberg | 5966c50 | 2019-02-21 23:55:09 +0100 | [diff] [blame] | 859 | void FillInMissingRemoteMids(cricket::SessionDescription* remote_description) |
| 860 | RTC_RUN_ON(signaling_thread()); |
Steve Anton | 06817cd | 2018-12-18 15:55:30 -0800 | [diff] [blame] | 861 | |
Steve Anton | 4171afb | 2017-11-20 10:20:22 -0800 | [diff] [blame] | 862 | // Is there an RtpSender of the given type? |
Karl Wiberg | 5966c50 | 2019-02-21 23:55:09 +0100 | [diff] [blame] | 863 | bool HasRtpSender(cricket::MediaType type) const |
| 864 | RTC_RUN_ON(signaling_thread()); |
deadbeef | fac0655 | 2015-11-25 11:26:01 -0800 | [diff] [blame] | 865 | |
Steve Anton | 4171afb | 2017-11-20 10:20:22 -0800 | [diff] [blame] | 866 | // Return the RtpSender with the given track attached. |
| 867 | rtc::scoped_refptr<RtpSenderProxyWithInternal<RtpSenderInternal>> |
Karl Wiberg | a58e169 | 2019-03-26 13:33:43 +0100 | [diff] [blame] | 868 | FindSenderForTrack(MediaStreamTrackInterface* track) const |
| 869 | RTC_RUN_ON(signaling_thread()); |
deadbeef | 70ab1a1 | 2015-09-28 16:53:55 -0700 | [diff] [blame] | 870 | |
Steve Anton | 4171afb | 2017-11-20 10:20:22 -0800 | [diff] [blame] | 871 | // Return the RtpSender with the given id, or null if none exists. |
| 872 | rtc::scoped_refptr<RtpSenderProxyWithInternal<RtpSenderInternal>> |
Karl Wiberg | a58e169 | 2019-03-26 13:33:43 +0100 | [diff] [blame] | 873 | FindSenderById(const std::string& sender_id) const |
| 874 | RTC_RUN_ON(signaling_thread()); |
Steve Anton | 4171afb | 2017-11-20 10:20:22 -0800 | [diff] [blame] | 875 | |
| 876 | // Return the RtpReceiver with the given id, or null if none exists. |
| 877 | rtc::scoped_refptr<RtpReceiverProxyWithInternal<RtpReceiverInternal>> |
Karl Wiberg | a58e169 | 2019-03-26 13:33:43 +0100 | [diff] [blame] | 878 | FindReceiverById(const std::string& receiver_id) const |
| 879 | RTC_RUN_ON(signaling_thread()); |
Steve Anton | 4171afb | 2017-11-20 10:20:22 -0800 | [diff] [blame] | 880 | |
| 881 | std::vector<RtpSenderInfo>* GetRemoteSenderInfos( |
| 882 | cricket::MediaType media_type); |
| 883 | std::vector<RtpSenderInfo>* GetLocalSenderInfos( |
| 884 | cricket::MediaType media_type); |
| 885 | const RtpSenderInfo* FindSenderInfo(const std::vector<RtpSenderInfo>& infos, |
Emircan Uysaler | bc609ea | 2018-03-27 21:57:18 +0000 | [diff] [blame] | 886 | const std::string& stream_id, |
Steve Anton | 4171afb | 2017-11-20 10:20:22 -0800 | [diff] [blame] | 887 | const std::string sender_id) const; |
deadbeef | ab9b2d1 | 2015-10-14 11:33:11 -0700 | [diff] [blame] | 888 | |
| 889 | // Returns the specified SCTP DataChannel in sctp_data_channels_, |
| 890 | // or nullptr if not found. |
Karl Wiberg | 85a4a93 | 2019-03-22 15:29:58 +0100 | [diff] [blame] | 891 | DataChannel* FindDataChannelBySid(int sid) const |
| 892 | RTC_RUN_ON(signaling_thread()); |
deadbeef | ab9b2d1 | 2015-10-14 11:33:11 -0700 | [diff] [blame] | 893 | |
Taylor Brandstetter | a1c3035 | 2016-05-13 08:15:11 -0700 | [diff] [blame] | 894 | // Called when first configuring the port allocator. |
Karl Wiberg | fb3be39 | 2019-03-22 14:13:22 +0100 | [diff] [blame] | 895 | struct InitializePortAllocatorResult { |
| 896 | bool enable_ipv6; |
| 897 | }; |
| 898 | InitializePortAllocatorResult InitializePortAllocator_n( |
Harald Alvestrand | b2a7478 | 2018-06-28 13:54:07 +0200 | [diff] [blame] | 899 | const cricket::ServerAddresses& stun_servers, |
| 900 | const std::vector<cricket::RelayServerConfig>& turn_servers, |
| 901 | const RTCConfiguration& configuration); |
deadbeef | 293e926 | 2017-01-11 12:28:30 -0800 | [diff] [blame] | 902 | // Called when SetConfiguration is called to apply the supported subset |
| 903 | // of the configuration on the network thread. |
| 904 | bool ReconfigurePortAllocator_n( |
| 905 | const cricket::ServerAddresses& stun_servers, |
| 906 | const std::vector<cricket::RelayServerConfig>& turn_servers, |
| 907 | IceTransportsType type, |
| 908 | int candidate_pool_size, |
Honghai Zhang | f8998cf | 2019-10-14 11:27:50 -0700 | [diff] [blame] | 909 | PortPrunePolicy turn_port_prune_policy, |
Qingsi Wang | db53f8e | 2018-02-20 14:45:49 -0800 | [diff] [blame] | 910 | webrtc::TurnCustomizer* turn_customizer, |
Karl Wiberg | 739506e | 2019-04-03 11:37:28 +0200 | [diff] [blame] | 911 | absl::optional<int> stun_candidate_keepalive_interval, |
| 912 | bool have_local_description); |
Taylor Brandstetter | a1c3035 | 2016-05-13 08:15:11 -0700 | [diff] [blame] | 913 | |
Elad Alon | 99c3fe5 | 2017-10-13 16:29:40 +0200 | [diff] [blame] | 914 | // Starts output of an RTC event log to the given output object. |
ivoc | 14d5dbe | 2016-07-04 07:06:55 -0700 | [diff] [blame] | 915 | // This function should only be called from the worker thread. |
Bjorn Terelius | de93943 | 2017-11-20 17:38:14 +0100 | [diff] [blame] | 916 | bool StartRtcEventLog_w(std::unique_ptr<RtcEventLogOutput> output, |
| 917 | int64_t output_period_ms); |
Elad Alon | 99c3fe5 | 2017-10-13 16:29:40 +0200 | [diff] [blame] | 918 | |
Elad Alon | acb2417 | 2017-10-06 14:32:13 +0200 | [diff] [blame] | 919 | // Stops recording an RTC event log. |
ivoc | 14d5dbe | 2016-07-04 07:06:55 -0700 | [diff] [blame] | 920 | // This function should only be called from the worker thread. |
| 921 | void StopRtcEventLog_w(); |
| 922 | |
Steve Anton | 038834f | 2017-07-14 15:59:59 -0700 | [diff] [blame] | 923 | // Ensures the configuration doesn't have any parameters with invalid values, |
| 924 | // or values that conflict with other parameters. |
| 925 | // |
| 926 | // Returns RTCError::OK() if there are no issues. |
| 927 | RTCError ValidateConfiguration(const RTCConfiguration& config) const; |
| 928 | |
Steve Anton | ba81867 | 2017-11-06 10:21:57 -0800 | [diff] [blame] | 929 | cricket::ChannelManager* channel_manager() const; |
Steve Anton | ba81867 | 2017-11-06 10:21:57 -0800 | [diff] [blame] | 930 | |
Steve Anton | f847081 | 2017-12-04 10:46:21 -0800 | [diff] [blame] | 931 | enum class SessionError { |
| 932 | kNone, // No error. |
| 933 | kContent, // Error in BaseChannel SetLocalContent/SetRemoteContent. |
| 934 | kTransport, // Error from the underlying transport. |
| 935 | }; |
| 936 | |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 937 | // Returns the last error in the session. See the enum above for details. |
Karl Wiberg | a58e169 | 2019-03-26 13:33:43 +0100 | [diff] [blame] | 938 | SessionError session_error() const RTC_RUN_ON(signaling_thread()) { |
| 939 | return session_error_; |
| 940 | } |
Steve Anton | f847081 | 2017-12-04 10:46:21 -0800 | [diff] [blame] | 941 | const std::string& session_error_desc() const { return session_error_desc_; } |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 942 | |
Amit Hilbuch | dd9390c | 2018-11-13 16:26:05 -0800 | [diff] [blame] | 943 | cricket::ChannelInterface* GetChannel(const std::string& content_name); |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 944 | |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 945 | cricket::IceConfig ParseIceConfig( |
| 946 | const PeerConnectionInterface::RTCConfiguration& config) const; |
| 947 | |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 948 | cricket::DataChannelType data_channel_type() const; |
| 949 | |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 950 | // Called when an RTCCertificate is generated or retrieved by |
| 951 | // WebRTCSessionDescriptionFactory. Should happen before setLocalDescription. |
| 952 | void OnCertificateReady( |
| 953 | const rtc::scoped_refptr<rtc::RTCCertificate>& certificate); |
| 954 | void OnDtlsSrtpSetupFailure(cricket::BaseChannel*, bool rtcp); |
| 955 | |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 956 | // Non-const versions of local_description()/remote_description(), for use |
| 957 | // internally. |
Karl Wiberg | 739506e | 2019-04-03 11:37:28 +0200 | [diff] [blame] | 958 | SessionDescriptionInterface* mutable_local_description() |
| 959 | RTC_RUN_ON(signaling_thread()) { |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 960 | return pending_local_description_ ? pending_local_description_.get() |
| 961 | : current_local_description_.get(); |
| 962 | } |
Karl Wiberg | 739506e | 2019-04-03 11:37:28 +0200 | [diff] [blame] | 963 | SessionDescriptionInterface* mutable_remote_description() |
| 964 | RTC_RUN_ON(signaling_thread()) { |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 965 | return pending_remote_description_ ? pending_remote_description_.get() |
| 966 | : current_remote_description_.get(); |
| 967 | } |
| 968 | |
| 969 | // Updates the error state, signaling if necessary. |
Steve Anton | f847081 | 2017-12-04 10:46:21 -0800 | [diff] [blame] | 970 | void SetSessionError(SessionError error, const std::string& error_desc); |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 971 | |
Zhi Huang | e830e68 | 2018-03-30 10:48:35 -0700 | [diff] [blame] | 972 | RTCError UpdateSessionState(SdpType type, |
| 973 | cricket::ContentSource source, |
| 974 | const cricket::SessionDescription* description); |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 975 | // Push the media parts of the local or remote session description |
| 976 | // down to all of the channels. |
Karl Wiberg | 5966c50 | 2019-02-21 23:55:09 +0100 | [diff] [blame] | 977 | RTCError PushdownMediaDescription(SdpType type, cricket::ContentSource source) |
| 978 | RTC_RUN_ON(signaling_thread()); |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 979 | |
Steve Anton | 8a00691 | 2017-12-04 15:25:56 -0800 | [diff] [blame] | 980 | RTCError PushdownTransportDescription(cricket::ContentSource source, |
Steve Anton | 3828c06 | 2017-12-06 10:34:51 -0800 | [diff] [blame] | 981 | SdpType type); |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 982 | |
| 983 | // Returns true and the TransportInfo of the given |content_name| |
| 984 | // from |description|. Returns false if it's not available. |
| 985 | static bool GetTransportDescription( |
| 986 | const cricket::SessionDescription* description, |
| 987 | const std::string& content_name, |
| 988 | cricket::TransportDescription* info); |
| 989 | |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 990 | // Enables media channels to allow sending of media. |
Steve Anton | ed10bd9 | 2017-12-05 10:52:59 -0800 | [diff] [blame] | 991 | // This enables media to flow on all configured audio/video channels and the |
| 992 | // RtpDataChannel. |
Karl Wiberg | a58e169 | 2019-03-26 13:33:43 +0100 | [diff] [blame] | 993 | void EnableSending() RTC_RUN_ON(signaling_thread()); |
Steve Anton | 3fe1b15 | 2017-12-12 10:20:08 -0800 | [diff] [blame] | 994 | |
Steve Anton | 8af2186 | 2017-12-15 11:20:13 -0800 | [diff] [blame] | 995 | // Destroys all BaseChannels and destroys the SCTP data channel, if present. |
Karl Wiberg | 85a4a93 | 2019-03-22 15:29:58 +0100 | [diff] [blame] | 996 | void DestroyAllChannels() RTC_RUN_ON(signaling_thread()); |
Steve Anton | 3fe1b15 | 2017-12-12 10:20:08 -0800 | [diff] [blame] | 997 | |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 998 | // Returns the media index for a local ice candidate given the content name. |
| 999 | // Returns false if the local session description does not have a media |
| 1000 | // content called |content_name|. |
| 1001 | bool GetLocalCandidateMediaIndex(const std::string& content_name, |
Karl Wiberg | 739506e | 2019-04-03 11:37:28 +0200 | [diff] [blame] | 1002 | int* sdp_mline_index) |
| 1003 | RTC_RUN_ON(signaling_thread()); |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 1004 | // Uses all remote candidates in |remote_desc| in this session. |
| 1005 | bool UseCandidatesInSessionDescription( |
Karl Wiberg | 744310f | 2019-02-14 10:18:56 +0100 | [diff] [blame] | 1006 | const SessionDescriptionInterface* remote_desc) |
| 1007 | RTC_RUN_ON(signaling_thread()); |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 1008 | // Uses |candidate| in this session. |
Karl Wiberg | 744310f | 2019-02-14 10:18:56 +0100 | [diff] [blame] | 1009 | bool UseCandidate(const IceCandidateInterface* candidate) |
| 1010 | RTC_RUN_ON(signaling_thread()); |
Guido Urdaneta | 4163317 | 2019-05-23 20:12:29 +0200 | [diff] [blame] | 1011 | RTCErrorOr<const cricket::ContentInfo*> FindContentInfo( |
| 1012 | const SessionDescriptionInterface* description, |
| 1013 | const IceCandidateInterface* candidate) RTC_RUN_ON(signaling_thread()); |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 1014 | // Deletes the corresponding channel of contents that don't exist in |desc|. |
| 1015 | // |desc| can be null. This means that all channels are deleted. |
Karl Wiberg | 5966c50 | 2019-02-21 23:55:09 +0100 | [diff] [blame] | 1016 | void RemoveUnusedChannels(const cricket::SessionDescription* desc) |
| 1017 | RTC_RUN_ON(signaling_thread()); |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 1018 | |
| 1019 | // Allocates media channels based on the |desc|. If |desc| doesn't have |
| 1020 | // the BUNDLE option, this method will disable BUNDLE in PortAllocator. |
| 1021 | // This method will also delete any existing media channels before creating. |
Karl Wiberg | 5966c50 | 2019-02-21 23:55:09 +0100 | [diff] [blame] | 1022 | RTCError CreateChannels(const cricket::SessionDescription& desc) |
| 1023 | RTC_RUN_ON(signaling_thread()); |
Steve Anton | dcc3c02 | 2017-12-22 16:02:54 -0800 | [diff] [blame] | 1024 | |
| 1025 | // If the BUNDLE policy is max-bundle, then we know for sure that all |
| 1026 | // transports will be bundled from the start. This method returns the BUNDLE |
| 1027 | // group if that's the case, or null if BUNDLE will be negotiated later. An |
| 1028 | // error is returned if max-bundle is specified but the session description |
| 1029 | // does not have a BUNDLE group. |
| 1030 | RTCErrorOr<const cricket::ContentGroup*> GetEarlyBundleGroup( |
Karl Wiberg | 5966c50 | 2019-02-21 23:55:09 +0100 | [diff] [blame] | 1031 | const cricket::SessionDescription& desc) const |
| 1032 | RTC_RUN_ON(signaling_thread()); |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 1033 | |
| 1034 | // Helper methods to create media channels. |
Karl Wiberg | 5966c50 | 2019-02-21 23:55:09 +0100 | [diff] [blame] | 1035 | cricket::VoiceChannel* CreateVoiceChannel(const std::string& mid) |
| 1036 | RTC_RUN_ON(signaling_thread()); |
| 1037 | cricket::VideoChannel* CreateVideoChannel(const std::string& mid) |
| 1038 | RTC_RUN_ON(signaling_thread()); |
| 1039 | bool CreateDataChannel(const std::string& mid) RTC_RUN_ON(signaling_thread()); |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 1040 | |
Bjorn A Mellem | b689af4 | 2019-08-21 10:44:59 -0700 | [diff] [blame] | 1041 | bool SetupDataChannelTransport_n(const std::string& mid) |
Bjorn Mellem | 175aa2e | 2018-11-08 11:23:22 -0800 | [diff] [blame] | 1042 | RTC_RUN_ON(network_thread()); |
Bjorn A Mellem | b689af4 | 2019-08-21 10:44:59 -0700 | [diff] [blame] | 1043 | void TeardownDataChannelTransport_n() RTC_RUN_ON(network_thread()); |
Bjorn Mellem | 175aa2e | 2018-11-08 11:23:22 -0800 | [diff] [blame] | 1044 | |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 1045 | bool ValidateBundleSettings(const cricket::SessionDescription* desc); |
| 1046 | bool HasRtcpMuxEnabled(const cricket::ContentInfo* content); |
| 1047 | // Below methods are helper methods which verifies SDP. |
Steve Anton | 8a00691 | 2017-12-04 15:25:56 -0800 | [diff] [blame] | 1048 | RTCError ValidateSessionDescription(const SessionDescriptionInterface* sdesc, |
Karl Wiberg | 5966c50 | 2019-02-21 23:55:09 +0100 | [diff] [blame] | 1049 | cricket::ContentSource source) |
| 1050 | RTC_RUN_ON(signaling_thread()); |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 1051 | |
Steve Anton | 3828c06 | 2017-12-06 10:34:51 -0800 | [diff] [blame] | 1052 | // Check if a call to SetLocalDescription is acceptable with a session |
| 1053 | // description of the given type. |
| 1054 | bool ExpectSetLocalDescription(SdpType type); |
| 1055 | // Check if a call to SetRemoteDescription is acceptable with a session |
| 1056 | // description of the given type. |
| 1057 | bool ExpectSetRemoteDescription(SdpType type); |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 1058 | // Verifies a=setup attribute as per RFC 5763. |
| 1059 | bool ValidateDtlsSetupAttribute(const cricket::SessionDescription* desc, |
Steve Anton | 3828c06 | 2017-12-06 10:34:51 -0800 | [diff] [blame] | 1060 | SdpType type); |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 1061 | |
| 1062 | // Returns true if we are ready to push down the remote candidate. |
| 1063 | // |remote_desc| is the new remote description, or NULL if the current remote |
| 1064 | // description should be used. Output |valid| is true if the candidate media |
| 1065 | // index is valid. |
| 1066 | bool ReadyToUseRemoteCandidate(const IceCandidateInterface* candidate, |
| 1067 | const SessionDescriptionInterface* remote_desc, |
Karl Wiberg | a58e169 | 2019-03-26 13:33:43 +0100 | [diff] [blame] | 1068 | bool* valid) RTC_RUN_ON(signaling_thread()); |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 1069 | |
| 1070 | // Returns true if SRTP (either using DTLS-SRTP or SDES) is required by |
| 1071 | // this session. |
Karl Wiberg | 739506e | 2019-04-03 11:37:28 +0200 | [diff] [blame] | 1072 | bool SrtpRequired() const RTC_RUN_ON(signaling_thread()); |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 1073 | |
Zhi Huang | e830e68 | 2018-03-30 10:48:35 -0700 | [diff] [blame] | 1074 | // JsepTransportController signal handlers. |
Karl Wiberg | 744310f | 2019-02-14 10:18:56 +0100 | [diff] [blame] | 1075 | void OnTransportControllerConnectionState(cricket::IceConnectionState state) |
| 1076 | RTC_RUN_ON(signaling_thread()); |
| 1077 | void OnTransportControllerGatheringState(cricket::IceGatheringState state) |
| 1078 | RTC_RUN_ON(signaling_thread()); |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 1079 | void OnTransportControllerCandidatesGathered( |
| 1080 | const std::string& transport_name, |
Karl Wiberg | 744310f | 2019-02-14 10:18:56 +0100 | [diff] [blame] | 1081 | const std::vector<cricket::Candidate>& candidates) |
| 1082 | RTC_RUN_ON(signaling_thread()); |
Eldar Rello | da13ea2 | 2019-06-01 12:23:43 +0300 | [diff] [blame] | 1083 | void OnTransportControllerCandidateError( |
| 1084 | const cricket::IceCandidateErrorEvent& event) |
| 1085 | RTC_RUN_ON(signaling_thread()); |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 1086 | void OnTransportControllerCandidatesRemoved( |
Karl Wiberg | 744310f | 2019-02-14 10:18:56 +0100 | [diff] [blame] | 1087 | const std::vector<cricket::Candidate>& candidates) |
| 1088 | RTC_RUN_ON(signaling_thread()); |
Alex Drake | 00c7ecf | 2019-08-06 10:54:47 -0700 | [diff] [blame] | 1089 | void OnTransportControllerCandidateChanged( |
| 1090 | const cricket::CandidatePairChangeEvent& event) |
| 1091 | RTC_RUN_ON(signaling_thread()); |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 1092 | void OnTransportControllerDtlsHandshakeError(rtc::SSLHandshakeError error); |
| 1093 | |
Steve Anton | f847081 | 2017-12-04 10:46:21 -0800 | [diff] [blame] | 1094 | const char* SessionErrorToString(SessionError error) const; |
Karl Wiberg | a58e169 | 2019-03-26 13:33:43 +0100 | [diff] [blame] | 1095 | std::string GetSessionErrorMsg() RTC_RUN_ON(signaling_thread()); |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 1096 | |
Steve Anton | 8e20f17 | 2018-03-06 10:55:04 -0800 | [diff] [blame] | 1097 | // Report the UMA metric SdpFormatReceived for the given remote offer. |
| 1098 | void ReportSdpFormatReceived(const SessionDescriptionInterface& remote_offer); |
| 1099 | |
Steve Anton | 0ffaaa2 | 2018-02-23 10:31:30 -0800 | [diff] [blame] | 1100 | // Report inferred negotiated SDP semantics from a local/remote answer to the |
| 1101 | // UMA observer. |
| 1102 | void ReportNegotiatedSdpSemantics(const SessionDescriptionInterface& answer); |
| 1103 | |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 1104 | // Invoked when TransportController connection completion is signaled. |
| 1105 | // Reports stats for all transports in use. |
Karl Wiberg | a58e169 | 2019-03-26 13:33:43 +0100 | [diff] [blame] | 1106 | void ReportTransportStats() RTC_RUN_ON(signaling_thread()); |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 1107 | |
| 1108 | // Gather the usage of IPv4/IPv6 as best connection. |
| 1109 | void ReportBestConnectionState(const cricket::TransportStats& stats); |
| 1110 | |
Steve Anton | c7b964c | 2018-02-01 14:39:45 -0800 | [diff] [blame] | 1111 | void ReportNegotiatedCiphers(const cricket::TransportStats& stats, |
Karl Wiberg | 739506e | 2019-04-03 11:37:28 +0200 | [diff] [blame] | 1112 | const std::set<cricket::MediaType>& media_types) |
| 1113 | RTC_RUN_ON(signaling_thread()); |
Qingsi Wang | 1ba5dec | 2019-08-19 11:57:17 -0700 | [diff] [blame] | 1114 | void ReportIceCandidateCollected(const cricket::Candidate& candidate) |
| 1115 | RTC_RUN_ON(signaling_thread()); |
| 1116 | void ReportRemoteIceCandidateAdded(const cricket::Candidate& candidate) |
| 1117 | RTC_RUN_ON(signaling_thread()); |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 1118 | |
Harald Alvestrand | 8ebba74 | 2018-05-31 14:00:34 +0200 | [diff] [blame] | 1119 | void NoteUsageEvent(UsageEvent event); |
Karl Wiberg | 744310f | 2019-02-14 10:18:56 +0100 | [diff] [blame] | 1120 | void ReportUsagePattern() const RTC_RUN_ON(signaling_thread()); |
Harald Alvestrand | 8ebba74 | 2018-05-31 14:00:34 +0200 | [diff] [blame] | 1121 | |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 1122 | void OnSentPacket_w(const rtc::SentPacket& sent_packet); |
| 1123 | |
Karl Wiberg | a58e169 | 2019-03-26 13:33:43 +0100 | [diff] [blame] | 1124 | const std::string GetTransportName(const std::string& content_name) |
| 1125 | RTC_RUN_ON(signaling_thread()); |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 1126 | |
Harald Alvestrand | 408cb4b | 2019-11-16 12:09:08 +0100 | [diff] [blame] | 1127 | // Functions for dealing with transports. |
| 1128 | // Note that cricket code uses the term "channel" for what other code |
| 1129 | // refers to as "transport". |
| 1130 | |
Steve Anton | 6fec880 | 2017-12-04 10:37:29 -0800 | [diff] [blame] | 1131 | // Destroys and clears the BaseChannel associated with the given transceiver, |
| 1132 | // if such channel is set. |
| 1133 | void DestroyTransceiverChannel( |
| 1134 | rtc::scoped_refptr<RtpTransceiverProxyWithInternal<RtpTransceiver>> |
| 1135 | transceiver); |
| 1136 | |
Harald Alvestrand | 408cb4b | 2019-11-16 12:09:08 +0100 | [diff] [blame] | 1137 | // Destroys the RTP data channel transport and/or the SCTP data channel |
| 1138 | // transport and clears it. |
| 1139 | void DestroyDataChannelTransport() RTC_RUN_ON(signaling_thread()); |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 1140 | |
Amit Hilbuch | dd9390c | 2018-11-13 16:26:05 -0800 | [diff] [blame] | 1141 | // Destroys the given ChannelInterface. |
| 1142 | // The channel cannot be accessed after this method is called. |
| 1143 | void DestroyChannelInterface(cricket::ChannelInterface* channel); |
Steve Anton | 6fec880 | 2017-12-04 10:37:29 -0800 | [diff] [blame] | 1144 | |
Zhi Huang | 365381f | 2018-04-13 16:44:34 -0700 | [diff] [blame] | 1145 | // JsepTransportController::Observer override. |
Taylor Brandstetter | cbaa254 | 2018-04-16 16:42:14 -0700 | [diff] [blame] | 1146 | // |
| 1147 | // Called by |transport_controller_| when processing transport information |
| 1148 | // from a session description, and the mapping from m= sections to transports |
| 1149 | // changed (as a result of BUNDLE negotiation, or m= sections being |
| 1150 | // rejected). |
Bjorn A Mellem | b689af4 | 2019-08-21 10:44:59 -0700 | [diff] [blame] | 1151 | bool OnTransportChanged( |
| 1152 | const std::string& mid, |
| 1153 | RtpTransportInternal* rtp_transport, |
| 1154 | rtc::scoped_refptr<DtlsTransport> dtls_transport, |
Bjorn A Mellem | bc3eebc | 2019-09-23 14:53:54 -0700 | [diff] [blame] | 1155 | DataChannelTransportInterface* data_channel_transport) override; |
Zhi Huang | e830e68 | 2018-03-30 10:48:35 -0700 | [diff] [blame] | 1156 | |
Guido Urdaneta | 1ff16c8 | 2019-05-20 19:31:53 +0200 | [diff] [blame] | 1157 | // RtpSenderBase::SetStreamsObserver override. |
| 1158 | void OnSetStreams() override; |
| 1159 | |
Benjamin Wright | 8c27cca | 2018-10-25 10:16:44 -0700 | [diff] [blame] | 1160 | // Returns the CryptoOptions for this PeerConnection. This will always |
| 1161 | // return the RTCConfiguration.crypto_options if set and will only default |
| 1162 | // back to the PeerConnectionFactory settings if nothing was set. |
Karl Wiberg | 5966c50 | 2019-02-21 23:55:09 +0100 | [diff] [blame] | 1163 | CryptoOptions GetCryptoOptions() RTC_RUN_ON(signaling_thread()); |
Benjamin Wright | 8c27cca | 2018-10-25 10:16:44 -0700 | [diff] [blame] | 1164 | |
Anton Sukhanov | 98a462c | 2018-10-17 13:15:42 -0700 | [diff] [blame] | 1165 | // Returns rtp transport, result can not be nullptr. |
Karl Wiberg | 2cc368f | 2019-04-02 11:31:56 +0200 | [diff] [blame] | 1166 | RtpTransportInternal* GetRtpTransport(const std::string& mid) |
| 1167 | RTC_RUN_ON(signaling_thread()) { |
Anton Sukhanov | 98a462c | 2018-10-17 13:15:42 -0700 | [diff] [blame] | 1168 | auto rtp_transport = transport_controller_->GetRtpTransport(mid); |
| 1169 | RTC_DCHECK(rtp_transport); |
| 1170 | return rtp_transport; |
| 1171 | } |
| 1172 | |
Guido Urdaneta | 70c2db1 | 2019-04-16 12:24:14 +0200 | [diff] [blame] | 1173 | void UpdateNegotiationNeeded(); |
| 1174 | bool CheckIfNegotiationIsNeeded(); |
Eldar Rello | ead0ec9 | 2019-10-21 23:01:31 +0300 | [diff] [blame] | 1175 | |
| 1176 | // | sdp_type | is the type of the SDP that caused the rollback. |
| 1177 | RTCError Rollback(SdpType sdp_type); |
Guido Urdaneta | 70c2db1 | 2019-04-16 12:24:14 +0200 | [diff] [blame] | 1178 | |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 1179 | // Storing the factory as a scoped reference pointer ensures that the memory |
| 1180 | // in the PeerConnectionFactoryImpl remains available as long as the |
| 1181 | // PeerConnection is running. It is passed to PeerConnection as a raw pointer. |
| 1182 | // However, since the reference counting is done in the |
deadbeef | ab9b2d1 | 2015-10-14 11:33:11 -0700 | [diff] [blame] | 1183 | // PeerConnectionFactoryInterface all instances created using the raw pointer |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 1184 | // will refer to the same reference count. |
Karl Wiberg | 744310f | 2019-02-14 10:18:56 +0100 | [diff] [blame] | 1185 | const rtc::scoped_refptr<PeerConnectionFactory> factory_; |
| 1186 | PeerConnectionObserver* observer_ RTC_GUARDED_BY(signaling_thread()) = |
| 1187 | nullptr; |
terelius | 3386025 | 2017-05-12 23:37:18 -0700 | [diff] [blame] | 1188 | |
| 1189 | // The EventLog needs to outlive |call_| (and any other object that uses it). |
Karl Wiberg | b03ab71 | 2019-02-14 11:59:57 +0100 | [diff] [blame] | 1190 | std::unique_ptr<RtcEventLog> event_log_ RTC_GUARDED_BY(worker_thread()); |
| 1191 | |
| 1192 | // Points to the same thing as `event_log_`. Since it's const, we may read the |
| 1193 | // pointer (but not touch the object) from any thread. |
| 1194 | RtcEventLog* const event_log_ptr_ RTC_PT_GUARDED_BY(worker_thread()); |
terelius | 3386025 | 2017-05-12 23:37:18 -0700 | [diff] [blame] | 1195 | |
Henrik Boström | a3728d3 | 2019-10-28 12:09:49 +0100 | [diff] [blame] | 1196 | // The operations chain is used by the offer/answer exchange methods to ensure |
| 1197 | // they are executed in the right order. For example, if |
| 1198 | // SetRemoteDescription() is invoked while CreateOffer() is still pending, the |
| 1199 | // SRD operation will not start until CreateOffer() has completed. See |
| 1200 | // https://w3c.github.io/webrtc-pc/#dfn-operations-chain. |
| 1201 | rtc::scoped_refptr<rtc::OperationsChain> operations_chain_ |
| 1202 | RTC_GUARDED_BY(signaling_thread()); |
| 1203 | |
Karl Wiberg | 8d2e228 | 2019-02-17 13:00:07 +0100 | [diff] [blame] | 1204 | SignalingState signaling_state_ RTC_GUARDED_BY(signaling_thread()) = kStable; |
| 1205 | IceConnectionState ice_connection_state_ RTC_GUARDED_BY(signaling_thread()) = |
| 1206 | kIceConnectionNew; |
| 1207 | PeerConnectionInterface::IceConnectionState standardized_ice_connection_state_ |
| 1208 | RTC_GUARDED_BY(signaling_thread()) = kIceConnectionNew; |
| 1209 | PeerConnectionInterface::PeerConnectionState connection_state_ |
| 1210 | RTC_GUARDED_BY(signaling_thread()) = PeerConnectionState::kNew; |
Jonas Olsson | 635474e | 2018-10-18 15:58:17 +0200 | [diff] [blame] | 1211 | |
Karl Wiberg | 8d2e228 | 2019-02-17 13:00:07 +0100 | [diff] [blame] | 1212 | IceGatheringState ice_gathering_state_ RTC_GUARDED_BY(signaling_thread()) = |
| 1213 | kIceGatheringNew; |
Karl Wiberg | 5966c50 | 2019-02-21 23:55:09 +0100 | [diff] [blame] | 1214 | PeerConnectionInterface::RTCConfiguration configuration_ |
| 1215 | RTC_GUARDED_BY(signaling_thread()); |
| 1216 | |
Bjorn A Mellem | 5985a04 | 2019-06-28 14:19:38 -0700 | [diff] [blame] | 1217 | // Field-trial based configuration for datagram transport. |
| 1218 | const DatagramTransportConfig datagram_transport_config_; |
| 1219 | |
Bjorn A Mellem | b689af4 | 2019-08-21 10:44:59 -0700 | [diff] [blame] | 1220 | // Field-trial based configuration for datagram transport data channels. |
Bjorn A Mellem | 7da4e56 | 2019-09-26 11:02:11 -0700 | [diff] [blame] | 1221 | const DatagramTransportDataChannelConfig |
| 1222 | datagram_transport_data_channel_config_; |
Bjorn A Mellem | b689af4 | 2019-08-21 10:44:59 -0700 | [diff] [blame] | 1223 | |
Bjorn A Mellem | 5985a04 | 2019-06-28 14:19:38 -0700 | [diff] [blame] | 1224 | // Final, resolved value for whether datagram transport is in use. |
| 1225 | bool use_datagram_transport_ RTC_GUARDED_BY(signaling_thread()) = false; |
| 1226 | |
Bjorn A Mellem | b689af4 | 2019-08-21 10:44:59 -0700 | [diff] [blame] | 1227 | // Equivalent of |use_datagram_transport_|, but for its use with data |
| 1228 | // channels. |
| 1229 | bool use_datagram_transport_for_data_channels_ |
| 1230 | RTC_GUARDED_BY(signaling_thread()) = false; |
| 1231 | |
Bjorn A Mellem | 7da4e56 | 2019-09-26 11:02:11 -0700 | [diff] [blame] | 1232 | // Resolved value of whether to use data channels only for incoming calls. |
| 1233 | bool use_datagram_transport_for_data_channels_receive_only_ |
| 1234 | RTC_GUARDED_BY(signaling_thread()) = false; |
| 1235 | |
Zach Stein | e20867f | 2018-08-02 13:20:15 -0700 | [diff] [blame] | 1236 | // TODO(zstein): |async_resolver_factory_| can currently be nullptr if it |
| 1237 | // is not injected. It should be required once chromium supplies it. |
Karl Wiberg | fb3be39 | 2019-03-22 14:13:22 +0100 | [diff] [blame] | 1238 | std::unique_ptr<AsyncResolverFactory> async_resolver_factory_ |
| 1239 | RTC_GUARDED_BY(signaling_thread()); |
| 1240 | std::unique_ptr<cricket::PortAllocator> |
| 1241 | port_allocator_; // TODO(bugs.webrtc.org/9987): Accessed on both |
| 1242 | // signaling and network thread. |
Qingsi Wang | 25ec888 | 2019-11-15 12:33:05 -0800 | [diff] [blame] | 1243 | std::unique_ptr<webrtc::IceTransportFactory> |
| 1244 | ice_transport_factory_; // TODO(bugs.webrtc.org/9987): Accessed on the |
| 1245 | // signaling thread but the underlying raw |
| 1246 | // pointer is given to |
| 1247 | // |jsep_transport_controller_| and used on the |
| 1248 | // network thread. |
Karl Wiberg | fb3be39 | 2019-03-22 14:13:22 +0100 | [diff] [blame] | 1249 | std::unique_ptr<rtc::SSLCertificateVerifier> |
| 1250 | tls_cert_verifier_; // TODO(bugs.webrtc.org/9987): Accessed on both |
| 1251 | // signaling and network thread. |
deadbeef | ab9b2d1 | 2015-10-14 11:33:11 -0700 | [diff] [blame] | 1252 | |
zhihuang | 8f65cdf | 2016-05-06 18:40:30 -0700 | [diff] [blame] | 1253 | // One PeerConnection has only one RTCP CNAME. |
| 1254 | // https://tools.ietf.org/html/draft-ietf-rtcweb-rtp-usage-26#section-4.9 |
Karl Wiberg | fb3be39 | 2019-03-22 14:13:22 +0100 | [diff] [blame] | 1255 | const std::string rtcp_cname_; |
zhihuang | 8f65cdf | 2016-05-06 18:40:30 -0700 | [diff] [blame] | 1256 | |
deadbeef | ab9b2d1 | 2015-10-14 11:33:11 -0700 | [diff] [blame] | 1257 | // Streams added via AddStream. |
Karl Wiberg | 1e1e102 | 2019-03-22 14:27:22 +0100 | [diff] [blame] | 1258 | const rtc::scoped_refptr<StreamCollection> local_streams_ |
| 1259 | RTC_GUARDED_BY(signaling_thread()); |
deadbeef | ab9b2d1 | 2015-10-14 11:33:11 -0700 | [diff] [blame] | 1260 | // Streams created as a result of SetRemoteDescription. |
Karl Wiberg | 1e1e102 | 2019-03-22 14:27:22 +0100 | [diff] [blame] | 1261 | const rtc::scoped_refptr<StreamCollection> remote_streams_ |
| 1262 | RTC_GUARDED_BY(signaling_thread()); |
deadbeef | ab9b2d1 | 2015-10-14 11:33:11 -0700 | [diff] [blame] | 1263 | |
Karl Wiberg | 1e1e102 | 2019-03-22 14:27:22 +0100 | [diff] [blame] | 1264 | std::vector<std::unique_ptr<MediaStreamObserver>> stream_observers_ |
| 1265 | RTC_GUARDED_BY(signaling_thread()); |
deadbeef | eb45981 | 2015-12-15 19:24:43 -0800 | [diff] [blame] | 1266 | |
Steve Anton | 4171afb | 2017-11-20 10:20:22 -0800 | [diff] [blame] | 1267 | // These lists store sender info seen in local/remote descriptions. |
Karl Wiberg | c70999e | 2019-03-22 15:14:27 +0100 | [diff] [blame] | 1268 | std::vector<RtpSenderInfo> remote_audio_sender_infos_ |
| 1269 | RTC_GUARDED_BY(signaling_thread()); |
| 1270 | std::vector<RtpSenderInfo> remote_video_sender_infos_ |
| 1271 | RTC_GUARDED_BY(signaling_thread()); |
| 1272 | std::vector<RtpSenderInfo> local_audio_sender_infos_ |
| 1273 | RTC_GUARDED_BY(signaling_thread()); |
| 1274 | std::vector<RtpSenderInfo> local_video_sender_infos_ |
| 1275 | RTC_GUARDED_BY(signaling_thread()); |
deadbeef | ab9b2d1 | 2015-10-14 11:33:11 -0700 | [diff] [blame] | 1276 | |
Karl Wiberg | 85a4a93 | 2019-03-22 15:29:58 +0100 | [diff] [blame] | 1277 | bool remote_peer_supports_msid_ RTC_GUARDED_BY(signaling_thread()) = false; |
deadbeef | 70ab1a1 | 2015-09-28 16:53:55 -0700 | [diff] [blame] | 1278 | |
Karl Wiberg | ac02589 | 2019-03-26 13:08:37 +0100 | [diff] [blame] | 1279 | // The unique_ptr belongs to the worker thread, but the Call object manages |
| 1280 | // its own thread safety. |
Karl Wiberg | 6cab5c8 | 2019-03-26 09:57:01 +0100 | [diff] [blame] | 1281 | std::unique_ptr<Call> call_ RTC_GUARDED_BY(worker_thread()); |
| 1282 | |
Sebastian Jansson | 1b83a9e | 2019-09-18 18:22:12 +0200 | [diff] [blame] | 1283 | rtc::AsyncInvoker rtcp_invoker_ RTC_GUARDED_BY(network_thread()); |
| 1284 | |
Karl Wiberg | 6cab5c8 | 2019-03-26 09:57:01 +0100 | [diff] [blame] | 1285 | // Points to the same thing as `call_`. Since it's const, we may read the |
Karl Wiberg | ac02589 | 2019-03-26 13:08:37 +0100 | [diff] [blame] | 1286 | // pointer from any thread. |
| 1287 | Call* const call_ptr_; |
Karl Wiberg | 6cab5c8 | 2019-03-26 09:57:01 +0100 | [diff] [blame] | 1288 | |
| 1289 | std::unique_ptr<StatsCollector> stats_ |
| 1290 | RTC_GUARDED_BY(signaling_thread()); // A pointer is passed to senders_ |
| 1291 | rtc::scoped_refptr<RTCStatsCollector> stats_collector_ |
| 1292 | RTC_GUARDED_BY(signaling_thread()); |
Eldar Rello | 5ab79e6 | 2019-10-09 18:29:44 +0300 | [diff] [blame] | 1293 | // Holds changes made to transceivers during applying descriptors for |
| 1294 | // potential rollback. Gets cleared once signaling state goes to stable. |
| 1295 | std::map<rtc::scoped_refptr<RtpTransceiverProxyWithInternal<RtpTransceiver>>, |
| 1296 | TransceiverStableState> |
| 1297 | transceiver_stable_states_by_transceivers_; |
Eldar Rello | d9ebe01 | 2020-03-18 20:41:45 +0200 | [diff] [blame] | 1298 | // Used when rolling back RTP data channels. |
| 1299 | bool have_pending_rtp_data_channel_ RTC_GUARDED_BY(signaling_thread()) = |
| 1300 | false; |
Eldar Rello | 353a718 | 2019-11-25 18:49:44 +0200 | [diff] [blame] | 1301 | // Holds remote stream ids for transceivers from stable state. |
| 1302 | std::map<rtc::scoped_refptr<RtpTransceiverProxyWithInternal<RtpTransceiver>>, |
| 1303 | std::vector<std::string>> |
| 1304 | remote_stream_ids_by_transceivers_; |
deadbeef | a601f5c | 2016-06-06 14:27:39 -0700 | [diff] [blame] | 1305 | std::vector< |
Steve Anton | 4171afb | 2017-11-20 10:20:22 -0800 | [diff] [blame] | 1306 | rtc::scoped_refptr<RtpTransceiverProxyWithInternal<RtpTransceiver>>> |
Karl Wiberg | 2cc368f | 2019-04-02 11:31:56 +0200 | [diff] [blame] | 1307 | transceivers_; // TODO(bugs.webrtc.org/9987): Accessed on both signaling |
| 1308 | // and network thread. |
| 1309 | |
Henrik Boström | 5b14778 | 2018-12-04 11:25:05 +0100 | [diff] [blame] | 1310 | // In Unified Plan, if we encounter remote SDP that does not contain an a=msid |
| 1311 | // line we create and use a stream with a random ID for our receivers. This is |
| 1312 | // to support legacy endpoints that do not support the a=msid attribute (as |
| 1313 | // opposed to streamless tracks with "a=msid:-"). |
Karl Wiberg | a58e169 | 2019-03-26 13:33:43 +0100 | [diff] [blame] | 1314 | rtc::scoped_refptr<MediaStreamInterface> missing_msid_default_stream_ |
| 1315 | RTC_GUARDED_BY(signaling_thread()); |
Amit Hilbuch | ae3df54 | 2019-01-07 12:13:08 -0800 | [diff] [blame] | 1316 | // MIDs will be generated using this generator which will keep track of |
| 1317 | // all the MIDs that have been seen over the life of the PeerConnection. |
Karl Wiberg | a58e169 | 2019-03-26 13:33:43 +0100 | [diff] [blame] | 1318 | rtc::UniqueStringGenerator mid_generator_ RTC_GUARDED_BY(signaling_thread()); |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 1319 | |
Karl Wiberg | a58e169 | 2019-03-26 13:33:43 +0100 | [diff] [blame] | 1320 | SessionError session_error_ RTC_GUARDED_BY(signaling_thread()) = |
| 1321 | SessionError::kNone; |
| 1322 | std::string session_error_desc_ RTC_GUARDED_BY(signaling_thread()); |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 1323 | |
Karl Wiberg | a58e169 | 2019-03-26 13:33:43 +0100 | [diff] [blame] | 1324 | std::string session_id_ RTC_GUARDED_BY(signaling_thread()); |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 1325 | |
Karl Wiberg | 2cc368f | 2019-04-02 11:31:56 +0200 | [diff] [blame] | 1326 | std::unique_ptr<JsepTransportController> |
| 1327 | transport_controller_; // TODO(bugs.webrtc.org/9987): Accessed on both |
| 1328 | // signaling and network thread. |
| 1329 | std::unique_ptr<cricket::SctpTransportInternalFactory> |
| 1330 | sctp_factory_; // TODO(bugs.webrtc.org/9987): Accessed on both |
| 1331 | // signaling and network thread. |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 1332 | |
Zhi Huang | e830e68 | 2018-03-30 10:48:35 -0700 | [diff] [blame] | 1333 | // |sctp_mid_| is the content name (MID) in SDP. |
Bjorn A Mellem | b689af4 | 2019-08-21 10:44:59 -0700 | [diff] [blame] | 1334 | // Note: this is used as the data channel MID by both SCTP and data channel |
| 1335 | // transports. It is set when either transport is initialized and unset when |
| 1336 | // both transports are deleted. |
Harald Alvestrand | 7a829a8 | 2020-02-12 07:38:21 +0100 | [diff] [blame] | 1337 | // There is one copy on the signaling thread and another copy on the |
| 1338 | // networking thread. Changes are always initiated from the signaling |
| 1339 | // thread, but applied first on the networking thread via an invoke(). |
| 1340 | absl::optional<std::string> sctp_mid_s_ RTC_GUARDED_BY(signaling_thread()); |
| 1341 | absl::optional<std::string> sctp_mid_n_ RTC_GUARDED_BY(network_thread()); |
Karl Wiberg | 2cc368f | 2019-04-02 11:31:56 +0200 | [diff] [blame] | 1342 | |
Bjorn Mellem | 175aa2e | 2018-11-08 11:23:22 -0800 | [diff] [blame] | 1343 | // Whether this peer is the caller. Set when the local description is applied. |
| 1344 | absl::optional<bool> is_caller_ RTC_GUARDED_BY(signaling_thread()); |
| 1345 | |
Bjorn Mellem | 175aa2e | 2018-11-08 11:23:22 -0800 | [diff] [blame] | 1346 | |
Bjorn Mellem | 175aa2e | 2018-11-08 11:23:22 -0800 | [diff] [blame] | 1347 | |
Karl Wiberg | 739506e | 2019-04-03 11:37:28 +0200 | [diff] [blame] | 1348 | std::unique_ptr<SessionDescriptionInterface> current_local_description_ |
| 1349 | RTC_GUARDED_BY(signaling_thread()); |
| 1350 | std::unique_ptr<SessionDescriptionInterface> pending_local_description_ |
| 1351 | RTC_GUARDED_BY(signaling_thread()); |
| 1352 | std::unique_ptr<SessionDescriptionInterface> current_remote_description_ |
| 1353 | RTC_GUARDED_BY(signaling_thread()); |
| 1354 | std::unique_ptr<SessionDescriptionInterface> pending_remote_description_ |
| 1355 | RTC_GUARDED_BY(signaling_thread()); |
| 1356 | bool dtls_enabled_ RTC_GUARDED_BY(signaling_thread()) = false; |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 1357 | |
Karl Wiberg | f73f7d6 | 2019-04-08 15:36:53 +0200 | [diff] [blame] | 1358 | // List of content names for which the remote side triggered an ICE restart. |
| 1359 | std::set<std::string> pending_ice_restarts_ |
| 1360 | RTC_GUARDED_BY(signaling_thread()); |
| 1361 | |
| 1362 | std::unique_ptr<WebRtcSessionDescriptionFactory> webrtc_session_desc_factory_ |
| 1363 | RTC_GUARDED_BY(signaling_thread()); |
Steve Anton | 75737c0 | 2017-11-06 10:37:17 -0800 | [diff] [blame] | 1364 | |
| 1365 | // Member variables for caching global options. |
Karl Wiberg | f73f7d6 | 2019-04-08 15:36:53 +0200 | [diff] [blame] | 1366 | cricket::AudioOptions audio_options_ RTC_GUARDED_BY(signaling_thread()); |
| 1367 | cricket::VideoOptions video_options_ RTC_GUARDED_BY(signaling_thread()); |
Harald Alvestrand | 8ebba74 | 2018-05-31 14:00:34 +0200 | [diff] [blame] | 1368 | |
Karl Wiberg | f73f7d6 | 2019-04-08 15:36:53 +0200 | [diff] [blame] | 1369 | int usage_event_accumulator_ RTC_GUARDED_BY(signaling_thread()) = 0; |
| 1370 | bool return_histogram_very_quickly_ RTC_GUARDED_BY(signaling_thread()) = |
| 1371 | false; |
Amit Hilbuch | bcd39d4 | 2019-01-25 17:13:56 -0800 | [diff] [blame] | 1372 | |
| 1373 | // This object should be used to generate any SSRC that is not explicitly |
| 1374 | // specified by the user (or by the remote party). |
| 1375 | // The generator is not used directly, instead it is passed on to the |
| 1376 | // channel manager and the session description factory. |
Karl Wiberg | f73f7d6 | 2019-04-08 15:36:53 +0200 | [diff] [blame] | 1377 | rtc::UniqueRandomIdGenerator ssrc_generator_ |
| 1378 | RTC_GUARDED_BY(signaling_thread()); |
Jonas Oreland | a3aa9bd | 2019-04-17 07:38:40 +0200 | [diff] [blame] | 1379 | |
| 1380 | // A video bitrate allocator factory. |
| 1381 | // This can injected using the PeerConnectionDependencies, |
| 1382 | // or else the CreateBuiltinVideoBitrateAllocatorFactory() will be called. |
| 1383 | // Note that one can still choose to override this in a MediaEngine |
| 1384 | // if one wants too. |
| 1385 | std::unique_ptr<webrtc::VideoBitrateAllocatorFactory> |
| 1386 | video_bitrate_allocator_factory_; |
| 1387 | |
Henrik Boström | 79b6980 | 2019-07-18 11:16:56 +0200 | [diff] [blame] | 1388 | std::unique_ptr<LocalIceCredentialsToReplace> |
| 1389 | local_ice_credentials_to_replace_ RTC_GUARDED_BY(signaling_thread()); |
Guido Urdaneta | 70c2db1 | 2019-04-16 12:24:14 +0200 | [diff] [blame] | 1390 | bool is_negotiation_needed_ RTC_GUARDED_BY(signaling_thread()) = false; |
Henrik Boström | a3728d3 | 2019-10-28 12:09:49 +0100 | [diff] [blame] | 1391 | |
Harald Alvestrand | 00cf34c | 2019-12-02 09:56:02 +0100 | [diff] [blame] | 1392 | DataChannelController data_channel_controller_; |
Henrik Boström | a3728d3 | 2019-10-28 12:09:49 +0100 | [diff] [blame] | 1393 | rtc::WeakPtrFactory<PeerConnection> weak_ptr_factory_ |
| 1394 | RTC_GUARDED_BY(signaling_thread()); |
henrike@webrtc.org | 28e2075 | 2013-07-10 00:45:36 +0000 | [diff] [blame] | 1395 | }; |
| 1396 | |
| 1397 | } // namespace webrtc |
| 1398 | |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 1399 | #endif // PC_PEER_CONNECTION_H_ |