| 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 13 matching lines...) Expand all Loading... |
| 24 #include "webrtc/api/statscollector.h" | 24 #include "webrtc/api/statscollector.h" |
| 25 #include "webrtc/api/streamcollection.h" | 25 #include "webrtc/api/streamcollection.h" |
| 26 #include "webrtc/api/webrtcsession.h" | 26 #include "webrtc/api/webrtcsession.h" |
| 27 | 27 |
| 28 namespace webrtc { | 28 namespace webrtc { |
| 29 | 29 |
| 30 class MediaStreamObserver; | 30 class MediaStreamObserver; |
| 31 class VideoRtpReceiver; | 31 class VideoRtpReceiver; |
| 32 class RtcEventLog; | 32 class RtcEventLog; |
| 33 | 33 |
| 34 // Populates |session_options| from |rtc_options|, and returns true if options | |
| 35 // are valid. | |
| 36 // |session_options|->transport_options map entries must exist in order for | |
| 37 // them to be populated from |rtc_options|. | |
| 38 bool ExtractMediaSessionOptions( | |
| 39 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options, | |
| 40 bool is_offer, | |
| 41 cricket::MediaSessionOptions* session_options); | |
| 42 | |
| 43 // Populates |session_options| from |constraints|, and returns true if all | |
| 44 // mandatory constraints are satisfied. | |
| 45 // Assumes that |session_options|->transport_options map entries exist. | |
| 46 // Will also set defaults if corresponding constraints are not present: | |
| 47 // recv_audio=true, recv_video=true, bundle_enabled=true. | |
| 48 // Other fields will be left with existing values. | |
| 49 // | |
| 50 // Deprecated. Will be removed once callers that use constraints are gone. | |
| 51 // TODO(hta): Remove when callers are gone. | |
| 52 // https://bugs.chromium.org/p/webrtc/issues/detail?id=5617 | |
| 53 bool ParseConstraintsForAnswer(const MediaConstraintsInterface* constraints, | |
| 54 cricket::MediaSessionOptions* session_options); | |
| 55 | |
| 56 // Parses the URLs for each server in |servers| to build |stun_servers| and | 34 // Parses the URLs for each server in |servers| to build |stun_servers| and |
| 57 // |turn_servers|. | 35 // |turn_servers|. |
| 58 bool ParseIceServers(const PeerConnectionInterface::IceServers& servers, | 36 bool ParseIceServers(const PeerConnectionInterface::IceServers& servers, |
| 59 cricket::ServerAddresses* stun_servers, | 37 cricket::ServerAddresses* stun_servers, |
| 60 std::vector<cricket::RelayServerConfig>* turn_servers); | 38 std::vector<cricket::RelayServerConfig>* turn_servers); |
| 61 | 39 |
| 62 // PeerConnection implements the PeerConnectionInterface interface. | 40 // PeerConnection implements the PeerConnectionInterface interface. |
| 63 // It uses WebRtcSession to implement the PeerConnection functionality. | 41 // It uses WebRtcSession to implement the PeerConnection functionality. |
| 64 class PeerConnection : public PeerConnectionInterface, | 42 class PeerConnection : public PeerConnectionInterface, |
| 65 public IceObserver, | 43 public IceObserver, |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 void PostCreateSessionDescriptionFailure( | 206 void PostCreateSessionDescriptionFailure( |
| 229 CreateSessionDescriptionObserver* observer, | 207 CreateSessionDescriptionObserver* observer, |
| 230 const std::string& error); | 208 const std::string& error); |
| 231 | 209 |
| 232 bool IsClosed() const { | 210 bool IsClosed() const { |
| 233 return signaling_state_ == PeerConnectionInterface::kClosed; | 211 return signaling_state_ == PeerConnectionInterface::kClosed; |
| 234 } | 212 } |
| 235 | 213 |
| 236 // Returns a MediaSessionOptions struct with options decided by |options|, | 214 // Returns a MediaSessionOptions struct with options decided by |options|, |
| 237 // the local MediaStreams and DataChannels. | 215 // the local MediaStreams and DataChannels. |
| 238 virtual bool GetOptionsForOffer( | 216 void GetOptionsForOffer( |
| 239 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options, | 217 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options, |
| 240 cricket::MediaSessionOptions* session_options); | 218 cricket::MediaSessionOptions* session_options); |
| 241 | 219 |
| 242 // Returns a MediaSessionOptions struct with options decided by | 220 // Returns a MediaSessionOptions struct with options decided by |
| 243 // |constraints|, the local MediaStreams and DataChannels. | 221 // |constraints|, the local MediaStreams and DataChannels. |
| 244 // Deprecated, use version without constraints. | 222 void GetOptionsForAnswer(const RTCOfferAnswerOptions& rtc_options, |
| 245 virtual bool GetOptionsForAnswer( | 223 cricket::MediaSessionOptions* session_options); |
| 246 const MediaConstraintsInterface* constraints, | |
| 247 cricket::MediaSessionOptions* session_options); | |
| 248 virtual bool GetOptionsForAnswer( | |
| 249 const RTCOfferAnswerOptions& options, | |
| 250 cricket::MediaSessionOptions* session_options); | |
| 251 | |
| 252 void InitializeOptionsForAnswer( | |
| 253 cricket::MediaSessionOptions* session_options); | |
| 254 | |
| 255 // Helper function for options processing. | |
| 256 // Deprecated. | |
| 257 virtual void FinishOptionsForAnswer( | |
| 258 cricket::MediaSessionOptions* session_options); | |
| 259 | 224 |
| 260 // Remove all local and remote tracks of type |media_type|. | 225 // Remove all local and remote tracks of type |media_type|. |
| 261 // Called when a media type is rejected (m-line set to port 0). | 226 // Called when a media type is rejected (m-line set to port 0). |
| 262 void RemoveTracks(cricket::MediaType media_type); | 227 void RemoveTracks(cricket::MediaType media_type); |
| 263 | 228 |
| 264 // Makes sure a MediaStreamTrack is created for each StreamParam in |streams|, | 229 // Makes sure a MediaStreamTrack is created for each StreamParam in |streams|, |
| 265 // and existing MediaStreamTracks are removed if there is no corresponding | 230 // and existing MediaStreamTracks are removed if there is no corresponding |
| 266 // StreamParam. If |default_track_needed| is true, a default MediaStreamTrack | 231 // StreamParam. If |default_track_needed| is true, a default MediaStreamTrack |
| 267 // is created if it doesn't exist; if false, it's removed if it exists. | 232 // is created if it doesn't exist; if false, it's removed if it exists. |
| 268 // |media_type| is the type of the |streams| and can be either audio or video. | 233 // |media_type| is the type of the |streams| and can be either audio or video. |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 void OnVoiceChannelDestroyed(); | 310 void OnVoiceChannelDestroyed(); |
| 346 void OnVideoChannelCreated(); | 311 void OnVideoChannelCreated(); |
| 347 void OnVideoChannelDestroyed(); | 312 void OnVideoChannelDestroyed(); |
| 348 void OnDataChannelCreated(); | 313 void OnDataChannelCreated(); |
| 349 void OnDataChannelDestroyed(); | 314 void OnDataChannelDestroyed(); |
| 350 // Called when the cricket::DataChannel receives a message indicating that a | 315 // Called when the cricket::DataChannel receives a message indicating that a |
| 351 // webrtc::DataChannel should be opened. | 316 // webrtc::DataChannel should be opened. |
| 352 void OnDataChannelOpenMessage(const std::string& label, | 317 void OnDataChannelOpenMessage(const std::string& label, |
| 353 const InternalDataChannelInit& config); | 318 const InternalDataChannelInit& config); |
| 354 | 319 |
| 320 bool HasRtpSender(cricket::MediaType type) const; |
| 355 RtpSenderInternal* FindSenderById(const std::string& id); | 321 RtpSenderInternal* FindSenderById(const std::string& id); |
| 356 | 322 |
| 357 std::vector<rtc::scoped_refptr< | 323 std::vector<rtc::scoped_refptr< |
| 358 RtpSenderProxyWithInternal<RtpSenderInternal>>>::iterator | 324 RtpSenderProxyWithInternal<RtpSenderInternal>>>::iterator |
| 359 FindSenderForTrack(MediaStreamTrackInterface* track); | 325 FindSenderForTrack(MediaStreamTrackInterface* track); |
| 360 std::vector<rtc::scoped_refptr< | 326 std::vector<rtc::scoped_refptr< |
| 361 RtpReceiverProxyWithInternal<RtpReceiverInternal>>>::iterator | 327 RtpReceiverProxyWithInternal<RtpReceiverInternal>>>::iterator |
| 362 FindReceiverForTrack(const std::string& track_id); | 328 FindReceiverForTrack(const std::string& track_id); |
| 363 | 329 |
| 364 TrackInfos* GetRemoteTracks(cricket::MediaType media_type); | 330 TrackInfos* GetRemoteTracks(cricket::MediaType media_type); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 rtc::scoped_refptr<RtpReceiverProxyWithInternal<RtpReceiverInternal>>> | 400 rtc::scoped_refptr<RtpReceiverProxyWithInternal<RtpReceiverInternal>>> |
| 435 receivers_; | 401 receivers_; |
| 436 std::unique_ptr<WebRtcSession> session_; | 402 std::unique_ptr<WebRtcSession> session_; |
| 437 std::unique_ptr<StatsCollector> stats_; | 403 std::unique_ptr<StatsCollector> stats_; |
| 438 rtc::scoped_refptr<RTCStatsCollector> stats_collector_; | 404 rtc::scoped_refptr<RTCStatsCollector> stats_collector_; |
| 439 }; | 405 }; |
| 440 | 406 |
| 441 } // namespace webrtc | 407 } // namespace webrtc |
| 442 | 408 |
| 443 #endif // WEBRTC_API_PEERCONNECTION_H_ | 409 #endif // WEBRTC_API_PEERCONNECTION_H_ |
| OLD | NEW |