blob: e4fcdf075a0dc025f337e14f473d7c9eeb6203d5 [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;
30
deadbeefab9b2d12015-10-14 11:33:11 -070031// Populates |session_options| from |rtc_options|, and returns true if options
32// are valid.
deadbeef0ed85b22016-02-23 17:24:52 -080033// |session_options|->transport_options map entries must exist in order for
34// them to be populated from |rtc_options|.
htaa2a49d92016-03-04 02:51:39 -080035bool ExtractMediaSessionOptions(
deadbeefab9b2d12015-10-14 11:33:11 -070036 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options,
37 cricket::MediaSessionOptions* session_options);
38
39// Populates |session_options| from |constraints|, and returns true if all
40// mandatory constraints are satisfied.
deadbeef0ed85b22016-02-23 17:24:52 -080041// Assumes that |session_options|->transport_options map entries exist.
htaa2a49d92016-03-04 02:51:39 -080042// Will also set defaults if corresponding constraints are not present:
43// recv_audio=true, recv_video=true, bundle_enabled=true.
44// Other fields will be left with existing values.
45//
46// Deprecated. Will be removed once callers that use constraints are gone.
47// TODO(hta): Remove when callers are gone.
48// https://bugs.chromium.org/p/webrtc/issues/detail?id=5617
deadbeefab9b2d12015-10-14 11:33:11 -070049bool ParseConstraintsForAnswer(const MediaConstraintsInterface* constraints,
50 cricket::MediaSessionOptions* session_options);
51
Taylor Brandstetter0c7e9f52015-12-29 14:14:52 -080052// Parses the URLs for each server in |servers| to build |stun_servers| and
53// |turn_servers|.
deadbeef0a6c4ca2015-10-06 11:38:28 -070054bool ParseIceServers(const PeerConnectionInterface::IceServers& servers,
Taylor Brandstetter0c7e9f52015-12-29 14:14:52 -080055 cricket::ServerAddresses* stun_servers,
56 std::vector<cricket::RelayServerConfig>* turn_servers);
deadbeef0a6c4ca2015-10-06 11:38:28 -070057
deadbeef70ab1a12015-09-28 16:53:55 -070058// PeerConnection implements the PeerConnectionInterface interface.
deadbeefab9b2d12015-10-14 11:33:11 -070059// It uses WebRtcSession to implement the PeerConnection functionality.
henrike@webrtc.org28e20752013-07-10 00:45:36 +000060class PeerConnection : public PeerConnectionInterface,
henrike@webrtc.org28e20752013-07-10 00:45:36 +000061 public IceObserver,
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +000062 public rtc::MessageHandler,
henrike@webrtc.org28e20752013-07-10 00:45:36 +000063 public sigslot::has_slots<> {
64 public:
65 explicit PeerConnection(PeerConnectionFactory* factory);
66
deadbeef653b8e02015-11-11 12:55:10 -080067 bool Initialize(
htaa2a49d92016-03-04 02:51:39 -080068 const cricket::MediaConfig& media_config,
deadbeef653b8e02015-11-11 12:55:10 -080069 const PeerConnectionInterface::RTCConfiguration& configuration,
deadbeef653b8e02015-11-11 12:55:10 -080070 rtc::scoped_ptr<cricket::PortAllocator> allocator,
71 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
72 PeerConnectionObserver* observer);
73
deadbeefa67696b2015-09-29 11:56:26 -070074 rtc::scoped_refptr<StreamCollectionInterface> local_streams() override;
75 rtc::scoped_refptr<StreamCollectionInterface> remote_streams() override;
76 bool AddStream(MediaStreamInterface* local_stream) override;
77 void RemoveStream(MediaStreamInterface* local_stream) override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +000078
deadbeefe1f9d832016-01-14 15:35:42 -080079 rtc::scoped_refptr<RtpSenderInterface> AddTrack(
80 MediaStreamTrackInterface* track,
81 std::vector<MediaStreamInterface*> streams) override;
82 bool RemoveTrack(RtpSenderInterface* sender) override;
83
deadbeefab9b2d12015-10-14 11:33:11 -070084 virtual WebRtcSession* session() { return session_.get(); }
85
deadbeefa67696b2015-09-29 11:56:26 -070086 rtc::scoped_refptr<DtmfSenderInterface> CreateDtmfSender(
87 AudioTrackInterface* track) override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +000088
deadbeeffac06552015-11-25 11:26:01 -080089 rtc::scoped_refptr<RtpSenderInterface> CreateSender(
deadbeefbd7d8f72015-12-18 16:58:44 -080090 const std::string& kind,
91 const std::string& stream_id) override;
deadbeeffac06552015-11-25 11:26:01 -080092
deadbeef70ab1a12015-09-28 16:53:55 -070093 std::vector<rtc::scoped_refptr<RtpSenderInterface>> GetSenders()
94 const override;
95 std::vector<rtc::scoped_refptr<RtpReceiverInterface>> GetReceivers()
96 const override;
97
deadbeefa67696b2015-09-29 11:56:26 -070098 rtc::scoped_refptr<DataChannelInterface> CreateDataChannel(
henrike@webrtc.org28e20752013-07-10 00:45:36 +000099 const std::string& label,
deadbeefa67696b2015-09-29 11:56:26 -0700100 const DataChannelInit* config) override;
101 bool GetStats(StatsObserver* observer,
102 webrtc::MediaStreamTrackInterface* track,
103 StatsOutputLevel level) override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000104
deadbeefa67696b2015-09-29 11:56:26 -0700105 SignalingState signaling_state() override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000106
107 // TODO(bemasc): Remove ice_state() when callers are removed.
deadbeefa67696b2015-09-29 11:56:26 -0700108 IceState ice_state() override;
109 IceConnectionState ice_connection_state() override;
110 IceGatheringState ice_gathering_state() override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000111
deadbeefa67696b2015-09-29 11:56:26 -0700112 const SessionDescriptionInterface* local_description() const override;
113 const SessionDescriptionInterface* remote_description() const override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000114
115 // JSEP01
htaa2a49d92016-03-04 02:51:39 -0800116 // Deprecated, use version without constraints.
deadbeefa67696b2015-09-29 11:56:26 -0700117 void CreateOffer(CreateSessionDescriptionObserver* observer,
118 const MediaConstraintsInterface* constraints) override;
119 void CreateOffer(CreateSessionDescriptionObserver* observer,
120 const RTCOfferAnswerOptions& options) override;
htaa2a49d92016-03-04 02:51:39 -0800121 // Deprecated, use version without constraints.
deadbeefa67696b2015-09-29 11:56:26 -0700122 void CreateAnswer(CreateSessionDescriptionObserver* observer,
123 const MediaConstraintsInterface* constraints) override;
htaa2a49d92016-03-04 02:51:39 -0800124 void CreateAnswer(CreateSessionDescriptionObserver* observer,
125 const RTCOfferAnswerOptions& options) override;
deadbeefa67696b2015-09-29 11:56:26 -0700126 void SetLocalDescription(SetSessionDescriptionObserver* observer,
127 SessionDescriptionInterface* desc) override;
128 void SetRemoteDescription(SetSessionDescriptionObserver* observer,
129 SessionDescriptionInterface* desc) override;
130 bool SetConfiguration(
131 const PeerConnectionInterface::RTCConfiguration& config) override;
132 bool AddIceCandidate(const IceCandidateInterface* candidate) override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000133
deadbeefa67696b2015-09-29 11:56:26 -0700134 void RegisterUMAObserver(UMAObserver* observer) override;
buildbot@webrtc.org1567b8c2014-05-08 19:54:16 +0000135
deadbeefa67696b2015-09-29 11:56:26 -0700136 void Close() override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000137
deadbeefab9b2d12015-10-14 11:33:11 -0700138 // Virtual for unit tests.
139 virtual const std::vector<rtc::scoped_refptr<DataChannel>>&
140 sctp_data_channels() const {
141 return sctp_data_channels_;
142 };
143
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000144 protected:
deadbeefa67696b2015-09-29 11:56:26 -0700145 ~PeerConnection() override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000146
147 private:
deadbeefab9b2d12015-10-14 11:33:11 -0700148 struct TrackInfo {
149 TrackInfo() : ssrc(0) {}
150 TrackInfo(const std::string& stream_label,
151 const std::string track_id,
152 uint32_t ssrc)
153 : stream_label(stream_label), track_id(track_id), ssrc(ssrc) {}
deadbeefbda7e0b2015-12-08 17:13:40 -0800154 bool operator==(const TrackInfo& other) {
155 return this->stream_label == other.stream_label &&
156 this->track_id == other.track_id && this->ssrc == other.ssrc;
157 }
deadbeefab9b2d12015-10-14 11:33:11 -0700158 std::string stream_label;
159 std::string track_id;
160 uint32_t ssrc;
161 };
162 typedef std::vector<TrackInfo> TrackInfos;
163
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000164 // Implements MessageHandler.
deadbeefa67696b2015-09-29 11:56:26 -0700165 void OnMessage(rtc::Message* msg) override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000166
deadbeefab9b2d12015-10-14 11:33:11 -0700167 void CreateAudioReceiver(MediaStreamInterface* stream,
168 AudioTrackInterface* audio_track,
169 uint32_t ssrc);
170 void CreateVideoReceiver(MediaStreamInterface* stream,
171 VideoTrackInterface* video_track,
172 uint32_t ssrc);
173 void DestroyAudioReceiver(MediaStreamInterface* stream,
174 AudioTrackInterface* audio_track);
175 void DestroyVideoReceiver(MediaStreamInterface* stream,
176 VideoTrackInterface* video_track);
deadbeefab9b2d12015-10-14 11:33:11 -0700177 void DestroyAudioSender(MediaStreamInterface* stream,
178 AudioTrackInterface* audio_track,
179 uint32_t ssrc);
180 void DestroyVideoSender(MediaStreamInterface* stream,
181 VideoTrackInterface* video_track);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000182
183 // Implements IceObserver
Peter Thatcher54360512015-07-08 11:08:35 -0700184 void OnIceConnectionChange(IceConnectionState new_state) override;
185 void OnIceGatheringChange(IceGatheringState new_state) override;
186 void OnIceCandidate(const IceCandidateInterface* candidate) override;
Peter Thatcher54360512015-07-08 11:08:35 -0700187 void OnIceConnectionReceivingChange(bool receiving) override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000188
189 // Signals from WebRtcSession.
deadbeefd59daf82015-10-14 15:02:44 -0700190 void OnSessionStateChange(WebRtcSession* session, WebRtcSession::State state);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000191 void ChangeSignalingState(SignalingState signaling_state);
192
deadbeefeb459812015-12-15 19:24:43 -0800193 // Signals from MediaStreamObserver.
194 void OnAudioTrackAdded(AudioTrackInterface* track,
195 MediaStreamInterface* stream);
196 void OnAudioTrackRemoved(AudioTrackInterface* track,
197 MediaStreamInterface* stream);
198 void OnVideoTrackAdded(VideoTrackInterface* track,
199 MediaStreamInterface* stream);
200 void OnVideoTrackRemoved(VideoTrackInterface* track,
201 MediaStreamInterface* stream);
202
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000203 rtc::Thread* signaling_thread() const {
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000204 return factory_->signaling_thread();
205 }
206
207 void PostSetSessionDescriptionFailure(SetSessionDescriptionObserver* observer,
208 const std::string& error);
deadbeefab9b2d12015-10-14 11:33:11 -0700209 void PostCreateSessionDescriptionFailure(
210 CreateSessionDescriptionObserver* observer,
211 const std::string& error);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000212
213 bool IsClosed() const {
214 return signaling_state_ == PeerConnectionInterface::kClosed;
215 }
216
deadbeefab9b2d12015-10-14 11:33:11 -0700217 // Returns a MediaSessionOptions struct with options decided by |options|,
218 // the local MediaStreams and DataChannels.
219 virtual bool GetOptionsForOffer(
220 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options,
221 cricket::MediaSessionOptions* session_options);
222
223 // Returns a MediaSessionOptions struct with options decided by
224 // |constraints|, the local MediaStreams and DataChannels.
htaa2a49d92016-03-04 02:51:39 -0800225 // Deprecated, use version without constraints.
deadbeefab9b2d12015-10-14 11:33:11 -0700226 virtual bool GetOptionsForAnswer(
227 const MediaConstraintsInterface* constraints,
228 cricket::MediaSessionOptions* session_options);
htaa2a49d92016-03-04 02:51:39 -0800229 virtual bool GetOptionsForAnswer(
230 const RTCOfferAnswerOptions& options,
231 cricket::MediaSessionOptions* session_options);
232
233 // Helper function for options processing.
234 // Deprecated.
235 virtual void FinishOptionsForAnswer(
236 cricket::MediaSessionOptions* session_options);
deadbeefab9b2d12015-10-14 11:33:11 -0700237
deadbeeffaac4972015-11-12 15:33:07 -0800238 // Remove all local and remote tracks of type |media_type|.
239 // Called when a media type is rejected (m-line set to port 0).
240 void RemoveTracks(cricket::MediaType media_type);
241
deadbeefbda7e0b2015-12-08 17:13:40 -0800242 // Makes sure a MediaStreamTrack is created for each StreamParam in |streams|,
243 // and existing MediaStreamTracks are removed if there is no corresponding
244 // StreamParam. If |default_track_needed| is true, a default MediaStreamTrack
245 // is created if it doesn't exist; if false, it's removed if it exists.
246 // |media_type| is the type of the |streams| and can be either audio or video.
deadbeefab9b2d12015-10-14 11:33:11 -0700247 // If a new MediaStream is created it is added to |new_streams|.
248 void UpdateRemoteStreamsList(
249 const std::vector<cricket::StreamParams>& streams,
deadbeefbda7e0b2015-12-08 17:13:40 -0800250 bool default_track_needed,
deadbeefab9b2d12015-10-14 11:33:11 -0700251 cricket::MediaType media_type,
252 StreamCollection* new_streams);
253
254 // Triggered when a remote track has been seen for the first time in a remote
255 // session description. It creates a remote MediaStreamTrackInterface
256 // implementation and triggers CreateAudioReceiver or CreateVideoReceiver.
257 void OnRemoteTrackSeen(const std::string& stream_label,
258 const std::string& track_id,
259 uint32_t ssrc,
260 cricket::MediaType media_type);
261
262 // Triggered when a remote track has been removed from a remote session
263 // description. It removes the remote track with id |track_id| from a remote
264 // MediaStream and triggers DestroyAudioReceiver or DestroyVideoReceiver.
265 void OnRemoteTrackRemoved(const std::string& stream_label,
266 const std::string& track_id,
267 cricket::MediaType media_type);
268
269 // Finds remote MediaStreams without any tracks and removes them from
270 // |remote_streams_| and notifies the observer that the MediaStreams no longer
271 // exist.
272 void UpdateEndedRemoteMediaStreams();
273
deadbeefab9b2d12015-10-14 11:33:11 -0700274 // Set the MediaStreamTrackInterface::TrackState to |kEnded| on all remote
275 // tracks of type |media_type|.
276 void EndRemoteTracks(cricket::MediaType media_type);
277
278 // Loops through the vector of |streams| and finds added and removed
279 // StreamParams since last time this method was called.
280 // For each new or removed StreamParam, OnLocalTrackSeen or
281 // OnLocalTrackRemoved is invoked.
282 void UpdateLocalTracks(const std::vector<cricket::StreamParams>& streams,
283 cricket::MediaType media_type);
284
285 // Triggered when a local track has been seen for the first time in a local
286 // session description.
287 // This method triggers CreateAudioSender or CreateVideoSender if the rtp
288 // streams in the local SessionDescription can be mapped to a MediaStreamTrack
289 // in a MediaStream in |local_streams_|
290 void OnLocalTrackSeen(const std::string& stream_label,
291 const std::string& track_id,
292 uint32_t ssrc,
293 cricket::MediaType media_type);
294
295 // Triggered when a local track has been removed from a local session
296 // description.
297 // This method triggers DestroyAudioSender or DestroyVideoSender if a stream
298 // has been removed from the local SessionDescription and the stream can be
299 // mapped to a MediaStreamTrack in a MediaStream in |local_streams_|.
300 void OnLocalTrackRemoved(const std::string& stream_label,
301 const std::string& track_id,
302 uint32_t ssrc,
303 cricket::MediaType media_type);
304
305 void UpdateLocalRtpDataChannels(const cricket::StreamParamsVec& streams);
306 void UpdateRemoteRtpDataChannels(const cricket::StreamParamsVec& streams);
307 void UpdateClosingRtpDataChannels(
308 const std::vector<std::string>& active_channels,
309 bool is_local_update);
310 void CreateRemoteRtpDataChannel(const std::string& label,
311 uint32_t remote_ssrc);
312
313 // Creates channel and adds it to the collection of DataChannels that will
314 // be offered in a SessionDescription.
315 rtc::scoped_refptr<DataChannel> InternalCreateDataChannel(
316 const std::string& label,
317 const InternalDataChannelInit* config);
318
319 // Checks if any data channel has been added.
320 bool HasDataChannels() const;
321
322 void AllocateSctpSids(rtc::SSLRole role);
323 void OnSctpDataChannelClosed(DataChannel* channel);
324
325 // Notifications from WebRtcSession relating to BaseChannels.
326 void OnVoiceChannelDestroyed();
327 void OnVideoChannelDestroyed();
328 void OnDataChannelCreated();
329 void OnDataChannelDestroyed();
330 // Called when the cricket::DataChannel receives a message indicating that a
331 // webrtc::DataChannel should be opened.
332 void OnDataChannelOpenMessage(const std::string& label,
333 const InternalDataChannelInit& config);
334
deadbeeffac06552015-11-25 11:26:01 -0800335 RtpSenderInterface* FindSenderById(const std::string& id);
336
deadbeef70ab1a12015-09-28 16:53:55 -0700337 std::vector<rtc::scoped_refptr<RtpSenderInterface>>::iterator
338 FindSenderForTrack(MediaStreamTrackInterface* track);
339 std::vector<rtc::scoped_refptr<RtpReceiverInterface>>::iterator
340 FindReceiverForTrack(MediaStreamTrackInterface* track);
341
deadbeefab9b2d12015-10-14 11:33:11 -0700342 TrackInfos* GetRemoteTracks(cricket::MediaType media_type);
343 TrackInfos* GetLocalTracks(cricket::MediaType media_type);
344 const TrackInfo* FindTrackInfo(const TrackInfos& infos,
345 const std::string& stream_label,
346 const std::string track_id) const;
347
348 // Returns the specified SCTP DataChannel in sctp_data_channels_,
349 // or nullptr if not found.
350 DataChannel* FindDataChannelBySid(int sid) const;
351
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000352 // Storing the factory as a scoped reference pointer ensures that the memory
353 // in the PeerConnectionFactoryImpl remains available as long as the
354 // PeerConnection is running. It is passed to PeerConnection as a raw pointer.
355 // However, since the reference counting is done in the
deadbeefab9b2d12015-10-14 11:33:11 -0700356 // PeerConnectionFactoryInterface all instances created using the raw pointer
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000357 // will refer to the same reference count.
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000358 rtc::scoped_refptr<PeerConnectionFactory> factory_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000359 PeerConnectionObserver* observer_;
buildbot@webrtc.org1567b8c2014-05-08 19:54:16 +0000360 UMAObserver* uma_observer_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000361 SignalingState signaling_state_;
362 // TODO(bemasc): Remove ice_state_.
363 IceState ice_state_;
364 IceConnectionState ice_connection_state_;
365 IceGatheringState ice_gathering_state_;
366
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000367 rtc::scoped_ptr<cricket::PortAllocator> port_allocator_;
stefanc1aeaf02015-10-15 07:26:07 -0700368 rtc::scoped_ptr<MediaControllerInterface> media_controller_;
deadbeefab9b2d12015-10-14 11:33:11 -0700369
370 // Streams added via AddStream.
371 rtc::scoped_refptr<StreamCollection> local_streams_;
372 // Streams created as a result of SetRemoteDescription.
373 rtc::scoped_refptr<StreamCollection> remote_streams_;
374
deadbeefeb459812015-12-15 19:24:43 -0800375 std::vector<rtc::scoped_ptr<MediaStreamObserver>> stream_observers_;
376
deadbeefab9b2d12015-10-14 11:33:11 -0700377 // These lists store track info seen in local/remote descriptions.
378 TrackInfos remote_audio_tracks_;
379 TrackInfos remote_video_tracks_;
380 TrackInfos local_audio_tracks_;
381 TrackInfos local_video_tracks_;
382
383 SctpSidAllocator sid_allocator_;
384 // label -> DataChannel
385 std::map<std::string, rtc::scoped_refptr<DataChannel>> rtp_data_channels_;
386 std::vector<rtc::scoped_refptr<DataChannel>> sctp_data_channels_;
deadbeefbd292462015-12-14 18:15:29 -0800387 std::vector<rtc::scoped_refptr<DataChannel>> sctp_data_channels_to_free_;
deadbeefab9b2d12015-10-14 11:33:11 -0700388
deadbeefbda7e0b2015-12-08 17:13:40 -0800389 bool remote_peer_supports_msid_ = false;
deadbeefab9b2d12015-10-14 11:33:11 -0700390 rtc::scoped_ptr<RemoteMediaStreamFactory> remote_stream_factory_;
deadbeef70ab1a12015-09-28 16:53:55 -0700391
392 std::vector<rtc::scoped_refptr<RtpSenderInterface>> senders_;
393 std::vector<rtc::scoped_refptr<RtpReceiverInterface>> receivers_;
deadbeefab9b2d12015-10-14 11:33:11 -0700394
395 // The session_ scoped_ptr is declared at the bottom of PeerConnection
396 // because its destruction fires signals (such as VoiceChannelDestroyed)
397 // which will trigger some final actions in PeerConnection...
398 rtc::scoped_ptr<WebRtcSession> session_;
399 // ... But stats_ depends on session_ so it should be destroyed even earlier.
400 rtc::scoped_ptr<StatsCollector> stats_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000401};
402
403} // namespace webrtc
404
Henrik Kjellander15583c12016-02-10 10:53:12 +0100405#endif // WEBRTC_API_PEERCONNECTION_H_