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