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 void ExtractSharedMediaSessionOptions( |
|
Taylor Brandstetter
2017/08/05 00:39:09
Could add TODO to move this to the CC file when th
Zhi Huang
2017/08/09 00:54:51
Done.
| |
| 36 // are valid. | |
| 37 // |session_options|->transport_options map entries must exist in order for | |
| 38 // them to be populated from |rtc_options|. | |
| 39 bool ExtractMediaSessionOptions( | |
| 40 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options, | 36 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options, |
| 41 bool is_offer, | |
| 42 cricket::MediaSessionOptions* session_options); | 37 cricket::MediaSessionOptions* session_options); |
| 43 | 38 |
| 44 // Populates |session_options| from |constraints|, and returns true if all | |
| 45 // mandatory constraints are satisfied. | |
| 46 // Assumes that |session_options|->transport_options map entries exist. | |
| 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 | |
| 57 // PeerConnection implements the PeerConnectionInterface interface. | 39 // PeerConnection implements the PeerConnectionInterface interface. |
| 58 // It uses WebRtcSession to implement the PeerConnection functionality. | 40 // It uses WebRtcSession to implement the PeerConnection functionality. |
| 59 class PeerConnection : public PeerConnectionInterface, | 41 class PeerConnection : public PeerConnectionInterface, |
| 60 public IceObserver, | 42 public IceObserver, |
| 61 public rtc::MessageHandler, | 43 public rtc::MessageHandler, |
| 62 public sigslot::has_slots<> { | 44 public sigslot::has_slots<> { |
| 63 public: | 45 public: |
| 64 explicit PeerConnection(PeerConnectionFactory* factory, | 46 explicit PeerConnection(PeerConnectionFactory* factory, |
| 65 std::unique_ptr<RtcEventLog> event_log, | 47 std::unique_ptr<RtcEventLog> event_log, |
| 66 std::unique_ptr<Call> call); | 48 std::unique_ptr<Call> call); |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 237 void PostCreateSessionDescriptionFailure( | 219 void PostCreateSessionDescriptionFailure( |
| 238 CreateSessionDescriptionObserver* observer, | 220 CreateSessionDescriptionObserver* observer, |
| 239 const std::string& error); | 221 const std::string& error); |
| 240 | 222 |
| 241 bool IsClosed() const { | 223 bool IsClosed() const { |
| 242 return signaling_state_ == PeerConnectionInterface::kClosed; | 224 return signaling_state_ == PeerConnectionInterface::kClosed; |
| 243 } | 225 } |
| 244 | 226 |
| 245 // Returns a MediaSessionOptions struct with options decided by |options|, | 227 // Returns a MediaSessionOptions struct with options decided by |options|, |
| 246 // the local MediaStreams and DataChannels. | 228 // the local MediaStreams and DataChannels. |
| 247 virtual bool GetOptionsForOffer( | 229 void GetOptionsForOffer( |
| 248 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options, | 230 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options, |
| 249 cricket::MediaSessionOptions* session_options); | 231 cricket::MediaSessionOptions* session_options); |
| 250 | 232 |
| 251 // Returns a MediaSessionOptions struct with options decided by | 233 // Returns a MediaSessionOptions struct with options decided by |
| 252 // |constraints|, the local MediaStreams and DataChannels. | 234 // |constraints|, the local MediaStreams and DataChannels. |
| 253 // Deprecated, use version without constraints. | 235 void GetOptionsForAnswer(const RTCOfferAnswerOptions& options, |
| 254 virtual bool GetOptionsForAnswer( | 236 cricket::MediaSessionOptions* session_options); |
| 255 const MediaConstraintsInterface* constraints, | |
| 256 cricket::MediaSessionOptions* session_options); | |
| 257 virtual bool GetOptionsForAnswer( | |
| 258 const RTCOfferAnswerOptions& options, | |
| 259 cricket::MediaSessionOptions* session_options); | |
| 260 | 237 |
| 261 void InitializeOptionsForAnswer( | 238 // Generates MediaDescriptionOptions for the |session_opts| based on existing |
| 262 cricket::MediaSessionOptions* session_options); | 239 // local description or remote description. |
| 263 | 240 void GenerateMediaDescriptionOptions( |
| 264 // Helper function for options processing. | 241 const SessionDescriptionInterface* session_desc, |
| 265 // Deprecated. | 242 cricket::RtpTransceiverDirection audio_direction, |
| 266 virtual void FinishOptionsForAnswer( | 243 cricket::RtpTransceiverDirection video_direction, |
| 244 int* audio_index, | |
| 245 int* video_index, | |
| 246 int* data_index, | |
| 267 cricket::MediaSessionOptions* session_options); | 247 cricket::MediaSessionOptions* session_options); |
| 268 | 248 |
| 269 // Remove all local and remote tracks of type |media_type|. | 249 // Remove all local and remote tracks of type |media_type|. |
| 270 // Called when a media type is rejected (m-line set to port 0). | 250 // Called when a media type is rejected (m-line set to port 0). |
| 271 void RemoveTracks(cricket::MediaType media_type); | 251 void RemoveTracks(cricket::MediaType media_type); |
| 272 | 252 |
| 273 // Makes sure a MediaStreamTrack is created for each StreamParam in |streams|, | 253 // Makes sure a MediaStreamTrack is created for each StreamParam in |streams|, |
| 274 // and existing MediaStreamTracks are removed if there is no corresponding | 254 // and existing MediaStreamTracks are removed if there is no corresponding |
| 275 // StreamParam. If |default_track_needed| is true, a default MediaStreamTrack | 255 // StreamParam. If |default_track_needed| is true, a default MediaStreamTrack |
| 276 // is created if it doesn't exist; if false, it's removed if it exists. | 256 // is created if it doesn't exist; if false, it's removed if it exists. |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 354 void OnVoiceChannelDestroyed(); | 334 void OnVoiceChannelDestroyed(); |
| 355 void OnVideoChannelCreated(); | 335 void OnVideoChannelCreated(); |
| 356 void OnVideoChannelDestroyed(); | 336 void OnVideoChannelDestroyed(); |
| 357 void OnDataChannelCreated(); | 337 void OnDataChannelCreated(); |
| 358 void OnDataChannelDestroyed(); | 338 void OnDataChannelDestroyed(); |
| 359 // Called when the cricket::DataChannel receives a message indicating that a | 339 // Called when the cricket::DataChannel receives a message indicating that a |
| 360 // webrtc::DataChannel should be opened. | 340 // webrtc::DataChannel should be opened. |
| 361 void OnDataChannelOpenMessage(const std::string& label, | 341 void OnDataChannelOpenMessage(const std::string& label, |
| 362 const InternalDataChannelInit& config); | 342 const InternalDataChannelInit& config); |
| 363 | 343 |
| 344 bool HasRtpSender(cricket::MediaType type) const; | |
| 364 RtpSenderInternal* FindSenderById(const std::string& id); | 345 RtpSenderInternal* FindSenderById(const std::string& id); |
| 365 | 346 |
| 366 std::vector<rtc::scoped_refptr< | 347 std::vector<rtc::scoped_refptr< |
| 367 RtpSenderProxyWithInternal<RtpSenderInternal>>>::iterator | 348 RtpSenderProxyWithInternal<RtpSenderInternal>>>::iterator |
| 368 FindSenderForTrack(MediaStreamTrackInterface* track); | 349 FindSenderForTrack(MediaStreamTrackInterface* track); |
| 369 std::vector<rtc::scoped_refptr< | 350 std::vector<rtc::scoped_refptr< |
| 370 RtpReceiverProxyWithInternal<RtpReceiverInternal>>>::iterator | 351 RtpReceiverProxyWithInternal<RtpReceiverInternal>>>::iterator |
| 371 FindReceiverForTrack(const std::string& track_id); | 352 FindReceiverForTrack(const std::string& track_id); |
| 372 | 353 |
| 373 TrackInfos* GetRemoteTracks(cricket::MediaType media_type); | 354 TrackInfos* GetRemoteTracks(cricket::MediaType media_type); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 457 std::vector<rtc::scoped_refptr<RtpSenderProxyWithInternal<RtpSenderInternal>>> | 438 std::vector<rtc::scoped_refptr<RtpSenderProxyWithInternal<RtpSenderInternal>>> |
| 458 senders_; | 439 senders_; |
| 459 std::vector< | 440 std::vector< |
| 460 rtc::scoped_refptr<RtpReceiverProxyWithInternal<RtpReceiverInternal>>> | 441 rtc::scoped_refptr<RtpReceiverProxyWithInternal<RtpReceiverInternal>>> |
| 461 receivers_; | 442 receivers_; |
| 462 }; | 443 }; |
| 463 | 444 |
| 464 } // namespace webrtc | 445 } // namespace webrtc |
| 465 | 446 |
| 466 #endif // WEBRTC_PC_PEERCONNECTION_H_ | 447 #endif // WEBRTC_PC_PEERCONNECTION_H_ |
| OLD | NEW |