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. Will be removed once callers that use constraints are gone. |
| 43 // TODO(hta): Remove when callers are gone. |
| 44 // https://bugs.chromium.org/p/webrtc/issues/detail?id=5617 |
42 bool ParseConstraintsForAnswer(const MediaConstraintsInterface* constraints, | 45 bool ParseConstraintsForAnswer(const MediaConstraintsInterface* constraints, |
43 cricket::MediaSessionOptions* session_options); | 46 cricket::MediaSessionOptions* session_options); |
44 | 47 |
45 // Parses the URLs for each server in |servers| to build |stun_servers| and | 48 // Parses the URLs for each server in |servers| to build |stun_servers| and |
46 // |turn_servers|. | 49 // |turn_servers|. |
47 bool ParseIceServers(const PeerConnectionInterface::IceServers& servers, | 50 bool ParseIceServers(const PeerConnectionInterface::IceServers& servers, |
48 cricket::ServerAddresses* stun_servers, | 51 cricket::ServerAddresses* stun_servers, |
49 std::vector<cricket::RelayServerConfig>* turn_servers); | 52 std::vector<cricket::RelayServerConfig>* turn_servers); |
50 | 53 |
51 // PeerConnection implements the PeerConnectionInterface interface. | 54 // PeerConnection implements the PeerConnectionInterface interface. |
52 // It uses WebRtcSession to implement the PeerConnection functionality. | 55 // It uses WebRtcSession to implement the PeerConnection functionality. |
53 class PeerConnection : public PeerConnectionInterface, | 56 class PeerConnection : public PeerConnectionInterface, |
54 public IceObserver, | 57 public IceObserver, |
55 public rtc::MessageHandler, | 58 public rtc::MessageHandler, |
56 public sigslot::has_slots<> { | 59 public sigslot::has_slots<> { |
57 public: | 60 public: |
58 explicit PeerConnection(PeerConnectionFactory* factory); | 61 explicit PeerConnection(PeerConnectionFactory* factory); |
59 | 62 |
60 bool Initialize( | 63 bool Initialize( |
| 64 const cricket::MediaConfig& media_config, |
61 const PeerConnectionInterface::RTCConfiguration& configuration, | 65 const PeerConnectionInterface::RTCConfiguration& configuration, |
62 const MediaConstraintsInterface* constraints, | |
63 rtc::scoped_ptr<cricket::PortAllocator> allocator, | 66 rtc::scoped_ptr<cricket::PortAllocator> allocator, |
64 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, | 67 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, |
65 PeerConnectionObserver* observer); | 68 PeerConnectionObserver* observer); |
66 | 69 |
67 rtc::scoped_refptr<StreamCollectionInterface> local_streams() override; | 70 rtc::scoped_refptr<StreamCollectionInterface> local_streams() override; |
68 rtc::scoped_refptr<StreamCollectionInterface> remote_streams() override; | 71 rtc::scoped_refptr<StreamCollectionInterface> remote_streams() override; |
69 bool AddStream(MediaStreamInterface* local_stream) override; | 72 bool AddStream(MediaStreamInterface* local_stream) override; |
70 void RemoveStream(MediaStreamInterface* local_stream) override; | 73 void RemoveStream(MediaStreamInterface* local_stream) override; |
71 | 74 |
72 rtc::scoped_refptr<RtpSenderInterface> AddTrack( | 75 rtc::scoped_refptr<RtpSenderInterface> AddTrack( |
(...skipping 26 matching lines...) Expand all Loading... |
99 | 102 |
100 // TODO(bemasc): Remove ice_state() when callers are removed. | 103 // TODO(bemasc): Remove ice_state() when callers are removed. |
101 IceState ice_state() override; | 104 IceState ice_state() override; |
102 IceConnectionState ice_connection_state() override; | 105 IceConnectionState ice_connection_state() override; |
103 IceGatheringState ice_gathering_state() override; | 106 IceGatheringState ice_gathering_state() override; |
104 | 107 |
105 const SessionDescriptionInterface* local_description() const override; | 108 const SessionDescriptionInterface* local_description() const override; |
106 const SessionDescriptionInterface* remote_description() const override; | 109 const SessionDescriptionInterface* remote_description() const override; |
107 | 110 |
108 // JSEP01 | 111 // JSEP01 |
| 112 // Deprecated, use version without constraints. |
109 void CreateOffer(CreateSessionDescriptionObserver* observer, | 113 void CreateOffer(CreateSessionDescriptionObserver* observer, |
110 const MediaConstraintsInterface* constraints) override; | 114 const MediaConstraintsInterface* constraints) override; |
111 void CreateOffer(CreateSessionDescriptionObserver* observer, | 115 void CreateOffer(CreateSessionDescriptionObserver* observer, |
112 const RTCOfferAnswerOptions& options) override; | 116 const RTCOfferAnswerOptions& options) override; |
| 117 // Deprecated, use version without constraints. |
113 void CreateAnswer(CreateSessionDescriptionObserver* observer, | 118 void CreateAnswer(CreateSessionDescriptionObserver* observer, |
114 const MediaConstraintsInterface* constraints) override; | 119 const MediaConstraintsInterface* constraints) override; |
| 120 void CreateAnswer(CreateSessionDescriptionObserver* observer, |
| 121 const RTCOfferAnswerOptions& options) override; |
115 void SetLocalDescription(SetSessionDescriptionObserver* observer, | 122 void SetLocalDescription(SetSessionDescriptionObserver* observer, |
116 SessionDescriptionInterface* desc) override; | 123 SessionDescriptionInterface* desc) override; |
117 void SetRemoteDescription(SetSessionDescriptionObserver* observer, | 124 void SetRemoteDescription(SetSessionDescriptionObserver* observer, |
118 SessionDescriptionInterface* desc) override; | 125 SessionDescriptionInterface* desc) override; |
119 bool SetConfiguration( | 126 bool SetConfiguration( |
120 const PeerConnectionInterface::RTCConfiguration& config) override; | 127 const PeerConnectionInterface::RTCConfiguration& config) override; |
121 bool AddIceCandidate(const IceCandidateInterface* candidate) override; | 128 bool AddIceCandidate(const IceCandidateInterface* candidate) override; |
122 | 129 |
123 void RegisterUMAObserver(UMAObserver* observer) override; | 130 void RegisterUMAObserver(UMAObserver* observer) override; |
124 | 131 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 } | 211 } |
205 | 212 |
206 // Returns a MediaSessionOptions struct with options decided by |options|, | 213 // Returns a MediaSessionOptions struct with options decided by |options|, |
207 // the local MediaStreams and DataChannels. | 214 // the local MediaStreams and DataChannels. |
208 virtual bool GetOptionsForOffer( | 215 virtual bool GetOptionsForOffer( |
209 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options, | 216 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options, |
210 cricket::MediaSessionOptions* session_options); | 217 cricket::MediaSessionOptions* session_options); |
211 | 218 |
212 // Returns a MediaSessionOptions struct with options decided by | 219 // Returns a MediaSessionOptions struct with options decided by |
213 // |constraints|, the local MediaStreams and DataChannels. | 220 // |constraints|, the local MediaStreams and DataChannels. |
| 221 // Deprecated, use version without constraints. |
214 virtual bool GetOptionsForAnswer( | 222 virtual bool GetOptionsForAnswer( |
215 const MediaConstraintsInterface* constraints, | 223 const MediaConstraintsInterface* constraints, |
216 cricket::MediaSessionOptions* session_options); | 224 cricket::MediaSessionOptions* session_options); |
| 225 virtual bool GetOptionsForAnswer( |
| 226 const RTCOfferAnswerOptions& options, |
| 227 cricket::MediaSessionOptions* session_options); |
| 228 |
| 229 // Helper function for options processing. |
| 230 // Deprecated. |
| 231 virtual void FinishOptionsForAnswer( |
| 232 cricket::MediaSessionOptions* session_options); |
217 | 233 |
218 // Remove all local and remote tracks of type |media_type|. | 234 // Remove all local and remote tracks of type |media_type|. |
219 // Called when a media type is rejected (m-line set to port 0). | 235 // Called when a media type is rejected (m-line set to port 0). |
220 void RemoveTracks(cricket::MediaType media_type); | 236 void RemoveTracks(cricket::MediaType media_type); |
221 | 237 |
222 // Makes sure a MediaStreamTrack is created for each StreamParam in |streams|, | 238 // Makes sure a MediaStreamTrack is created for each StreamParam in |streams|, |
223 // and existing MediaStreamTracks are removed if there is no corresponding | 239 // and existing MediaStreamTracks are removed if there is no corresponding |
224 // StreamParam. If |default_track_needed| is true, a default MediaStreamTrack | 240 // 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. | 241 // 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. | 242 // |media_type| is the type of the |streams| and can be either audio or video. |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 // because its destruction fires signals (such as VoiceChannelDestroyed) | 392 // because its destruction fires signals (such as VoiceChannelDestroyed) |
377 // which will trigger some final actions in PeerConnection... | 393 // which will trigger some final actions in PeerConnection... |
378 rtc::scoped_ptr<WebRtcSession> session_; | 394 rtc::scoped_ptr<WebRtcSession> session_; |
379 // ... But stats_ depends on session_ so it should be destroyed even earlier. | 395 // ... But stats_ depends on session_ so it should be destroyed even earlier. |
380 rtc::scoped_ptr<StatsCollector> stats_; | 396 rtc::scoped_ptr<StatsCollector> stats_; |
381 }; | 397 }; |
382 | 398 |
383 } // namespace webrtc | 399 } // namespace webrtc |
384 | 400 |
385 #endif // WEBRTC_API_PEERCONNECTION_H_ | 401 #endif // WEBRTC_API_PEERCONNECTION_H_ |
OLD | NEW |