OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "talk/app/webrtc/peerconnectioninterface.h" | 35 #include "talk/app/webrtc/peerconnectioninterface.h" |
36 #include "talk/app/webrtc/rtpreceiverinterface.h" | 36 #include "talk/app/webrtc/rtpreceiverinterface.h" |
37 #include "talk/app/webrtc/rtpsenderinterface.h" | 37 #include "talk/app/webrtc/rtpsenderinterface.h" |
38 #include "talk/app/webrtc/statscollector.h" | 38 #include "talk/app/webrtc/statscollector.h" |
39 #include "talk/app/webrtc/streamcollection.h" | 39 #include "talk/app/webrtc/streamcollection.h" |
40 #include "talk/app/webrtc/webrtcsession.h" | 40 #include "talk/app/webrtc/webrtcsession.h" |
41 #include "webrtc/base/scoped_ptr.h" | 41 #include "webrtc/base/scoped_ptr.h" |
42 | 42 |
43 namespace webrtc { | 43 namespace webrtc { |
44 | 44 |
| 45 class MediaStreamObserver; |
45 class RemoteMediaStreamFactory; | 46 class RemoteMediaStreamFactory; |
46 | 47 |
47 typedef std::vector<PortAllocatorFactoryInterface::StunConfiguration> | 48 typedef std::vector<PortAllocatorFactoryInterface::StunConfiguration> |
48 StunConfigurations; | 49 StunConfigurations; |
49 typedef std::vector<PortAllocatorFactoryInterface::TurnConfiguration> | 50 typedef std::vector<PortAllocatorFactoryInterface::TurnConfiguration> |
50 TurnConfigurations; | 51 TurnConfigurations; |
51 | 52 |
52 // Populates |session_options| from |rtc_options|, and returns true if options | 53 // Populates |session_options| from |rtc_options|, and returns true if options |
53 // are valid. | 54 // are valid. |
54 bool ConvertRtcOptionsForOffer( | 55 bool ConvertRtcOptionsForOffer( |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 void OnIceConnectionChange(IceConnectionState new_state) override; | 195 void OnIceConnectionChange(IceConnectionState new_state) override; |
195 void OnIceGatheringChange(IceGatheringState new_state) override; | 196 void OnIceGatheringChange(IceGatheringState new_state) override; |
196 void OnIceCandidate(const IceCandidateInterface* candidate) override; | 197 void OnIceCandidate(const IceCandidateInterface* candidate) override; |
197 void OnIceComplete() override; | 198 void OnIceComplete() override; |
198 void OnIceConnectionReceivingChange(bool receiving) override; | 199 void OnIceConnectionReceivingChange(bool receiving) override; |
199 | 200 |
200 // Signals from WebRtcSession. | 201 // Signals from WebRtcSession. |
201 void OnSessionStateChange(WebRtcSession* session, WebRtcSession::State state); | 202 void OnSessionStateChange(WebRtcSession* session, WebRtcSession::State state); |
202 void ChangeSignalingState(SignalingState signaling_state); | 203 void ChangeSignalingState(SignalingState signaling_state); |
203 | 204 |
| 205 // Signals from MediaStreamObserver. |
| 206 void OnAudioTrackAdded(AudioTrackInterface* track, |
| 207 MediaStreamInterface* stream); |
| 208 void OnAudioTrackRemoved(AudioTrackInterface* track, |
| 209 MediaStreamInterface* stream); |
| 210 void OnVideoTrackAdded(VideoTrackInterface* track, |
| 211 MediaStreamInterface* stream); |
| 212 void OnVideoTrackRemoved(VideoTrackInterface* track, |
| 213 MediaStreamInterface* stream); |
| 214 |
204 rtc::Thread* signaling_thread() const { | 215 rtc::Thread* signaling_thread() const { |
205 return factory_->signaling_thread(); | 216 return factory_->signaling_thread(); |
206 } | 217 } |
207 | 218 |
208 void PostSetSessionDescriptionFailure(SetSessionDescriptionObserver* observer, | 219 void PostSetSessionDescriptionFailure(SetSessionDescriptionObserver* observer, |
209 const std::string& error); | 220 const std::string& error); |
210 void PostCreateSessionDescriptionFailure( | 221 void PostCreateSessionDescriptionFailure( |
211 CreateSessionDescriptionObserver* observer, | 222 CreateSessionDescriptionObserver* observer, |
212 const std::string& error); | 223 const std::string& error); |
213 | 224 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 IceGatheringState ice_gathering_state_; | 368 IceGatheringState ice_gathering_state_; |
358 | 369 |
359 rtc::scoped_ptr<cricket::PortAllocator> port_allocator_; | 370 rtc::scoped_ptr<cricket::PortAllocator> port_allocator_; |
360 rtc::scoped_ptr<MediaControllerInterface> media_controller_; | 371 rtc::scoped_ptr<MediaControllerInterface> media_controller_; |
361 | 372 |
362 // Streams added via AddStream. | 373 // Streams added via AddStream. |
363 rtc::scoped_refptr<StreamCollection> local_streams_; | 374 rtc::scoped_refptr<StreamCollection> local_streams_; |
364 // Streams created as a result of SetRemoteDescription. | 375 // Streams created as a result of SetRemoteDescription. |
365 rtc::scoped_refptr<StreamCollection> remote_streams_; | 376 rtc::scoped_refptr<StreamCollection> remote_streams_; |
366 | 377 |
| 378 std::vector<rtc::scoped_ptr<MediaStreamObserver>> stream_observers_; |
| 379 |
367 // These lists store track info seen in local/remote descriptions. | 380 // These lists store track info seen in local/remote descriptions. |
368 TrackInfos remote_audio_tracks_; | 381 TrackInfos remote_audio_tracks_; |
369 TrackInfos remote_video_tracks_; | 382 TrackInfos remote_video_tracks_; |
370 TrackInfos local_audio_tracks_; | 383 TrackInfos local_audio_tracks_; |
371 TrackInfos local_video_tracks_; | 384 TrackInfos local_video_tracks_; |
372 | 385 |
373 SctpSidAllocator sid_allocator_; | 386 SctpSidAllocator sid_allocator_; |
374 // label -> DataChannel | 387 // label -> DataChannel |
375 std::map<std::string, rtc::scoped_refptr<DataChannel>> rtp_data_channels_; | 388 std::map<std::string, rtc::scoped_refptr<DataChannel>> rtp_data_channels_; |
376 std::vector<rtc::scoped_refptr<DataChannel>> sctp_data_channels_; | 389 std::vector<rtc::scoped_refptr<DataChannel>> sctp_data_channels_; |
377 | 390 |
378 bool remote_peer_supports_msid_ = false; | 391 bool remote_peer_supports_msid_ = false; |
379 rtc::scoped_ptr<RemoteMediaStreamFactory> remote_stream_factory_; | 392 rtc::scoped_ptr<RemoteMediaStreamFactory> remote_stream_factory_; |
380 | 393 |
381 std::vector<rtc::scoped_refptr<RtpSenderInterface>> senders_; | 394 std::vector<rtc::scoped_refptr<RtpSenderInterface>> senders_; |
382 std::vector<rtc::scoped_refptr<RtpReceiverInterface>> receivers_; | 395 std::vector<rtc::scoped_refptr<RtpReceiverInterface>> receivers_; |
383 | 396 |
384 // The session_ scoped_ptr is declared at the bottom of PeerConnection | 397 // The session_ scoped_ptr is declared at the bottom of PeerConnection |
385 // because its destruction fires signals (such as VoiceChannelDestroyed) | 398 // because its destruction fires signals (such as VoiceChannelDestroyed) |
386 // which will trigger some final actions in PeerConnection... | 399 // which will trigger some final actions in PeerConnection... |
387 rtc::scoped_ptr<WebRtcSession> session_; | 400 rtc::scoped_ptr<WebRtcSession> session_; |
388 // ... But stats_ depends on session_ so it should be destroyed even earlier. | 401 // ... But stats_ depends on session_ so it should be destroyed even earlier. |
389 rtc::scoped_ptr<StatsCollector> stats_; | 402 rtc::scoped_ptr<StatsCollector> stats_; |
390 }; | 403 }; |
391 | 404 |
392 } // namespace webrtc | 405 } // namespace webrtc |
393 | 406 |
394 #endif // TALK_APP_WEBRTC_PEERCONNECTION_H_ | 407 #endif // TALK_APP_WEBRTC_PEERCONNECTION_H_ |
OLD | NEW |