Chromium Code Reviews| 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 14 matching lines...) Expand all Loading... | |
| 25 #include "webrtc/pc/statscollector.h" | 25 #include "webrtc/pc/statscollector.h" |
| 26 #include "webrtc/pc/streamcollection.h" | 26 #include "webrtc/pc/streamcollection.h" |
| 27 #include "webrtc/pc/webrtcsession.h" | 27 #include "webrtc/pc/webrtcsession.h" |
| 28 | 28 |
| 29 namespace webrtc { | 29 namespace webrtc { |
| 30 | 30 |
| 31 class MediaStreamObserver; | 31 class MediaStreamObserver; |
| 32 class VideoRtpReceiver; | 32 class VideoRtpReceiver; |
| 33 class RtcEventLog; | 33 class RtcEventLog; |
| 34 | 34 |
| 35 // Populates |session_options| from |rtc_options|, and returns true if options | 35 bool ValidateOfferAnswerOptions( |
| 36 // are valid. | 36 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options); |
| 37 // |session_options|->transport_options map entries must exist in order for | 37 |
| 38 // them to be populated from |rtc_options|. | 38 void ExtractSharedMediaSessionOptions( |
| 39 bool ExtractMediaSessionOptions( | |
| 40 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options, | 39 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options, |
| 41 bool is_offer, | |
| 42 cricket::MediaSessionOptions* session_options); | 40 cricket::MediaSessionOptions* session_options); |
| 43 | 41 |
| 44 // Populates |session_options| from |constraints|, and returns true if all | 42 bool ConvertConstraintsToOfferAnswerOptions( |
| 45 // mandatory constraints are satisfied. | 43 const MediaConstraintsInterface* constraints, |
| 46 // Assumes that |session_options|->transport_options map entries exist. | 44 PeerConnectionInterface::RTCOfferAnswerOptions* offer_answer_options); |
|
Taylor Brandstetter
2017/07/28 19:00:25
Unless the tests still rely on these, the declarat
Zhi Huang
2017/08/02 04:38:36
Might still need one of them for WebRtcSession tes
| |
| 47 // Will also set defaults if corresponding constraints are not present: | |
| 48 // recv_audio=true, recv_video=true, bundle_enabled=true. | |
| 49 // Other fields will be left with existing values. | |
| 50 // | |
| 51 // Deprecated. Will be removed once callers that use constraints are gone. | |
| 52 // TODO(hta): Remove when callers are gone. | |
| 53 // https://bugs.chromium.org/p/webrtc/issues/detail?id=5617 | |
| 54 bool ParseConstraintsForAnswer(const MediaConstraintsInterface* constraints, | |
| 55 cricket::MediaSessionOptions* session_options); | |
| 56 | 45 |
| 57 // PeerConnection implements the PeerConnectionInterface interface. | 46 // PeerConnection implements the PeerConnectionInterface interface. |
| 58 // It uses WebRtcSession to implement the PeerConnection functionality. | 47 // It uses WebRtcSession to implement the PeerConnection functionality. |
| 59 class PeerConnection : public PeerConnectionInterface, | 48 class PeerConnection : public PeerConnectionInterface, |
| 60 public IceObserver, | 49 public IceObserver, |
| 61 public rtc::MessageHandler, | 50 public rtc::MessageHandler, |
| 62 public sigslot::has_slots<> { | 51 public sigslot::has_slots<> { |
| 63 public: | 52 public: |
| 64 explicit PeerConnection(PeerConnectionFactory* factory, | 53 explicit PeerConnection(PeerConnectionFactory* factory, |
| 65 std::unique_ptr<RtcEventLog> event_log, | 54 std::unique_ptr<RtcEventLog> event_log, |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 233 void PostCreateSessionDescriptionFailure( | 222 void PostCreateSessionDescriptionFailure( |
| 234 CreateSessionDescriptionObserver* observer, | 223 CreateSessionDescriptionObserver* observer, |
| 235 const std::string& error); | 224 const std::string& error); |
| 236 | 225 |
| 237 bool IsClosed() const { | 226 bool IsClosed() const { |
| 238 return signaling_state_ == PeerConnectionInterface::kClosed; | 227 return signaling_state_ == PeerConnectionInterface::kClosed; |
| 239 } | 228 } |
| 240 | 229 |
| 241 // Returns a MediaSessionOptions struct with options decided by |options|, | 230 // Returns a MediaSessionOptions struct with options decided by |options|, |
| 242 // the local MediaStreams and DataChannels. | 231 // the local MediaStreams and DataChannels. |
| 243 virtual bool GetOptionsForOffer( | 232 void GetOptionsForOffer( |
| 244 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options, | 233 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options, |
| 245 cricket::MediaSessionOptions* session_options); | 234 cricket::MediaSessionOptions* session_options); |
| 246 | 235 |
| 247 // Returns a MediaSessionOptions struct with options decided by | 236 // Returns a MediaSessionOptions struct with options decided by |
| 248 // |constraints|, the local MediaStreams and DataChannels. | 237 // |constraints|, the local MediaStreams and DataChannels. |
| 249 // Deprecated, use version without constraints. | 238 void GetOptionsForAnswer(const RTCOfferAnswerOptions& options, |
| 250 virtual bool GetOptionsForAnswer( | 239 cricket::MediaSessionOptions* session_options); |
| 251 const MediaConstraintsInterface* constraints, | |
| 252 cricket::MediaSessionOptions* session_options); | |
| 253 virtual bool GetOptionsForAnswer( | |
| 254 const RTCOfferAnswerOptions& options, | |
| 255 cricket::MediaSessionOptions* session_options); | |
| 256 | |
| 257 void InitializeOptionsForAnswer( | |
| 258 cricket::MediaSessionOptions* session_options); | |
| 259 | |
| 260 // Helper function for options processing. | |
| 261 // Deprecated. | |
| 262 virtual void FinishOptionsForAnswer( | |
| 263 cricket::MediaSessionOptions* session_options); | |
| 264 | 240 |
| 265 // Remove all local and remote tracks of type |media_type|. | 241 // Remove all local and remote tracks of type |media_type|. |
| 266 // Called when a media type is rejected (m-line set to port 0). | 242 // Called when a media type is rejected (m-line set to port 0). |
| 267 void RemoveTracks(cricket::MediaType media_type); | 243 void RemoveTracks(cricket::MediaType media_type); |
| 268 | 244 |
| 269 // Makes sure a MediaStreamTrack is created for each StreamParam in |streams|, | 245 // Makes sure a MediaStreamTrack is created for each StreamParam in |streams|, |
| 270 // and existing MediaStreamTracks are removed if there is no corresponding | 246 // and existing MediaStreamTracks are removed if there is no corresponding |
| 271 // StreamParam. If |default_track_needed| is true, a default MediaStreamTrack | 247 // StreamParam. If |default_track_needed| is true, a default MediaStreamTrack |
| 272 // is created if it doesn't exist; if false, it's removed if it exists. | 248 // is created if it doesn't exist; if false, it's removed if it exists. |
| 273 // |media_type| is the type of the |streams| and can be either audio or video. | 249 // |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... | |
| 350 void OnVoiceChannelDestroyed(); | 326 void OnVoiceChannelDestroyed(); |
| 351 void OnVideoChannelCreated(); | 327 void OnVideoChannelCreated(); |
| 352 void OnVideoChannelDestroyed(); | 328 void OnVideoChannelDestroyed(); |
| 353 void OnDataChannelCreated(); | 329 void OnDataChannelCreated(); |
| 354 void OnDataChannelDestroyed(); | 330 void OnDataChannelDestroyed(); |
| 355 // Called when the cricket::DataChannel receives a message indicating that a | 331 // Called when the cricket::DataChannel receives a message indicating that a |
| 356 // webrtc::DataChannel should be opened. | 332 // webrtc::DataChannel should be opened. |
| 357 void OnDataChannelOpenMessage(const std::string& label, | 333 void OnDataChannelOpenMessage(const std::string& label, |
| 358 const InternalDataChannelInit& config); | 334 const InternalDataChannelInit& config); |
| 359 | 335 |
| 336 bool HasRtpSender(cricket::MediaType type) const; | |
| 360 RtpSenderInternal* FindSenderById(const std::string& id); | 337 RtpSenderInternal* FindSenderById(const std::string& id); |
| 361 | 338 |
| 362 std::vector<rtc::scoped_refptr< | 339 std::vector<rtc::scoped_refptr< |
| 363 RtpSenderProxyWithInternal<RtpSenderInternal>>>::iterator | 340 RtpSenderProxyWithInternal<RtpSenderInternal>>>::iterator |
| 364 FindSenderForTrack(MediaStreamTrackInterface* track); | 341 FindSenderForTrack(MediaStreamTrackInterface* track); |
| 365 std::vector<rtc::scoped_refptr< | 342 std::vector<rtc::scoped_refptr< |
| 366 RtpReceiverProxyWithInternal<RtpReceiverInternal>>>::iterator | 343 RtpReceiverProxyWithInternal<RtpReceiverInternal>>>::iterator |
| 367 FindReceiverForTrack(const std::string& track_id); | 344 FindReceiverForTrack(const std::string& track_id); |
| 368 | 345 |
| 369 TrackInfos* GetRemoteTracks(cricket::MediaType media_type); | 346 TrackInfos* GetRemoteTracks(cricket::MediaType media_type); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 447 std::vector<rtc::scoped_refptr<RtpSenderProxyWithInternal<RtpSenderInternal>>> | 424 std::vector<rtc::scoped_refptr<RtpSenderProxyWithInternal<RtpSenderInternal>>> |
| 448 senders_; | 425 senders_; |
| 449 std::vector< | 426 std::vector< |
| 450 rtc::scoped_refptr<RtpReceiverProxyWithInternal<RtpReceiverInternal>>> | 427 rtc::scoped_refptr<RtpReceiverProxyWithInternal<RtpReceiverInternal>>> |
| 451 receivers_; | 428 receivers_; |
| 452 }; | 429 }; |
| 453 | 430 |
| 454 } // namespace webrtc | 431 } // namespace webrtc |
| 455 | 432 |
| 456 #endif // WEBRTC_PC_PEERCONNECTION_H_ | 433 #endif // WEBRTC_PC_PEERCONNECTION_H_ |
| OLD | NEW |