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 21 matching lines...) Expand all Loading... | |
32 // are valid. | 32 // are valid. |
33 // |session_options|->transport_options map entries must exist in order for | 33 // |session_options|->transport_options map entries must exist in order for |
34 // them to be populated from |rtc_options|. | 34 // them to be populated from |rtc_options|. |
35 bool ConvertRtcOptionsForOffer( | 35 bool ConvertRtcOptionsForOffer( |
36 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options, | 36 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options, |
37 cricket::MediaSessionOptions* session_options); | 37 cricket::MediaSessionOptions* session_options); |
38 | 38 |
39 // Populates |session_options| from |constraints|, and returns true if all | 39 // Populates |session_options| from |constraints|, and returns true if all |
40 // mandatory constraints are satisfied. | 40 // mandatory constraints are satisfied. |
41 // Assumes that |session_options|->transport_options map entries exist. | 41 // Assumes that |session_options|->transport_options map entries exist. |
42 // Deprecated. | |
perkj_webrtc
2016/03/01 08:41:26
Can you please add a todo and explain when this wi
hta-webrtc
2016/03/02 09:33:40
Done. Bug 5617 filed.
| |
42 bool ParseConstraintsForAnswer(const MediaConstraintsInterface* constraints, | 43 bool ParseConstraintsForAnswer(const MediaConstraintsInterface* constraints, |
43 cricket::MediaSessionOptions* session_options); | 44 cricket::MediaSessionOptions* session_options); |
44 | 45 |
45 // Parses the URLs for each server in |servers| to build |stun_servers| and | 46 // Parses the URLs for each server in |servers| to build |stun_servers| and |
46 // |turn_servers|. | 47 // |turn_servers|. |
47 bool ParseIceServers(const PeerConnectionInterface::IceServers& servers, | 48 bool ParseIceServers(const PeerConnectionInterface::IceServers& servers, |
48 cricket::ServerAddresses* stun_servers, | 49 cricket::ServerAddresses* stun_servers, |
49 std::vector<cricket::RelayServerConfig>* turn_servers); | 50 std::vector<cricket::RelayServerConfig>* turn_servers); |
50 | 51 |
51 // PeerConnection implements the PeerConnectionInterface interface. | 52 // PeerConnection implements the PeerConnectionInterface interface. |
52 // It uses WebRtcSession to implement the PeerConnection functionality. | 53 // It uses WebRtcSession to implement the PeerConnection functionality. |
53 class PeerConnection : public PeerConnectionInterface, | 54 class PeerConnection : public PeerConnectionInterface, |
54 public IceObserver, | 55 public IceObserver, |
55 public rtc::MessageHandler, | 56 public rtc::MessageHandler, |
56 public sigslot::has_slots<> { | 57 public sigslot::has_slots<> { |
57 public: | 58 public: |
58 explicit PeerConnection(PeerConnectionFactory* factory); | 59 explicit PeerConnection(PeerConnectionFactory* factory); |
59 | 60 |
60 bool Initialize( | 61 bool Initialize( |
62 const cricket::MediaConfig& media_config, | |
61 const PeerConnectionInterface::RTCConfiguration& configuration, | 63 const PeerConnectionInterface::RTCConfiguration& configuration, |
62 const MediaConstraintsInterface* constraints, | |
63 rtc::scoped_ptr<cricket::PortAllocator> allocator, | 64 rtc::scoped_ptr<cricket::PortAllocator> allocator, |
64 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, | 65 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, |
65 PeerConnectionObserver* observer); | 66 PeerConnectionObserver* observer); |
66 | 67 |
67 rtc::scoped_refptr<StreamCollectionInterface> local_streams() override; | 68 rtc::scoped_refptr<StreamCollectionInterface> local_streams() override; |
68 rtc::scoped_refptr<StreamCollectionInterface> remote_streams() override; | 69 rtc::scoped_refptr<StreamCollectionInterface> remote_streams() override; |
69 bool AddStream(MediaStreamInterface* local_stream) override; | 70 bool AddStream(MediaStreamInterface* local_stream) override; |
70 void RemoveStream(MediaStreamInterface* local_stream) override; | 71 void RemoveStream(MediaStreamInterface* local_stream) override; |
71 | 72 |
72 rtc::scoped_refptr<RtpSenderInterface> AddTrack( | 73 rtc::scoped_refptr<RtpSenderInterface> AddTrack( |
(...skipping 26 matching lines...) Expand all Loading... | |
99 | 100 |
100 // TODO(bemasc): Remove ice_state() when callers are removed. | 101 // TODO(bemasc): Remove ice_state() when callers are removed. |
101 IceState ice_state() override; | 102 IceState ice_state() override; |
102 IceConnectionState ice_connection_state() override; | 103 IceConnectionState ice_connection_state() override; |
103 IceGatheringState ice_gathering_state() override; | 104 IceGatheringState ice_gathering_state() override; |
104 | 105 |
105 const SessionDescriptionInterface* local_description() const override; | 106 const SessionDescriptionInterface* local_description() const override; |
106 const SessionDescriptionInterface* remote_description() const override; | 107 const SessionDescriptionInterface* remote_description() const override; |
107 | 108 |
108 // JSEP01 | 109 // JSEP01 |
110 // Deprecated, use version without constraints. | |
109 void CreateOffer(CreateSessionDescriptionObserver* observer, | 111 void CreateOffer(CreateSessionDescriptionObserver* observer, |
110 const MediaConstraintsInterface* constraints) override; | 112 const MediaConstraintsInterface* constraints) override; |
111 void CreateOffer(CreateSessionDescriptionObserver* observer, | 113 void CreateOffer(CreateSessionDescriptionObserver* observer, |
112 const RTCOfferAnswerOptions& options) override; | 114 const RTCOfferAnswerOptions& options) override; |
115 // Deprecated, use version without constraints. | |
113 void CreateAnswer(CreateSessionDescriptionObserver* observer, | 116 void CreateAnswer(CreateSessionDescriptionObserver* observer, |
114 const MediaConstraintsInterface* constraints) override; | 117 const MediaConstraintsInterface* constraints) override; |
118 void CreateAnswer(CreateSessionDescriptionObserver* observer, | |
119 const RTCOfferAnswerOptions& options) override; | |
115 void SetLocalDescription(SetSessionDescriptionObserver* observer, | 120 void SetLocalDescription(SetSessionDescriptionObserver* observer, |
116 SessionDescriptionInterface* desc) override; | 121 SessionDescriptionInterface* desc) override; |
117 void SetRemoteDescription(SetSessionDescriptionObserver* observer, | 122 void SetRemoteDescription(SetSessionDescriptionObserver* observer, |
118 SessionDescriptionInterface* desc) override; | 123 SessionDescriptionInterface* desc) override; |
119 bool SetConfiguration( | 124 bool SetConfiguration( |
120 const PeerConnectionInterface::RTCConfiguration& config) override; | 125 const PeerConnectionInterface::RTCConfiguration& config) override; |
121 bool AddIceCandidate(const IceCandidateInterface* candidate) override; | 126 bool AddIceCandidate(const IceCandidateInterface* candidate) override; |
122 | 127 |
123 void RegisterUMAObserver(UMAObserver* observer) override; | 128 void RegisterUMAObserver(UMAObserver* observer) override; |
124 | 129 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
204 } | 209 } |
205 | 210 |
206 // Returns a MediaSessionOptions struct with options decided by |options|, | 211 // Returns a MediaSessionOptions struct with options decided by |options|, |
207 // the local MediaStreams and DataChannels. | 212 // the local MediaStreams and DataChannels. |
208 virtual bool GetOptionsForOffer( | 213 virtual bool GetOptionsForOffer( |
209 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options, | 214 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options, |
210 cricket::MediaSessionOptions* session_options); | 215 cricket::MediaSessionOptions* session_options); |
211 | 216 |
212 // Returns a MediaSessionOptions struct with options decided by | 217 // Returns a MediaSessionOptions struct with options decided by |
213 // |constraints|, the local MediaStreams and DataChannels. | 218 // |constraints|, the local MediaStreams and DataChannels. |
219 // Deprecated, use version without constraints. | |
214 virtual bool GetOptionsForAnswer( | 220 virtual bool GetOptionsForAnswer( |
215 const MediaConstraintsInterface* constraints, | 221 const MediaConstraintsInterface* constraints, |
216 cricket::MediaSessionOptions* session_options); | 222 cricket::MediaSessionOptions* session_options); |
223 virtual bool GetOptionsForAnswer( | |
224 const RTCOfferAnswerOptions& options, | |
225 cricket::MediaSessionOptions* session_options); | |
226 | |
227 // Helper function for options processing. | |
228 // Deprecated. | |
229 virtual void FinishOptionsForAnswer( | |
230 cricket::MediaSessionOptions* session_options); | |
217 | 231 |
218 // Remove all local and remote tracks of type |media_type|. | 232 // Remove all local and remote tracks of type |media_type|. |
219 // Called when a media type is rejected (m-line set to port 0). | 233 // Called when a media type is rejected (m-line set to port 0). |
220 void RemoveTracks(cricket::MediaType media_type); | 234 void RemoveTracks(cricket::MediaType media_type); |
221 | 235 |
222 // Makes sure a MediaStreamTrack is created for each StreamParam in |streams|, | 236 // Makes sure a MediaStreamTrack is created for each StreamParam in |streams|, |
223 // and existing MediaStreamTracks are removed if there is no corresponding | 237 // and existing MediaStreamTracks are removed if there is no corresponding |
224 // StreamParam. If |default_track_needed| is true, a default MediaStreamTrack | 238 // 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. | 239 // 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. | 240 // |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_; | 387 std::vector<rtc::scoped_refptr<RtpReceiverInterface>> receivers_; |
374 | 388 |
375 // The session_ scoped_ptr is declared at the bottom of PeerConnection | 389 // The session_ scoped_ptr is declared at the bottom of PeerConnection |
376 // because its destruction fires signals (such as VoiceChannelDestroyed) | 390 // because its destruction fires signals (such as VoiceChannelDestroyed) |
377 // which will trigger some final actions in PeerConnection... | 391 // which will trigger some final actions in PeerConnection... |
378 rtc::scoped_ptr<WebRtcSession> session_; | 392 rtc::scoped_ptr<WebRtcSession> session_; |
379 // ... But stats_ depends on session_ so it should be destroyed even earlier. | 393 // ... But stats_ depends on session_ so it should be destroyed even earlier. |
380 rtc::scoped_ptr<StatsCollector> stats_; | 394 rtc::scoped_ptr<StatsCollector> stats_; |
381 }; | 395 }; |
382 | 396 |
397 // Deprecated. | |
398 void CopyConstraintsIntoRtcConfiguration( | |
399 const MediaConstraintsInterface* constraints, | |
400 PeerConnectionInterface::RTCConfiguration* configuration); | |
401 | |
383 } // namespace webrtc | 402 } // namespace webrtc |
384 | 403 |
385 #endif // WEBRTC_API_PEERCONNECTION_H_ | 404 #endif // WEBRTC_API_PEERCONNECTION_H_ |
OLD | NEW |