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