blob: 3b0d558cfc604db38ba38a62754ed2ada6ce70df [file] [log] [blame]
henrike@webrtc.org28e20752013-07-10 00:45:36 +00001/*
kjellanderb24317b2016-02-10 07:54:43 -08002 * Copyright 2012 The WebRTC project authors. All Rights Reserved.
henrike@webrtc.org28e20752013-07-10 00:45:36 +00003 *
kjellanderb24317b2016-02-10 07:54:43 -08004 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
henrike@webrtc.org28e20752013-07-10 00:45:36 +00009 */
10
Henrik Kjellander15583c12016-02-10 10:53:12 +010011#ifndef WEBRTC_API_PEERCONNECTION_H_
12#define WEBRTC_API_PEERCONNECTION_H_
henrike@webrtc.org28e20752013-07-10 00:45:36 +000013
14#include <string>
15
Henrik Kjellander15583c12016-02-10 10:53:12 +010016#include "webrtc/api/dtlsidentitystore.h"
17#include "webrtc/api/peerconnectionfactory.h"
18#include "webrtc/api/peerconnectioninterface.h"
19#include "webrtc/api/rtpreceiverinterface.h"
20#include "webrtc/api/rtpsenderinterface.h"
21#include "webrtc/api/statscollector.h"
22#include "webrtc/api/streamcollection.h"
23#include "webrtc/api/webrtcsession.h"
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +000024#include "webrtc/base/scoped_ptr.h"
henrike@webrtc.org28e20752013-07-10 00:45:36 +000025
26namespace webrtc {
henrike@webrtc.org28e20752013-07-10 00:45:36 +000027
deadbeefeb459812015-12-15 19:24:43 -080028class MediaStreamObserver;
deadbeefab9b2d12015-10-14 11:33:11 -070029class RemoteMediaStreamFactory;
perkjf0dcfe22016-03-10 18:32:00 +010030class VideoRtpReceiver;
deadbeefab9b2d12015-10-14 11:33:11 -070031
deadbeefab9b2d12015-10-14 11:33:11 -070032// Populates |session_options| from |rtc_options|, and returns true if options
33// are valid.
deadbeef0ed85b22016-02-23 17:24:52 -080034// |session_options|->transport_options map entries must exist in order for
35// them to be populated from |rtc_options|.
htaa2a49d92016-03-04 02:51:39 -080036bool ExtractMediaSessionOptions(
deadbeefab9b2d12015-10-14 11:33:11 -070037 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options,
htaaac2dea2016-03-10 13:35:55 -080038 bool is_offer,
deadbeefab9b2d12015-10-14 11:33:11 -070039 cricket::MediaSessionOptions* session_options);
40
41// Populates |session_options| from |constraints|, and returns true if all
42// mandatory constraints are satisfied.
deadbeef0ed85b22016-02-23 17:24:52 -080043// Assumes that |session_options|->transport_options map entries exist.
htaa2a49d92016-03-04 02:51:39 -080044// Will also set defaults if corresponding constraints are not present:
45// recv_audio=true, recv_video=true, bundle_enabled=true.
46// Other fields will be left with existing values.
47//
48// Deprecated. Will be removed once callers that use constraints are gone.
49// TODO(hta): Remove when callers are gone.
50// https://bugs.chromium.org/p/webrtc/issues/detail?id=5617
deadbeefab9b2d12015-10-14 11:33:11 -070051bool ParseConstraintsForAnswer(const MediaConstraintsInterface* constraints,
52 cricket::MediaSessionOptions* session_options);
53
Taylor Brandstetter0c7e9f52015-12-29 14:14:52 -080054// Parses the URLs for each server in |servers| to build |stun_servers| and
55// |turn_servers|.
deadbeef0a6c4ca2015-10-06 11:38:28 -070056bool ParseIceServers(const PeerConnectionInterface::IceServers& servers,
Taylor Brandstetter0c7e9f52015-12-29 14:14:52 -080057 cricket::ServerAddresses* stun_servers,
58 std::vector<cricket::RelayServerConfig>* turn_servers);
deadbeef0a6c4ca2015-10-06 11:38:28 -070059
deadbeef70ab1a12015-09-28 16:53:55 -070060// PeerConnection implements the PeerConnectionInterface interface.
deadbeefab9b2d12015-10-14 11:33:11 -070061// It uses WebRtcSession to implement the PeerConnection functionality.
henrike@webrtc.org28e20752013-07-10 00:45:36 +000062class PeerConnection : public PeerConnectionInterface,
henrike@webrtc.org28e20752013-07-10 00:45:36 +000063 public IceObserver,
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +000064 public rtc::MessageHandler,
henrike@webrtc.org28e20752013-07-10 00:45:36 +000065 public sigslot::has_slots<> {
66 public:
67 explicit PeerConnection(PeerConnectionFactory* factory);
68
deadbeef653b8e02015-11-11 12:55:10 -080069 bool Initialize(
htaa2a49d92016-03-04 02:51:39 -080070 const cricket::MediaConfig& media_config,
deadbeef653b8e02015-11-11 12:55:10 -080071 const PeerConnectionInterface::RTCConfiguration& configuration,
deadbeef653b8e02015-11-11 12:55:10 -080072 rtc::scoped_ptr<cricket::PortAllocator> allocator,
73 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
74 PeerConnectionObserver* observer);
75
deadbeefa67696b2015-09-29 11:56:26 -070076 rtc::scoped_refptr<StreamCollectionInterface> local_streams() override;
77 rtc::scoped_refptr<StreamCollectionInterface> remote_streams() override;
78 bool AddStream(MediaStreamInterface* local_stream) override;
79 void RemoveStream(MediaStreamInterface* local_stream) override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +000080
deadbeefe1f9d832016-01-14 15:35:42 -080081 rtc::scoped_refptr<RtpSenderInterface> AddTrack(
82 MediaStreamTrackInterface* track,
83 std::vector<MediaStreamInterface*> streams) override;
84 bool RemoveTrack(RtpSenderInterface* sender) override;
85
deadbeefab9b2d12015-10-14 11:33:11 -070086 virtual WebRtcSession* session() { return session_.get(); }
87
deadbeefa67696b2015-09-29 11:56:26 -070088 rtc::scoped_refptr<DtmfSenderInterface> CreateDtmfSender(
89 AudioTrackInterface* track) override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +000090
deadbeeffac06552015-11-25 11:26:01 -080091 rtc::scoped_refptr<RtpSenderInterface> CreateSender(
deadbeefbd7d8f72015-12-18 16:58:44 -080092 const std::string& kind,
93 const std::string& stream_id) override;
deadbeeffac06552015-11-25 11:26:01 -080094
deadbeef70ab1a12015-09-28 16:53:55 -070095 std::vector<rtc::scoped_refptr<RtpSenderInterface>> GetSenders()
96 const override;
97 std::vector<rtc::scoped_refptr<RtpReceiverInterface>> GetReceivers()
98 const override;
99
deadbeefa67696b2015-09-29 11:56:26 -0700100 rtc::scoped_refptr<DataChannelInterface> CreateDataChannel(
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000101 const std::string& label,
deadbeefa67696b2015-09-29 11:56:26 -0700102 const DataChannelInit* config) override;
103 bool GetStats(StatsObserver* observer,
104 webrtc::MediaStreamTrackInterface* track,
105 StatsOutputLevel level) override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000106
deadbeefa67696b2015-09-29 11:56:26 -0700107 SignalingState signaling_state() override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000108
109 // TODO(bemasc): Remove ice_state() when callers are removed.
deadbeefa67696b2015-09-29 11:56:26 -0700110 IceState ice_state() override;
111 IceConnectionState ice_connection_state() override;
112 IceGatheringState ice_gathering_state() override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000113
deadbeefa67696b2015-09-29 11:56:26 -0700114 const SessionDescriptionInterface* local_description() const override;
115 const SessionDescriptionInterface* remote_description() const override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000116
117 // JSEP01
htaa2a49d92016-03-04 02:51:39 -0800118 // Deprecated, use version without constraints.
deadbeefa67696b2015-09-29 11:56:26 -0700119 void CreateOffer(CreateSessionDescriptionObserver* observer,
120 const MediaConstraintsInterface* constraints) override;
121 void CreateOffer(CreateSessionDescriptionObserver* observer,
122 const RTCOfferAnswerOptions& options) override;
htaa2a49d92016-03-04 02:51:39 -0800123 // Deprecated, use version without constraints.
deadbeefa67696b2015-09-29 11:56:26 -0700124 void CreateAnswer(CreateSessionDescriptionObserver* observer,
125 const MediaConstraintsInterface* constraints) override;
htaa2a49d92016-03-04 02:51:39 -0800126 void CreateAnswer(CreateSessionDescriptionObserver* observer,
127 const RTCOfferAnswerOptions& options) override;
deadbeefa67696b2015-09-29 11:56:26 -0700128 void SetLocalDescription(SetSessionDescriptionObserver* observer,
129 SessionDescriptionInterface* desc) override;
130 void SetRemoteDescription(SetSessionDescriptionObserver* observer,
131 SessionDescriptionInterface* desc) override;
132 bool SetConfiguration(
133 const PeerConnectionInterface::RTCConfiguration& config) override;
134 bool AddIceCandidate(const IceCandidateInterface* candidate) override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000135
deadbeefa67696b2015-09-29 11:56:26 -0700136 void RegisterUMAObserver(UMAObserver* observer) override;
buildbot@webrtc.org1567b8c2014-05-08 19:54:16 +0000137
deadbeefa67696b2015-09-29 11:56:26 -0700138 void Close() override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000139
deadbeefab9b2d12015-10-14 11:33:11 -0700140 // Virtual for unit tests.
141 virtual const std::vector<rtc::scoped_refptr<DataChannel>>&
142 sctp_data_channels() const {
143 return sctp_data_channels_;
144 };
145
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000146 protected:
deadbeefa67696b2015-09-29 11:56:26 -0700147 ~PeerConnection() override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000148
149 private:
deadbeefab9b2d12015-10-14 11:33:11 -0700150 struct TrackInfo {
151 TrackInfo() : ssrc(0) {}
152 TrackInfo(const std::string& stream_label,
153 const std::string track_id,
154 uint32_t ssrc)
155 : stream_label(stream_label), track_id(track_id), ssrc(ssrc) {}
deadbeefbda7e0b2015-12-08 17:13:40 -0800156 bool operator==(const TrackInfo& other) {
157 return this->stream_label == other.stream_label &&
158 this->track_id == other.track_id && this->ssrc == other.ssrc;
159 }
deadbeefab9b2d12015-10-14 11:33:11 -0700160 std::string stream_label;
161 std::string track_id;
162 uint32_t ssrc;
163 };
164 typedef std::vector<TrackInfo> TrackInfos;
165
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000166 // Implements MessageHandler.
deadbeefa67696b2015-09-29 11:56:26 -0700167 void OnMessage(rtc::Message* msg) override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000168
deadbeefab9b2d12015-10-14 11:33:11 -0700169 void CreateAudioReceiver(MediaStreamInterface* stream,
170 AudioTrackInterface* audio_track,
171 uint32_t ssrc);
perkjf0dcfe22016-03-10 18:32:00 +0100172
deadbeefab9b2d12015-10-14 11:33:11 -0700173 void CreateVideoReceiver(MediaStreamInterface* stream,
perkjf0dcfe22016-03-10 18:32:00 +0100174 const std::string& track_id,
deadbeefab9b2d12015-10-14 11:33:11 -0700175 uint32_t ssrc);
176 void DestroyAudioReceiver(MediaStreamInterface* stream,
177 AudioTrackInterface* audio_track);
178 void DestroyVideoReceiver(MediaStreamInterface* stream,
179 VideoTrackInterface* video_track);
deadbeefab9b2d12015-10-14 11:33:11 -0700180 void DestroyAudioSender(MediaStreamInterface* stream,
181 AudioTrackInterface* audio_track,
182 uint32_t ssrc);
183 void DestroyVideoSender(MediaStreamInterface* stream,
184 VideoTrackInterface* video_track);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000185
186 // Implements IceObserver
Peter Thatcher54360512015-07-08 11:08:35 -0700187 void OnIceConnectionChange(IceConnectionState new_state) override;
188 void OnIceGatheringChange(IceGatheringState new_state) override;
189 void OnIceCandidate(const IceCandidateInterface* candidate) override;
Peter Thatcher54360512015-07-08 11:08:35 -0700190 void OnIceConnectionReceivingChange(bool receiving) override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000191
192 // Signals from WebRtcSession.
deadbeefd59daf82015-10-14 15:02:44 -0700193 void OnSessionStateChange(WebRtcSession* session, WebRtcSession::State state);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000194 void ChangeSignalingState(SignalingState signaling_state);
195
deadbeefeb459812015-12-15 19:24:43 -0800196 // Signals from MediaStreamObserver.
197 void OnAudioTrackAdded(AudioTrackInterface* track,
198 MediaStreamInterface* stream);
199 void OnAudioTrackRemoved(AudioTrackInterface* track,
200 MediaStreamInterface* stream);
201 void OnVideoTrackAdded(VideoTrackInterface* track,
202 MediaStreamInterface* stream);
203 void OnVideoTrackRemoved(VideoTrackInterface* track,
204 MediaStreamInterface* stream);
205
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000206 rtc::Thread* signaling_thread() const {
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000207 return factory_->signaling_thread();
208 }
209
210 void PostSetSessionDescriptionFailure(SetSessionDescriptionObserver* observer,
211 const std::string& error);
deadbeefab9b2d12015-10-14 11:33:11 -0700212 void PostCreateSessionDescriptionFailure(
213 CreateSessionDescriptionObserver* observer,
214 const std::string& error);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000215
216 bool IsClosed() const {
217 return signaling_state_ == PeerConnectionInterface::kClosed;
218 }
219
deadbeefab9b2d12015-10-14 11:33:11 -0700220 // Returns a MediaSessionOptions struct with options decided by |options|,
221 // the local MediaStreams and DataChannels.
222 virtual bool GetOptionsForOffer(
223 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options,
224 cricket::MediaSessionOptions* session_options);
225
226 // Returns a MediaSessionOptions struct with options decided by
227 // |constraints|, the local MediaStreams and DataChannels.
htaa2a49d92016-03-04 02:51:39 -0800228 // Deprecated, use version without constraints.
deadbeefab9b2d12015-10-14 11:33:11 -0700229 virtual bool GetOptionsForAnswer(
230 const MediaConstraintsInterface* constraints,
231 cricket::MediaSessionOptions* session_options);
htaa2a49d92016-03-04 02:51:39 -0800232 virtual bool GetOptionsForAnswer(
233 const RTCOfferAnswerOptions& options,
234 cricket::MediaSessionOptions* session_options);
235
236 // Helper function for options processing.
237 // Deprecated.
238 virtual void FinishOptionsForAnswer(
239 cricket::MediaSessionOptions* session_options);
deadbeefab9b2d12015-10-14 11:33:11 -0700240
deadbeeffaac4972015-11-12 15:33:07 -0800241 // Remove all local and remote tracks of type |media_type|.
242 // Called when a media type is rejected (m-line set to port 0).
243 void RemoveTracks(cricket::MediaType media_type);
244
deadbeefbda7e0b2015-12-08 17:13:40 -0800245 // Makes sure a MediaStreamTrack is created for each StreamParam in |streams|,
246 // and existing MediaStreamTracks are removed if there is no corresponding
247 // StreamParam. If |default_track_needed| is true, a default MediaStreamTrack
248 // is created if it doesn't exist; if false, it's removed if it exists.
249 // |media_type| is the type of the |streams| and can be either audio or video.
deadbeefab9b2d12015-10-14 11:33:11 -0700250 // If a new MediaStream is created it is added to |new_streams|.
251 void UpdateRemoteStreamsList(
252 const std::vector<cricket::StreamParams>& streams,
deadbeefbda7e0b2015-12-08 17:13:40 -0800253 bool default_track_needed,
deadbeefab9b2d12015-10-14 11:33:11 -0700254 cricket::MediaType media_type,
255 StreamCollection* new_streams);
256
257 // Triggered when a remote track has been seen for the first time in a remote
258 // session description. It creates a remote MediaStreamTrackInterface
259 // implementation and triggers CreateAudioReceiver or CreateVideoReceiver.
260 void OnRemoteTrackSeen(const std::string& stream_label,
261 const std::string& track_id,
262 uint32_t ssrc,
263 cricket::MediaType media_type);
264
265 // Triggered when a remote track has been removed from a remote session
266 // description. It removes the remote track with id |track_id| from a remote
267 // MediaStream and triggers DestroyAudioReceiver or DestroyVideoReceiver.
268 void OnRemoteTrackRemoved(const std::string& stream_label,
269 const std::string& track_id,
270 cricket::MediaType media_type);
271
272 // Finds remote MediaStreams without any tracks and removes them from
273 // |remote_streams_| and notifies the observer that the MediaStreams no longer
274 // exist.
275 void UpdateEndedRemoteMediaStreams();
276
deadbeefab9b2d12015-10-14 11:33:11 -0700277 // Set the MediaStreamTrackInterface::TrackState to |kEnded| on all remote
278 // tracks of type |media_type|.
279 void EndRemoteTracks(cricket::MediaType media_type);
280
281 // Loops through the vector of |streams| and finds added and removed
282 // StreamParams since last time this method was called.
283 // For each new or removed StreamParam, OnLocalTrackSeen or
284 // OnLocalTrackRemoved is invoked.
285 void UpdateLocalTracks(const std::vector<cricket::StreamParams>& streams,
286 cricket::MediaType media_type);
287
288 // Triggered when a local track has been seen for the first time in a local
289 // session description.
290 // This method triggers CreateAudioSender or CreateVideoSender if the rtp
291 // streams in the local SessionDescription can be mapped to a MediaStreamTrack
292 // in a MediaStream in |local_streams_|
293 void OnLocalTrackSeen(const std::string& stream_label,
294 const std::string& track_id,
295 uint32_t ssrc,
296 cricket::MediaType media_type);
297
298 // Triggered when a local track has been removed from a local session
299 // description.
300 // This method triggers DestroyAudioSender or DestroyVideoSender if a stream
301 // has been removed from the local SessionDescription and the stream can be
302 // mapped to a MediaStreamTrack in a MediaStream in |local_streams_|.
303 void OnLocalTrackRemoved(const std::string& stream_label,
304 const std::string& track_id,
305 uint32_t ssrc,
306 cricket::MediaType media_type);
307
308 void UpdateLocalRtpDataChannels(const cricket::StreamParamsVec& streams);
309 void UpdateRemoteRtpDataChannels(const cricket::StreamParamsVec& streams);
310 void UpdateClosingRtpDataChannels(
311 const std::vector<std::string>& active_channels,
312 bool is_local_update);
313 void CreateRemoteRtpDataChannel(const std::string& label,
314 uint32_t remote_ssrc);
315
316 // Creates channel and adds it to the collection of DataChannels that will
317 // be offered in a SessionDescription.
318 rtc::scoped_refptr<DataChannel> InternalCreateDataChannel(
319 const std::string& label,
320 const InternalDataChannelInit* config);
321
322 // Checks if any data channel has been added.
323 bool HasDataChannels() const;
324
325 void AllocateSctpSids(rtc::SSLRole role);
326 void OnSctpDataChannelClosed(DataChannel* channel);
327
328 // Notifications from WebRtcSession relating to BaseChannels.
329 void OnVoiceChannelDestroyed();
330 void OnVideoChannelDestroyed();
331 void OnDataChannelCreated();
332 void OnDataChannelDestroyed();
333 // Called when the cricket::DataChannel receives a message indicating that a
334 // webrtc::DataChannel should be opened.
335 void OnDataChannelOpenMessage(const std::string& label,
336 const InternalDataChannelInit& config);
337
deadbeeffac06552015-11-25 11:26:01 -0800338 RtpSenderInterface* FindSenderById(const std::string& id);
339
deadbeef70ab1a12015-09-28 16:53:55 -0700340 std::vector<rtc::scoped_refptr<RtpSenderInterface>>::iterator
341 FindSenderForTrack(MediaStreamTrackInterface* track);
342 std::vector<rtc::scoped_refptr<RtpReceiverInterface>>::iterator
343 FindReceiverForTrack(MediaStreamTrackInterface* track);
344
deadbeefab9b2d12015-10-14 11:33:11 -0700345 TrackInfos* GetRemoteTracks(cricket::MediaType media_type);
346 TrackInfos* GetLocalTracks(cricket::MediaType media_type);
347 const TrackInfo* FindTrackInfo(const TrackInfos& infos,
348 const std::string& stream_label,
349 const std::string track_id) const;
350
351 // Returns the specified SCTP DataChannel in sctp_data_channels_,
352 // or nullptr if not found.
353 DataChannel* FindDataChannelBySid(int sid) const;
354
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000355 // Storing the factory as a scoped reference pointer ensures that the memory
356 // in the PeerConnectionFactoryImpl remains available as long as the
357 // PeerConnection is running. It is passed to PeerConnection as a raw pointer.
358 // However, since the reference counting is done in the
deadbeefab9b2d12015-10-14 11:33:11 -0700359 // PeerConnectionFactoryInterface all instances created using the raw pointer
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000360 // will refer to the same reference count.
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000361 rtc::scoped_refptr<PeerConnectionFactory> factory_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000362 PeerConnectionObserver* observer_;
buildbot@webrtc.org1567b8c2014-05-08 19:54:16 +0000363 UMAObserver* uma_observer_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000364 SignalingState signaling_state_;
365 // TODO(bemasc): Remove ice_state_.
366 IceState ice_state_;
367 IceConnectionState ice_connection_state_;
368 IceGatheringState ice_gathering_state_;
369
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000370 rtc::scoped_ptr<cricket::PortAllocator> port_allocator_;
stefanc1aeaf02015-10-15 07:26:07 -0700371 rtc::scoped_ptr<MediaControllerInterface> media_controller_;
deadbeefab9b2d12015-10-14 11:33:11 -0700372
373 // Streams added via AddStream.
374 rtc::scoped_refptr<StreamCollection> local_streams_;
375 // Streams created as a result of SetRemoteDescription.
376 rtc::scoped_refptr<StreamCollection> remote_streams_;
377
deadbeefeb459812015-12-15 19:24:43 -0800378 std::vector<rtc::scoped_ptr<MediaStreamObserver>> stream_observers_;
379
deadbeefab9b2d12015-10-14 11:33:11 -0700380 // These lists store track info seen in local/remote descriptions.
381 TrackInfos remote_audio_tracks_;
382 TrackInfos remote_video_tracks_;
383 TrackInfos local_audio_tracks_;
384 TrackInfos local_video_tracks_;
385
386 SctpSidAllocator sid_allocator_;
387 // label -> DataChannel
388 std::map<std::string, rtc::scoped_refptr<DataChannel>> rtp_data_channels_;
389 std::vector<rtc::scoped_refptr<DataChannel>> sctp_data_channels_;
deadbeefbd292462015-12-14 18:15:29 -0800390 std::vector<rtc::scoped_refptr<DataChannel>> sctp_data_channels_to_free_;
deadbeefab9b2d12015-10-14 11:33:11 -0700391
deadbeefbda7e0b2015-12-08 17:13:40 -0800392 bool remote_peer_supports_msid_ = false;
deadbeefab9b2d12015-10-14 11:33:11 -0700393 rtc::scoped_ptr<RemoteMediaStreamFactory> remote_stream_factory_;
deadbeef70ab1a12015-09-28 16:53:55 -0700394
395 std::vector<rtc::scoped_refptr<RtpSenderInterface>> senders_;
396 std::vector<rtc::scoped_refptr<RtpReceiverInterface>> receivers_;
deadbeefab9b2d12015-10-14 11:33:11 -0700397
398 // The session_ scoped_ptr is declared at the bottom of PeerConnection
399 // because its destruction fires signals (such as VoiceChannelDestroyed)
400 // which will trigger some final actions in PeerConnection...
401 rtc::scoped_ptr<WebRtcSession> session_;
402 // ... But stats_ depends on session_ so it should be destroyed even earlier.
403 rtc::scoped_ptr<StatsCollector> stats_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000404};
405
406} // namespace webrtc
407
Henrik Kjellander15583c12016-02-10 10:53:12 +0100408#endif // WEBRTC_API_PEERCONNECTION_H_