| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 // It uses WebRtcSession to implement the PeerConnection functionality. | 52 // It uses WebRtcSession to implement the PeerConnection functionality. |
| 53 class PeerConnection : public PeerConnectionInterface, | 53 class PeerConnection : public PeerConnectionInterface, |
| 54 public IceObserver, | 54 public IceObserver, |
| 55 public rtc::MessageHandler, | 55 public rtc::MessageHandler, |
| 56 public sigslot::has_slots<> { | 56 public sigslot::has_slots<> { |
| 57 public: | 57 public: |
| 58 explicit PeerConnection(PeerConnectionFactory* factory); | 58 explicit PeerConnection(PeerConnectionFactory* factory); |
| 59 | 59 |
| 60 bool Initialize( | 60 bool Initialize( |
| 61 const PeerConnectionInterface::RTCConfiguration& configuration, | 61 const PeerConnectionInterface::RTCConfiguration& configuration, |
| 62 const MediaConstraintsInterface* constraints, | |
| 63 rtc::scoped_ptr<cricket::PortAllocator> allocator, | 62 rtc::scoped_ptr<cricket::PortAllocator> allocator, |
| 64 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, | 63 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, |
| 65 PeerConnectionObserver* observer); | 64 PeerConnectionObserver* observer); |
| 66 | 65 |
| 67 rtc::scoped_refptr<StreamCollectionInterface> local_streams() override; | 66 rtc::scoped_refptr<StreamCollectionInterface> local_streams() override; |
| 68 rtc::scoped_refptr<StreamCollectionInterface> remote_streams() override; | 67 rtc::scoped_refptr<StreamCollectionInterface> remote_streams() override; |
| 69 bool AddStream(MediaStreamInterface* local_stream) override; | 68 bool AddStream(MediaStreamInterface* local_stream) override; |
| 70 void RemoveStream(MediaStreamInterface* local_stream) override; | 69 void RemoveStream(MediaStreamInterface* local_stream) override; |
| 71 | 70 |
| 72 rtc::scoped_refptr<RtpSenderInterface> AddTrack( | 71 rtc::scoped_refptr<RtpSenderInterface> AddTrack( |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 const SessionDescriptionInterface* local_description() const override; | 104 const SessionDescriptionInterface* local_description() const override; |
| 106 const SessionDescriptionInterface* remote_description() const override; | 105 const SessionDescriptionInterface* remote_description() const override; |
| 107 | 106 |
| 108 // JSEP01 | 107 // JSEP01 |
| 109 void CreateOffer(CreateSessionDescriptionObserver* observer, | 108 void CreateOffer(CreateSessionDescriptionObserver* observer, |
| 110 const MediaConstraintsInterface* constraints) override; | 109 const MediaConstraintsInterface* constraints) override; |
| 111 void CreateOffer(CreateSessionDescriptionObserver* observer, | 110 void CreateOffer(CreateSessionDescriptionObserver* observer, |
| 112 const RTCOfferAnswerOptions& options) override; | 111 const RTCOfferAnswerOptions& options) override; |
| 113 void CreateAnswer(CreateSessionDescriptionObserver* observer, | 112 void CreateAnswer(CreateSessionDescriptionObserver* observer, |
| 114 const MediaConstraintsInterface* constraints) override; | 113 const MediaConstraintsInterface* constraints) override; |
| 114 void CreateAnswer(CreateSessionDescriptionObserver* observer, |
| 115 const RTCOfferAnswerOptions& options) override; |
| 115 void SetLocalDescription(SetSessionDescriptionObserver* observer, | 116 void SetLocalDescription(SetSessionDescriptionObserver* observer, |
| 116 SessionDescriptionInterface* desc) override; | 117 SessionDescriptionInterface* desc) override; |
| 117 void SetRemoteDescription(SetSessionDescriptionObserver* observer, | 118 void SetRemoteDescription(SetSessionDescriptionObserver* observer, |
| 118 SessionDescriptionInterface* desc) override; | 119 SessionDescriptionInterface* desc) override; |
| 119 bool SetConfiguration( | 120 bool SetConfiguration( |
| 120 const PeerConnectionInterface::RTCConfiguration& config) override; | 121 const PeerConnectionInterface::RTCConfiguration& config) override; |
| 121 bool AddIceCandidate(const IceCandidateInterface* candidate) override; | 122 bool AddIceCandidate(const IceCandidateInterface* candidate) override; |
| 122 | 123 |
| 123 void RegisterUMAObserver(UMAObserver* observer) override; | 124 void RegisterUMAObserver(UMAObserver* observer) override; |
| 124 | 125 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 // the local MediaStreams and DataChannels. | 208 // the local MediaStreams and DataChannels. |
| 208 virtual bool GetOptionsForOffer( | 209 virtual bool GetOptionsForOffer( |
| 209 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options, | 210 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options, |
| 210 cricket::MediaSessionOptions* session_options); | 211 cricket::MediaSessionOptions* session_options); |
| 211 | 212 |
| 212 // Returns a MediaSessionOptions struct with options decided by | 213 // Returns a MediaSessionOptions struct with options decided by |
| 213 // |constraints|, the local MediaStreams and DataChannels. | 214 // |constraints|, the local MediaStreams and DataChannels. |
| 214 virtual bool GetOptionsForAnswer( | 215 virtual bool GetOptionsForAnswer( |
| 215 const MediaConstraintsInterface* constraints, | 216 const MediaConstraintsInterface* constraints, |
| 216 cricket::MediaSessionOptions* session_options); | 217 cricket::MediaSessionOptions* session_options); |
| 218 virtual bool GetOptionsForAnswer( |
| 219 const RTCOfferAnswerOptions& options, |
| 220 cricket::MediaSessionOptions* session_options); |
| 221 |
| 222 // Helper function for options processing. |
| 223 virtual void FinishOptionsForAnswer( |
| 224 cricket::MediaSessionOptions* session_options); |
| 217 | 225 |
| 218 // Remove all local and remote tracks of type |media_type|. | 226 // Remove all local and remote tracks of type |media_type|. |
| 219 // Called when a media type is rejected (m-line set to port 0). | 227 // Called when a media type is rejected (m-line set to port 0). |
| 220 void RemoveTracks(cricket::MediaType media_type); | 228 void RemoveTracks(cricket::MediaType media_type); |
| 221 | 229 |
| 222 // Makes sure a MediaStreamTrack is created for each StreamParam in |streams|, | 230 // Makes sure a MediaStreamTrack is created for each StreamParam in |streams|, |
| 223 // and existing MediaStreamTracks are removed if there is no corresponding | 231 // and existing MediaStreamTracks are removed if there is no corresponding |
| 224 // StreamParam. If |default_track_needed| is true, a default MediaStreamTrack | 232 // StreamParam. If |default_track_needed| is true, a default MediaStreamTrack |
| 225 // is created if it doesn't exist; if false, it's removed if it exists. | 233 // is created if it doesn't exist; if false, it's removed if it exists. |
| 226 // |media_type| is the type of the |streams| and can be either audio or video. | 234 // |media_type| is the type of the |streams| and can be either audio or video. |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 std::vector<rtc::scoped_refptr<RtpReceiverInterface>> receivers_; | 381 std::vector<rtc::scoped_refptr<RtpReceiverInterface>> receivers_; |
| 374 | 382 |
| 375 // The session_ scoped_ptr is declared at the bottom of PeerConnection | 383 // The session_ scoped_ptr is declared at the bottom of PeerConnection |
| 376 // because its destruction fires signals (such as VoiceChannelDestroyed) | 384 // because its destruction fires signals (such as VoiceChannelDestroyed) |
| 377 // which will trigger some final actions in PeerConnection... | 385 // which will trigger some final actions in PeerConnection... |
| 378 rtc::scoped_ptr<WebRtcSession> session_; | 386 rtc::scoped_ptr<WebRtcSession> session_; |
| 379 // ... But stats_ depends on session_ so it should be destroyed even earlier. | 387 // ... But stats_ depends on session_ so it should be destroyed even earlier. |
| 380 rtc::scoped_ptr<StatsCollector> stats_; | 388 rtc::scoped_ptr<StatsCollector> stats_; |
| 381 }; | 389 }; |
| 382 | 390 |
| 391 void CopyConstraintsIntoRtcConfiguration( |
| 392 const MediaConstraintsInterface* constraints, |
| 393 PeerConnectionInterface::RTCConfiguration* configuration); |
| 394 |
| 383 } // namespace webrtc | 395 } // namespace webrtc |
| 384 | 396 |
| 385 #endif // WEBRTC_API_PEERCONNECTION_H_ | 397 #endif // WEBRTC_API_PEERCONNECTION_H_ |
| OLD | NEW |