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 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 // Deprecated, use version without constraints. | 124 // Deprecated, use version without constraints. |
125 void CreateAnswer(CreateSessionDescriptionObserver* observer, | 125 void CreateAnswer(CreateSessionDescriptionObserver* observer, |
126 const MediaConstraintsInterface* constraints) override; | 126 const MediaConstraintsInterface* constraints) override; |
127 void CreateAnswer(CreateSessionDescriptionObserver* observer, | 127 void CreateAnswer(CreateSessionDescriptionObserver* observer, |
128 const RTCOfferAnswerOptions& options) override; | 128 const RTCOfferAnswerOptions& options) override; |
129 void SetLocalDescription(SetSessionDescriptionObserver* observer, | 129 void SetLocalDescription(SetSessionDescriptionObserver* observer, |
130 SessionDescriptionInterface* desc) override; | 130 SessionDescriptionInterface* desc) override; |
131 void SetRemoteDescription(SetSessionDescriptionObserver* observer, | 131 void SetRemoteDescription(SetSessionDescriptionObserver* observer, |
132 SessionDescriptionInterface* desc) override; | 132 SessionDescriptionInterface* desc) override; |
133 bool SetConfiguration( | 133 bool SetConfiguration( |
134 const PeerConnectionInterface::RTCConfiguration& configuration) override; | 134 const PeerConnectionInterface::RTCConfiguration& config) override; |
135 bool AddIceCandidate(const IceCandidateInterface* candidate) override; | 135 bool AddIceCandidate(const IceCandidateInterface* candidate) override; |
136 bool RemoveIceCandidates( | 136 bool RemoveIceCandidates( |
137 const std::vector<cricket::Candidate>& candidates) override; | 137 const std::vector<cricket::Candidate>& candidates) override; |
138 | 138 |
139 void RegisterUMAObserver(UMAObserver* observer) override; | 139 void RegisterUMAObserver(UMAObserver* observer) override; |
140 | 140 |
141 void Close() override; | 141 void Close() override; |
142 | 142 |
143 // Virtual for unit tests. | 143 // Virtual for unit tests. |
144 virtual const std::vector<rtc::scoped_refptr<DataChannel>>& | 144 virtual const std::vector<rtc::scoped_refptr<DataChannel>>& |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 MediaStreamInterface* stream); | 203 MediaStreamInterface* stream); |
204 void OnVideoTrackAdded(VideoTrackInterface* track, | 204 void OnVideoTrackAdded(VideoTrackInterface* track, |
205 MediaStreamInterface* stream); | 205 MediaStreamInterface* stream); |
206 void OnVideoTrackRemoved(VideoTrackInterface* track, | 206 void OnVideoTrackRemoved(VideoTrackInterface* track, |
207 MediaStreamInterface* stream); | 207 MediaStreamInterface* stream); |
208 | 208 |
209 rtc::Thread* signaling_thread() const { | 209 rtc::Thread* signaling_thread() const { |
210 return factory_->signaling_thread(); | 210 return factory_->signaling_thread(); |
211 } | 211 } |
212 | 212 |
213 rtc::Thread* worker_thread() const { return factory_->worker_thread(); } | |
214 | |
215 void PostSetSessionDescriptionFailure(SetSessionDescriptionObserver* observer, | 213 void PostSetSessionDescriptionFailure(SetSessionDescriptionObserver* observer, |
216 const std::string& error); | 214 const std::string& error); |
217 void PostCreateSessionDescriptionFailure( | 215 void PostCreateSessionDescriptionFailure( |
218 CreateSessionDescriptionObserver* observer, | 216 CreateSessionDescriptionObserver* observer, |
219 const std::string& error); | 217 const std::string& error); |
220 | 218 |
221 bool IsClosed() const { | 219 bool IsClosed() const { |
222 return signaling_state_ == PeerConnectionInterface::kClosed; | 220 return signaling_state_ == PeerConnectionInterface::kClosed; |
223 } | 221 } |
224 | 222 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 TrackInfos* GetRemoteTracks(cricket::MediaType media_type); | 344 TrackInfos* GetRemoteTracks(cricket::MediaType media_type); |
347 TrackInfos* GetLocalTracks(cricket::MediaType media_type); | 345 TrackInfos* GetLocalTracks(cricket::MediaType media_type); |
348 const TrackInfo* FindTrackInfo(const TrackInfos& infos, | 346 const TrackInfo* FindTrackInfo(const TrackInfos& infos, |
349 const std::string& stream_label, | 347 const std::string& stream_label, |
350 const std::string track_id) const; | 348 const std::string track_id) const; |
351 | 349 |
352 // Returns the specified SCTP DataChannel in sctp_data_channels_, | 350 // Returns the specified SCTP DataChannel in sctp_data_channels_, |
353 // or nullptr if not found. | 351 // or nullptr if not found. |
354 DataChannel* FindDataChannelBySid(int sid) const; | 352 DataChannel* FindDataChannelBySid(int sid) const; |
355 | 353 |
356 // Called when first configuring the port allocator. | |
357 bool InitializePortAllocator_w(const RTCConfiguration& configuration); | |
358 // Called when SetConfiguration is called. Only a subset of the configuration | |
359 // is applied. | |
360 bool ReconfigurePortAllocator_w(const RTCConfiguration& configuration); | |
361 | |
362 // Storing the factory as a scoped reference pointer ensures that the memory | 354 // Storing the factory as a scoped reference pointer ensures that the memory |
363 // in the PeerConnectionFactoryImpl remains available as long as the | 355 // in the PeerConnectionFactoryImpl remains available as long as the |
364 // PeerConnection is running. It is passed to PeerConnection as a raw pointer. | 356 // PeerConnection is running. It is passed to PeerConnection as a raw pointer. |
365 // However, since the reference counting is done in the | 357 // However, since the reference counting is done in the |
366 // PeerConnectionFactoryInterface all instances created using the raw pointer | 358 // PeerConnectionFactoryInterface all instances created using the raw pointer |
367 // will refer to the same reference count. | 359 // will refer to the same reference count. |
368 rtc::scoped_refptr<PeerConnectionFactory> factory_; | 360 rtc::scoped_refptr<PeerConnectionFactory> factory_; |
369 PeerConnectionObserver* observer_; | 361 PeerConnectionObserver* observer_; |
370 UMAObserver* uma_observer_; | 362 UMAObserver* uma_observer_; |
371 SignalingState signaling_state_; | 363 SignalingState signaling_state_; |
(...skipping 26 matching lines...) Expand all Loading... |
398 // label -> DataChannel | 390 // label -> DataChannel |
399 std::map<std::string, rtc::scoped_refptr<DataChannel>> rtp_data_channels_; | 391 std::map<std::string, rtc::scoped_refptr<DataChannel>> rtp_data_channels_; |
400 std::vector<rtc::scoped_refptr<DataChannel>> sctp_data_channels_; | 392 std::vector<rtc::scoped_refptr<DataChannel>> sctp_data_channels_; |
401 std::vector<rtc::scoped_refptr<DataChannel>> sctp_data_channels_to_free_; | 393 std::vector<rtc::scoped_refptr<DataChannel>> sctp_data_channels_to_free_; |
402 | 394 |
403 bool remote_peer_supports_msid_ = false; | 395 bool remote_peer_supports_msid_ = false; |
404 | 396 |
405 std::vector<rtc::scoped_refptr<RtpSenderInterface>> senders_; | 397 std::vector<rtc::scoped_refptr<RtpSenderInterface>> senders_; |
406 std::vector<rtc::scoped_refptr<RtpReceiverInterface>> receivers_; | 398 std::vector<rtc::scoped_refptr<RtpReceiverInterface>> receivers_; |
407 | 399 |
| 400 // The session_ unique_ptr is declared at the bottom of PeerConnection |
| 401 // because its destruction fires signals (such as VoiceChannelDestroyed) |
| 402 // which will trigger some final actions in PeerConnection... |
408 std::unique_ptr<WebRtcSession> session_; | 403 std::unique_ptr<WebRtcSession> session_; |
| 404 // ... But stats_ depends on session_ so it should be destroyed even earlier. |
409 std::unique_ptr<StatsCollector> stats_; | 405 std::unique_ptr<StatsCollector> stats_; |
410 }; | 406 }; |
411 | 407 |
412 } // namespace webrtc | 408 } // namespace webrtc |
413 | 409 |
414 #endif // WEBRTC_API_PEERCONNECTION_H_ | 410 #endif // WEBRTC_API_PEERCONNECTION_H_ |
OLD | NEW |