Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: talk/app/webrtc/peerconnection.h

Issue 1507973003: Restoring behavior where PeerConnection tracks changes to MediaStreams. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Check that iterator is valid before erasing. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 void OnIceConnectionChange(IceConnectionState new_state) override; 211 void OnIceConnectionChange(IceConnectionState new_state) override;
211 void OnIceGatheringChange(IceGatheringState new_state) override; 212 void OnIceGatheringChange(IceGatheringState new_state) override;
212 void OnIceCandidate(const IceCandidateInterface* candidate) override; 213 void OnIceCandidate(const IceCandidateInterface* candidate) override;
213 void OnIceComplete() override; 214 void OnIceComplete() override;
214 void OnIceConnectionReceivingChange(bool receiving) override; 215 void OnIceConnectionReceivingChange(bool receiving) override;
215 216
216 // Signals from WebRtcSession. 217 // Signals from WebRtcSession.
217 void OnSessionStateChange(WebRtcSession* session, WebRtcSession::State state); 218 void OnSessionStateChange(WebRtcSession* session, WebRtcSession::State state);
218 void ChangeSignalingState(SignalingState signaling_state); 219 void ChangeSignalingState(SignalingState signaling_state);
219 220
221 // Signals from MediaStreamObserver.
222 void OnAudioTrackAdded(AudioTrackInterface* track,
223 MediaStreamInterface* stream);
224 void OnAudioTrackRemoved(AudioTrackInterface* track,
225 MediaStreamInterface* stream);
226 void OnVideoTrackAdded(VideoTrackInterface* track,
227 MediaStreamInterface* stream);
228 void OnVideoTrackRemoved(VideoTrackInterface* track,
229 MediaStreamInterface* stream);
230
220 rtc::Thread* signaling_thread() const { 231 rtc::Thread* signaling_thread() const {
221 return factory_->signaling_thread(); 232 return factory_->signaling_thread();
222 } 233 }
223 234
224 void PostSetSessionDescriptionFailure(SetSessionDescriptionObserver* observer, 235 void PostSetSessionDescriptionFailure(SetSessionDescriptionObserver* observer,
225 const std::string& error); 236 const std::string& error);
226 void PostCreateSessionDescriptionFailure( 237 void PostCreateSessionDescriptionFailure(
227 CreateSessionDescriptionObserver* observer, 238 CreateSessionDescriptionObserver* observer,
228 const std::string& error); 239 const std::string& error);
229 240
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 IceGatheringState ice_gathering_state_; 383 IceGatheringState ice_gathering_state_;
373 384
374 rtc::scoped_ptr<cricket::PortAllocator> port_allocator_; 385 rtc::scoped_ptr<cricket::PortAllocator> port_allocator_;
375 rtc::scoped_ptr<MediaControllerInterface> media_controller_; 386 rtc::scoped_ptr<MediaControllerInterface> media_controller_;
376 387
377 // Streams added via AddStream. 388 // Streams added via AddStream.
378 rtc::scoped_refptr<StreamCollection> local_streams_; 389 rtc::scoped_refptr<StreamCollection> local_streams_;
379 // Streams created as a result of SetRemoteDescription. 390 // Streams created as a result of SetRemoteDescription.
380 rtc::scoped_refptr<StreamCollection> remote_streams_; 391 rtc::scoped_refptr<StreamCollection> remote_streams_;
381 392
393 std::vector<rtc::scoped_ptr<MediaStreamObserver>> stream_observers_;
394
382 // These lists store track info seen in local/remote descriptions. 395 // These lists store track info seen in local/remote descriptions.
383 TrackInfos remote_audio_tracks_; 396 TrackInfos remote_audio_tracks_;
384 TrackInfos remote_video_tracks_; 397 TrackInfos remote_video_tracks_;
385 TrackInfos local_audio_tracks_; 398 TrackInfos local_audio_tracks_;
386 TrackInfos local_video_tracks_; 399 TrackInfos local_video_tracks_;
387 400
388 SctpSidAllocator sid_allocator_; 401 SctpSidAllocator sid_allocator_;
389 // label -> DataChannel 402 // label -> DataChannel
390 std::map<std::string, rtc::scoped_refptr<DataChannel>> rtp_data_channels_; 403 std::map<std::string, rtc::scoped_refptr<DataChannel>> rtp_data_channels_;
391 std::vector<rtc::scoped_refptr<DataChannel>> sctp_data_channels_; 404 std::vector<rtc::scoped_refptr<DataChannel>> sctp_data_channels_;
392 405
393 RemotePeerInfo remote_info_; 406 RemotePeerInfo remote_info_;
394 rtc::scoped_ptr<RemoteMediaStreamFactory> remote_stream_factory_; 407 rtc::scoped_ptr<RemoteMediaStreamFactory> remote_stream_factory_;
395 408
396 std::vector<rtc::scoped_refptr<RtpSenderInterface>> senders_; 409 std::vector<rtc::scoped_refptr<RtpSenderInterface>> senders_;
397 std::vector<rtc::scoped_refptr<RtpReceiverInterface>> receivers_; 410 std::vector<rtc::scoped_refptr<RtpReceiverInterface>> receivers_;
398 411
399 // The session_ scoped_ptr is declared at the bottom of PeerConnection 412 // The session_ scoped_ptr is declared at the bottom of PeerConnection
400 // because its destruction fires signals (such as VoiceChannelDestroyed) 413 // because its destruction fires signals (such as VoiceChannelDestroyed)
401 // which will trigger some final actions in PeerConnection... 414 // which will trigger some final actions in PeerConnection...
402 rtc::scoped_ptr<WebRtcSession> session_; 415 rtc::scoped_ptr<WebRtcSession> session_;
403 // ... But stats_ depends on session_ so it should be destroyed even earlier. 416 // ... But stats_ depends on session_ so it should be destroyed even earlier.
404 rtc::scoped_ptr<StatsCollector> stats_; 417 rtc::scoped_ptr<StatsCollector> stats_;
405 }; 418 };
406 419
407 } // namespace webrtc 420 } // namespace webrtc
408 421
409 #endif // TALK_APP_WEBRTC_PEERCONNECTION_H_ 422 #endif // TALK_APP_WEBRTC_PEERCONNECTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698