OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_API_PEERCONNECTION_H_ | 11 #ifndef WEBRTC_API_PEERCONNECTION_H_ |
12 #define WEBRTC_API_PEERCONNECTION_H_ | 12 #define WEBRTC_API_PEERCONNECTION_H_ |
13 | 13 |
14 #include <string> | 14 #include <string> |
15 #include <map> | 15 #include <map> |
| 16 #include <memory> |
16 #include <vector> | 17 #include <vector> |
17 | 18 |
18 #include "webrtc/api/dtlsidentitystore.h" | 19 #include "webrtc/api/dtlsidentitystore.h" |
19 #include "webrtc/api/peerconnectionfactory.h" | 20 #include "webrtc/api/peerconnectionfactory.h" |
20 #include "webrtc/api/peerconnectioninterface.h" | 21 #include "webrtc/api/peerconnectioninterface.h" |
21 #include "webrtc/api/rtpreceiverinterface.h" | 22 #include "webrtc/api/rtpreceiverinterface.h" |
22 #include "webrtc/api/rtpsenderinterface.h" | 23 #include "webrtc/api/rtpsenderinterface.h" |
23 #include "webrtc/api/statscollector.h" | 24 #include "webrtc/api/statscollector.h" |
24 #include "webrtc/api/streamcollection.h" | 25 #include "webrtc/api/streamcollection.h" |
25 #include "webrtc/api/webrtcsession.h" | 26 #include "webrtc/api/webrtcsession.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 // It uses WebRtcSession to implement the PeerConnection functionality. | 63 // It uses WebRtcSession to implement the PeerConnection functionality. |
63 class PeerConnection : public PeerConnectionInterface, | 64 class PeerConnection : public PeerConnectionInterface, |
64 public IceObserver, | 65 public IceObserver, |
65 public rtc::MessageHandler, | 66 public rtc::MessageHandler, |
66 public sigslot::has_slots<> { | 67 public sigslot::has_slots<> { |
67 public: | 68 public: |
68 explicit PeerConnection(PeerConnectionFactory* factory); | 69 explicit PeerConnection(PeerConnectionFactory* factory); |
69 | 70 |
70 bool Initialize( | 71 bool Initialize( |
71 const PeerConnectionInterface::RTCConfiguration& configuration, | 72 const PeerConnectionInterface::RTCConfiguration& configuration, |
72 rtc::scoped_ptr<cricket::PortAllocator> allocator, | 73 std::unique_ptr<cricket::PortAllocator> allocator, |
73 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, | 74 std::unique_ptr<DtlsIdentityStoreInterface> dtls_identity_store, |
74 PeerConnectionObserver* observer); | 75 PeerConnectionObserver* observer); |
75 | 76 |
76 rtc::scoped_refptr<StreamCollectionInterface> local_streams() override; | 77 rtc::scoped_refptr<StreamCollectionInterface> local_streams() override; |
77 rtc::scoped_refptr<StreamCollectionInterface> remote_streams() override; | 78 rtc::scoped_refptr<StreamCollectionInterface> remote_streams() override; |
78 bool AddStream(MediaStreamInterface* local_stream) override; | 79 bool AddStream(MediaStreamInterface* local_stream) override; |
79 void RemoveStream(MediaStreamInterface* local_stream) override; | 80 void RemoveStream(MediaStreamInterface* local_stream) override; |
80 | 81 |
81 rtc::scoped_refptr<RtpSenderInterface> AddTrack( | 82 rtc::scoped_refptr<RtpSenderInterface> AddTrack( |
82 MediaStreamTrackInterface* track, | 83 MediaStreamTrackInterface* track, |
83 std::vector<MediaStreamInterface*> streams) override; | 84 std::vector<MediaStreamInterface*> streams) override; |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 // will refer to the same reference count. | 359 // will refer to the same reference count. |
359 rtc::scoped_refptr<PeerConnectionFactory> factory_; | 360 rtc::scoped_refptr<PeerConnectionFactory> factory_; |
360 PeerConnectionObserver* observer_; | 361 PeerConnectionObserver* observer_; |
361 UMAObserver* uma_observer_; | 362 UMAObserver* uma_observer_; |
362 SignalingState signaling_state_; | 363 SignalingState signaling_state_; |
363 // TODO(bemasc): Remove ice_state_. | 364 // TODO(bemasc): Remove ice_state_. |
364 IceState ice_state_; | 365 IceState ice_state_; |
365 IceConnectionState ice_connection_state_; | 366 IceConnectionState ice_connection_state_; |
366 IceGatheringState ice_gathering_state_; | 367 IceGatheringState ice_gathering_state_; |
367 | 368 |
368 rtc::scoped_ptr<cricket::PortAllocator> port_allocator_; | 369 std::unique_ptr<cricket::PortAllocator> port_allocator_; |
369 rtc::scoped_ptr<MediaControllerInterface> media_controller_; | 370 std::unique_ptr<MediaControllerInterface> media_controller_; |
370 | 371 |
371 // Streams added via AddStream. | 372 // Streams added via AddStream. |
372 rtc::scoped_refptr<StreamCollection> local_streams_; | 373 rtc::scoped_refptr<StreamCollection> local_streams_; |
373 // Streams created as a result of SetRemoteDescription. | 374 // Streams created as a result of SetRemoteDescription. |
374 rtc::scoped_refptr<StreamCollection> remote_streams_; | 375 rtc::scoped_refptr<StreamCollection> remote_streams_; |
375 | 376 |
376 std::vector<rtc::scoped_ptr<MediaStreamObserver>> stream_observers_; | 377 std::vector<std::unique_ptr<MediaStreamObserver>> stream_observers_; |
377 | 378 |
378 // These lists store track info seen in local/remote descriptions. | 379 // These lists store track info seen in local/remote descriptions. |
379 TrackInfos remote_audio_tracks_; | 380 TrackInfos remote_audio_tracks_; |
380 TrackInfos remote_video_tracks_; | 381 TrackInfos remote_video_tracks_; |
381 TrackInfos local_audio_tracks_; | 382 TrackInfos local_audio_tracks_; |
382 TrackInfos local_video_tracks_; | 383 TrackInfos local_video_tracks_; |
383 | 384 |
384 SctpSidAllocator sid_allocator_; | 385 SctpSidAllocator sid_allocator_; |
385 // label -> DataChannel | 386 // label -> DataChannel |
386 std::map<std::string, rtc::scoped_refptr<DataChannel>> rtp_data_channels_; | 387 std::map<std::string, rtc::scoped_refptr<DataChannel>> rtp_data_channels_; |
387 std::vector<rtc::scoped_refptr<DataChannel>> sctp_data_channels_; | 388 std::vector<rtc::scoped_refptr<DataChannel>> sctp_data_channels_; |
388 std::vector<rtc::scoped_refptr<DataChannel>> sctp_data_channels_to_free_; | 389 std::vector<rtc::scoped_refptr<DataChannel>> sctp_data_channels_to_free_; |
389 | 390 |
390 bool remote_peer_supports_msid_ = false; | 391 bool remote_peer_supports_msid_ = false; |
391 | 392 |
392 std::vector<rtc::scoped_refptr<RtpSenderInterface>> senders_; | 393 std::vector<rtc::scoped_refptr<RtpSenderInterface>> senders_; |
393 std::vector<rtc::scoped_refptr<RtpReceiverInterface>> receivers_; | 394 std::vector<rtc::scoped_refptr<RtpReceiverInterface>> receivers_; |
394 | 395 |
395 // The session_ scoped_ptr is declared at the bottom of PeerConnection | 396 // The session_ unique_ptr is declared at the bottom of PeerConnection |
396 // because its destruction fires signals (such as VoiceChannelDestroyed) | 397 // because its destruction fires signals (such as VoiceChannelDestroyed) |
397 // which will trigger some final actions in PeerConnection... | 398 // which will trigger some final actions in PeerConnection... |
398 rtc::scoped_ptr<WebRtcSession> session_; | 399 std::unique_ptr<WebRtcSession> session_; |
399 // ... But stats_ depends on session_ so it should be destroyed even earlier. | 400 // ... But stats_ depends on session_ so it should be destroyed even earlier. |
400 rtc::scoped_ptr<StatsCollector> stats_; | 401 std::unique_ptr<StatsCollector> stats_; |
401 }; | 402 }; |
402 | 403 |
403 } // namespace webrtc | 404 } // namespace webrtc |
404 | 405 |
405 #endif // WEBRTC_API_PEERCONNECTION_H_ | 406 #endif // WEBRTC_API_PEERCONNECTION_H_ |
OLD | NEW |