blob: ab3fdcc56da6d185ee5d73c8b6c0409edd49eefe [file] [log] [blame]
henrike@webrtc.org28e20752013-07-10 00:45:36 +00001/*
2 * libjingle
jlmiller@webrtc.org5f93d0a2015-01-20 21:36:13 +00003 * Copyright 2012 Google Inc.
henrike@webrtc.org28e20752013-07-10 00:45:36 +00004 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#ifndef TALK_APP_WEBRTC_PEERCONNECTION_H_
29#define TALK_APP_WEBRTC_PEERCONNECTION_H_
30
31#include <string>
32
Henrik Boström5e56c592015-08-11 10:33:13 +020033#include "talk/app/webrtc/dtlsidentitystore.h"
henrike@webrtc.org28e20752013-07-10 00:45:36 +000034#include "talk/app/webrtc/peerconnectionfactory.h"
buildbot@webrtc.orga09a9992014-08-13 17:26:08 +000035#include "talk/app/webrtc/peerconnectioninterface.h"
deadbeef70ab1a12015-09-28 16:53:55 -070036#include "talk/app/webrtc/rtpreceiverinterface.h"
37#include "talk/app/webrtc/rtpsenderinterface.h"
henrike@webrtc.org28e20752013-07-10 00:45:36 +000038#include "talk/app/webrtc/statscollector.h"
39#include "talk/app/webrtc/streamcollection.h"
40#include "talk/app/webrtc/webrtcsession.h"
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +000041#include "webrtc/base/scoped_ptr.h"
henrike@webrtc.org28e20752013-07-10 00:45:36 +000042
43namespace webrtc {
henrike@webrtc.org28e20752013-07-10 00:45:36 +000044
deadbeefeb459812015-12-15 19:24:43 -080045class MediaStreamObserver;
deadbeefab9b2d12015-10-14 11:33:11 -070046class RemoteMediaStreamFactory;
47
henrike@webrtc.org28e20752013-07-10 00:45:36 +000048typedef std::vector<PortAllocatorFactoryInterface::StunConfiguration>
49 StunConfigurations;
50typedef std::vector<PortAllocatorFactoryInterface::TurnConfiguration>
51 TurnConfigurations;
52
deadbeefab9b2d12015-10-14 11:33:11 -070053// Populates |session_options| from |rtc_options|, and returns true if options
54// are valid.
deadbeefab9b2d12015-10-14 11:33:11 -070055bool ConvertRtcOptionsForOffer(
56 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options,
57 cricket::MediaSessionOptions* session_options);
58
59// Populates |session_options| from |constraints|, and returns true if all
60// mandatory constraints are satisfied.
61bool ParseConstraintsForAnswer(const MediaConstraintsInterface* constraints,
62 cricket::MediaSessionOptions* session_options);
63
deadbeef0a6c4ca2015-10-06 11:38:28 -070064// Parses the URLs for each server in |servers| to build |stun_config| and
65// |turn_config|.
66bool ParseIceServers(const PeerConnectionInterface::IceServers& servers,
67 StunConfigurations* stun_config,
68 TurnConfigurations* turn_config);
69
deadbeef70ab1a12015-09-28 16:53:55 -070070// PeerConnection implements the PeerConnectionInterface interface.
deadbeefab9b2d12015-10-14 11:33:11 -070071// It uses WebRtcSession to implement the PeerConnection functionality.
henrike@webrtc.org28e20752013-07-10 00:45:36 +000072class PeerConnection : public PeerConnectionInterface,
henrike@webrtc.org28e20752013-07-10 00:45:36 +000073 public IceObserver,
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +000074 public rtc::MessageHandler,
henrike@webrtc.org28e20752013-07-10 00:45:36 +000075 public sigslot::has_slots<> {
76 public:
77 explicit PeerConnection(PeerConnectionFactory* factory);
78
deadbeef653b8e02015-11-11 12:55:10 -080079 // TODO(deadbeef): Remove this overload of Initialize once everyone is moved
80 // to the new version.
buildbot@webrtc.org41451d42014-05-03 05:39:45 +000081 bool Initialize(
82 const PeerConnectionInterface::RTCConfiguration& configuration,
83 const MediaConstraintsInterface* constraints,
84 PortAllocatorFactoryInterface* allocator_factory,
Henrik Boström5e56c592015-08-11 10:33:13 +020085 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
buildbot@webrtc.org41451d42014-05-03 05:39:45 +000086 PeerConnectionObserver* observer);
deadbeef653b8e02015-11-11 12:55:10 -080087
88 bool Initialize(
89 const PeerConnectionInterface::RTCConfiguration& configuration,
90 const MediaConstraintsInterface* constraints,
91 rtc::scoped_ptr<cricket::PortAllocator> allocator,
92 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store,
93 PeerConnectionObserver* observer);
94
deadbeefa67696b2015-09-29 11:56:26 -070095 rtc::scoped_refptr<StreamCollectionInterface> local_streams() override;
96 rtc::scoped_refptr<StreamCollectionInterface> remote_streams() override;
97 bool AddStream(MediaStreamInterface* local_stream) override;
98 void RemoveStream(MediaStreamInterface* local_stream) override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +000099
deadbeefab9b2d12015-10-14 11:33:11 -0700100 virtual WebRtcSession* session() { return session_.get(); }
101
deadbeefa67696b2015-09-29 11:56:26 -0700102 rtc::scoped_refptr<DtmfSenderInterface> CreateDtmfSender(
103 AudioTrackInterface* track) override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000104
deadbeeffac06552015-11-25 11:26:01 -0800105 rtc::scoped_refptr<RtpSenderInterface> CreateSender(
deadbeefbd7d8f72015-12-18 16:58:44 -0800106 const std::string& kind,
107 const std::string& stream_id) override;
deadbeeffac06552015-11-25 11:26:01 -0800108
deadbeef70ab1a12015-09-28 16:53:55 -0700109 std::vector<rtc::scoped_refptr<RtpSenderInterface>> GetSenders()
110 const override;
111 std::vector<rtc::scoped_refptr<RtpReceiverInterface>> GetReceivers()
112 const override;
113
deadbeefa67696b2015-09-29 11:56:26 -0700114 rtc::scoped_refptr<DataChannelInterface> CreateDataChannel(
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000115 const std::string& label,
deadbeefa67696b2015-09-29 11:56:26 -0700116 const DataChannelInit* config) override;
117 bool GetStats(StatsObserver* observer,
118 webrtc::MediaStreamTrackInterface* track,
119 StatsOutputLevel level) override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000120
deadbeefa67696b2015-09-29 11:56:26 -0700121 SignalingState signaling_state() override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000122
123 // TODO(bemasc): Remove ice_state() when callers are removed.
deadbeefa67696b2015-09-29 11:56:26 -0700124 IceState ice_state() override;
125 IceConnectionState ice_connection_state() override;
126 IceGatheringState ice_gathering_state() override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000127
deadbeefa67696b2015-09-29 11:56:26 -0700128 const SessionDescriptionInterface* local_description() const override;
129 const SessionDescriptionInterface* remote_description() const override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000130
131 // JSEP01
deadbeefa67696b2015-09-29 11:56:26 -0700132 void CreateOffer(CreateSessionDescriptionObserver* observer,
133 const MediaConstraintsInterface* constraints) override;
134 void CreateOffer(CreateSessionDescriptionObserver* observer,
135 const RTCOfferAnswerOptions& options) override;
136 void CreateAnswer(CreateSessionDescriptionObserver* observer,
137 const MediaConstraintsInterface* constraints) override;
138 void SetLocalDescription(SetSessionDescriptionObserver* observer,
139 SessionDescriptionInterface* desc) override;
140 void SetRemoteDescription(SetSessionDescriptionObserver* observer,
141 SessionDescriptionInterface* desc) override;
142 bool SetConfiguration(
143 const PeerConnectionInterface::RTCConfiguration& config) override;
144 bool AddIceCandidate(const IceCandidateInterface* candidate) override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000145
deadbeefa67696b2015-09-29 11:56:26 -0700146 void RegisterUMAObserver(UMAObserver* observer) override;
buildbot@webrtc.org1567b8c2014-05-08 19:54:16 +0000147
deadbeefa67696b2015-09-29 11:56:26 -0700148 void Close() override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000149
deadbeefab9b2d12015-10-14 11:33:11 -0700150 // Virtual for unit tests.
151 virtual const std::vector<rtc::scoped_refptr<DataChannel>>&
152 sctp_data_channels() const {
153 return sctp_data_channels_;
154 };
155
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000156 protected:
deadbeefa67696b2015-09-29 11:56:26 -0700157 ~PeerConnection() override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000158
159 private:
deadbeefab9b2d12015-10-14 11:33:11 -0700160 struct TrackInfo {
161 TrackInfo() : ssrc(0) {}
162 TrackInfo(const std::string& stream_label,
163 const std::string track_id,
164 uint32_t ssrc)
165 : stream_label(stream_label), track_id(track_id), ssrc(ssrc) {}
deadbeefbda7e0b2015-12-08 17:13:40 -0800166 bool operator==(const TrackInfo& other) {
167 return this->stream_label == other.stream_label &&
168 this->track_id == other.track_id && this->ssrc == other.ssrc;
169 }
deadbeefab9b2d12015-10-14 11:33:11 -0700170 std::string stream_label;
171 std::string track_id;
172 uint32_t ssrc;
173 };
174 typedef std::vector<TrackInfo> TrackInfos;
175
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000176 // Implements MessageHandler.
deadbeefa67696b2015-09-29 11:56:26 -0700177 void OnMessage(rtc::Message* msg) override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000178
deadbeefab9b2d12015-10-14 11:33:11 -0700179 void CreateAudioReceiver(MediaStreamInterface* stream,
180 AudioTrackInterface* audio_track,
181 uint32_t ssrc);
182 void CreateVideoReceiver(MediaStreamInterface* stream,
183 VideoTrackInterface* video_track,
184 uint32_t ssrc);
185 void DestroyAudioReceiver(MediaStreamInterface* stream,
186 AudioTrackInterface* audio_track);
187 void DestroyVideoReceiver(MediaStreamInterface* stream,
188 VideoTrackInterface* video_track);
deadbeefab9b2d12015-10-14 11:33:11 -0700189 void DestroyAudioSender(MediaStreamInterface* stream,
190 AudioTrackInterface* audio_track,
191 uint32_t ssrc);
192 void DestroyVideoSender(MediaStreamInterface* stream,
193 VideoTrackInterface* video_track);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000194
195 // Implements IceObserver
Peter Thatcher54360512015-07-08 11:08:35 -0700196 void OnIceConnectionChange(IceConnectionState new_state) override;
197 void OnIceGatheringChange(IceGatheringState new_state) override;
198 void OnIceCandidate(const IceCandidateInterface* candidate) override;
199 void OnIceComplete() override;
200 void OnIceConnectionReceivingChange(bool receiving) override;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000201
202 // Signals from WebRtcSession.
deadbeefd59daf82015-10-14 15:02:44 -0700203 void OnSessionStateChange(WebRtcSession* session, WebRtcSession::State state);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000204 void ChangeSignalingState(SignalingState signaling_state);
205
deadbeefeb459812015-12-15 19:24:43 -0800206 // Signals from MediaStreamObserver.
207 void OnAudioTrackAdded(AudioTrackInterface* track,
208 MediaStreamInterface* stream);
209 void OnAudioTrackRemoved(AudioTrackInterface* track,
210 MediaStreamInterface* stream);
211 void OnVideoTrackAdded(VideoTrackInterface* track,
212 MediaStreamInterface* stream);
213 void OnVideoTrackRemoved(VideoTrackInterface* track,
214 MediaStreamInterface* stream);
215
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000216 rtc::Thread* signaling_thread() const {
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000217 return factory_->signaling_thread();
218 }
219
220 void PostSetSessionDescriptionFailure(SetSessionDescriptionObserver* observer,
221 const std::string& error);
deadbeefab9b2d12015-10-14 11:33:11 -0700222 void PostCreateSessionDescriptionFailure(
223 CreateSessionDescriptionObserver* observer,
224 const std::string& error);
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000225
226 bool IsClosed() const {
227 return signaling_state_ == PeerConnectionInterface::kClosed;
228 }
229
deadbeefab9b2d12015-10-14 11:33:11 -0700230 // Returns a MediaSessionOptions struct with options decided by |options|,
231 // the local MediaStreams and DataChannels.
232 virtual bool GetOptionsForOffer(
233 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options,
234 cricket::MediaSessionOptions* session_options);
235
236 // Returns a MediaSessionOptions struct with options decided by
237 // |constraints|, the local MediaStreams and DataChannels.
238 virtual bool GetOptionsForAnswer(
239 const MediaConstraintsInterface* constraints,
240 cricket::MediaSessionOptions* session_options);
241
deadbeeffaac4972015-11-12 15:33:07 -0800242 // Remove all local and remote tracks of type |media_type|.
243 // Called when a media type is rejected (m-line set to port 0).
244 void RemoveTracks(cricket::MediaType media_type);
245
deadbeefbda7e0b2015-12-08 17:13:40 -0800246 // Makes sure a MediaStreamTrack is created for each StreamParam in |streams|,
247 // and existing MediaStreamTracks are removed if there is no corresponding
248 // StreamParam. If |default_track_needed| is true, a default MediaStreamTrack
249 // is created if it doesn't exist; if false, it's removed if it exists.
250 // |media_type| is the type of the |streams| and can be either audio or video.
deadbeefab9b2d12015-10-14 11:33:11 -0700251 // If a new MediaStream is created it is added to |new_streams|.
252 void UpdateRemoteStreamsList(
253 const std::vector<cricket::StreamParams>& streams,
deadbeefbda7e0b2015-12-08 17:13:40 -0800254 bool default_track_needed,
deadbeefab9b2d12015-10-14 11:33:11 -0700255 cricket::MediaType media_type,
256 StreamCollection* new_streams);
257
258 // Triggered when a remote track has been seen for the first time in a remote
259 // session description. It creates a remote MediaStreamTrackInterface
260 // implementation and triggers CreateAudioReceiver or CreateVideoReceiver.
261 void OnRemoteTrackSeen(const std::string& stream_label,
262 const std::string& track_id,
263 uint32_t ssrc,
264 cricket::MediaType media_type);
265
266 // Triggered when a remote track has been removed from a remote session
267 // description. It removes the remote track with id |track_id| from a remote
268 // MediaStream and triggers DestroyAudioReceiver or DestroyVideoReceiver.
269 void OnRemoteTrackRemoved(const std::string& stream_label,
270 const std::string& track_id,
271 cricket::MediaType media_type);
272
273 // Finds remote MediaStreams without any tracks and removes them from
274 // |remote_streams_| and notifies the observer that the MediaStreams no longer
275 // exist.
276 void UpdateEndedRemoteMediaStreams();
277
deadbeefab9b2d12015-10-14 11:33:11 -0700278 // Set the MediaStreamTrackInterface::TrackState to |kEnded| on all remote
279 // tracks of type |media_type|.
280 void EndRemoteTracks(cricket::MediaType media_type);
281
282 // Loops through the vector of |streams| and finds added and removed
283 // StreamParams since last time this method was called.
284 // For each new or removed StreamParam, OnLocalTrackSeen or
285 // OnLocalTrackRemoved is invoked.
286 void UpdateLocalTracks(const std::vector<cricket::StreamParams>& streams,
287 cricket::MediaType media_type);
288
289 // Triggered when a local track has been seen for the first time in a local
290 // session description.
291 // This method triggers CreateAudioSender or CreateVideoSender if the rtp
292 // streams in the local SessionDescription can be mapped to a MediaStreamTrack
293 // in a MediaStream in |local_streams_|
294 void OnLocalTrackSeen(const std::string& stream_label,
295 const std::string& track_id,
296 uint32_t ssrc,
297 cricket::MediaType media_type);
298
299 // Triggered when a local track has been removed from a local session
300 // description.
301 // This method triggers DestroyAudioSender or DestroyVideoSender if a stream
302 // has been removed from the local SessionDescription and the stream can be
303 // mapped to a MediaStreamTrack in a MediaStream in |local_streams_|.
304 void OnLocalTrackRemoved(const std::string& stream_label,
305 const std::string& track_id,
306 uint32_t ssrc,
307 cricket::MediaType media_type);
308
309 void UpdateLocalRtpDataChannels(const cricket::StreamParamsVec& streams);
310 void UpdateRemoteRtpDataChannels(const cricket::StreamParamsVec& streams);
311 void UpdateClosingRtpDataChannels(
312 const std::vector<std::string>& active_channels,
313 bool is_local_update);
314 void CreateRemoteRtpDataChannel(const std::string& label,
315 uint32_t remote_ssrc);
316
317 // Creates channel and adds it to the collection of DataChannels that will
318 // be offered in a SessionDescription.
319 rtc::scoped_refptr<DataChannel> InternalCreateDataChannel(
320 const std::string& label,
321 const InternalDataChannelInit* config);
322
323 // Checks if any data channel has been added.
324 bool HasDataChannels() const;
325
326 void AllocateSctpSids(rtc::SSLRole role);
327 void OnSctpDataChannelClosed(DataChannel* channel);
328
329 // Notifications from WebRtcSession relating to BaseChannels.
330 void OnVoiceChannelDestroyed();
331 void OnVideoChannelDestroyed();
332 void OnDataChannelCreated();
333 void OnDataChannelDestroyed();
334 // Called when the cricket::DataChannel receives a message indicating that a
335 // webrtc::DataChannel should be opened.
336 void OnDataChannelOpenMessage(const std::string& label,
337 const InternalDataChannelInit& config);
338
deadbeeffac06552015-11-25 11:26:01 -0800339 RtpSenderInterface* FindSenderById(const std::string& id);
340
deadbeef70ab1a12015-09-28 16:53:55 -0700341 std::vector<rtc::scoped_refptr<RtpSenderInterface>>::iterator
342 FindSenderForTrack(MediaStreamTrackInterface* track);
343 std::vector<rtc::scoped_refptr<RtpReceiverInterface>>::iterator
344 FindReceiverForTrack(MediaStreamTrackInterface* track);
345
deadbeefab9b2d12015-10-14 11:33:11 -0700346 TrackInfos* GetRemoteTracks(cricket::MediaType media_type);
347 TrackInfos* GetLocalTracks(cricket::MediaType media_type);
348 const TrackInfo* FindTrackInfo(const TrackInfos& infos,
349 const std::string& stream_label,
350 const std::string track_id) const;
351
352 // Returns the specified SCTP DataChannel in sctp_data_channels_,
353 // or nullptr if not found.
354 DataChannel* FindDataChannelBySid(int sid) const;
355
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000356 // Storing the factory as a scoped reference pointer ensures that the memory
357 // in the PeerConnectionFactoryImpl remains available as long as the
358 // PeerConnection is running. It is passed to PeerConnection as a raw pointer.
359 // However, since the reference counting is done in the
deadbeefab9b2d12015-10-14 11:33:11 -0700360 // PeerConnectionFactoryInterface all instances created using the raw pointer
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000361 // will refer to the same reference count.
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000362 rtc::scoped_refptr<PeerConnectionFactory> factory_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000363 PeerConnectionObserver* observer_;
buildbot@webrtc.org1567b8c2014-05-08 19:54:16 +0000364 UMAObserver* uma_observer_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000365 SignalingState signaling_state_;
366 // TODO(bemasc): Remove ice_state_.
367 IceState ice_state_;
368 IceConnectionState ice_connection_state_;
369 IceGatheringState ice_gathering_state_;
370
buildbot@webrtc.orgd4e598d2014-07-29 17:36:52 +0000371 rtc::scoped_ptr<cricket::PortAllocator> port_allocator_;
stefanc1aeaf02015-10-15 07:26:07 -0700372 rtc::scoped_ptr<MediaControllerInterface> media_controller_;
deadbeefab9b2d12015-10-14 11:33:11 -0700373
374 // Streams added via AddStream.
375 rtc::scoped_refptr<StreamCollection> local_streams_;
376 // Streams created as a result of SetRemoteDescription.
377 rtc::scoped_refptr<StreamCollection> remote_streams_;
378
deadbeefeb459812015-12-15 19:24:43 -0800379 std::vector<rtc::scoped_ptr<MediaStreamObserver>> stream_observers_;
380
deadbeefab9b2d12015-10-14 11:33:11 -0700381 // These lists store track info seen in local/remote descriptions.
382 TrackInfos remote_audio_tracks_;
383 TrackInfos remote_video_tracks_;
384 TrackInfos local_audio_tracks_;
385 TrackInfos local_video_tracks_;
386
387 SctpSidAllocator sid_allocator_;
388 // label -> DataChannel
389 std::map<std::string, rtc::scoped_refptr<DataChannel>> rtp_data_channels_;
390 std::vector<rtc::scoped_refptr<DataChannel>> sctp_data_channels_;
deadbeefbd292462015-12-14 18:15:29 -0800391 std::vector<rtc::scoped_refptr<DataChannel>> sctp_data_channels_to_free_;
deadbeefab9b2d12015-10-14 11:33:11 -0700392
deadbeefbda7e0b2015-12-08 17:13:40 -0800393 bool remote_peer_supports_msid_ = false;
deadbeefab9b2d12015-10-14 11:33:11 -0700394 rtc::scoped_ptr<RemoteMediaStreamFactory> remote_stream_factory_;
deadbeef70ab1a12015-09-28 16:53:55 -0700395
396 std::vector<rtc::scoped_refptr<RtpSenderInterface>> senders_;
397 std::vector<rtc::scoped_refptr<RtpReceiverInterface>> receivers_;
deadbeefab9b2d12015-10-14 11:33:11 -0700398
399 // The session_ scoped_ptr is declared at the bottom of PeerConnection
400 // because its destruction fires signals (such as VoiceChannelDestroyed)
401 // which will trigger some final actions in PeerConnection...
402 rtc::scoped_ptr<WebRtcSession> session_;
403 // ... But stats_ depends on session_ so it should be destroyed even earlier.
404 rtc::scoped_ptr<StatsCollector> stats_;
henrike@webrtc.org28e20752013-07-10 00:45:36 +0000405};
406
407} // namespace webrtc
408
409#endif // TALK_APP_WEBRTC_PEERCONNECTION_H_