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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 protected: | 151 protected: |
152 ~PeerConnection() override; | 152 ~PeerConnection() override; |
153 | 153 |
154 private: | 154 private: |
155 struct TrackInfo { | 155 struct TrackInfo { |
156 TrackInfo() : ssrc(0) {} | 156 TrackInfo() : ssrc(0) {} |
157 TrackInfo(const std::string& stream_label, | 157 TrackInfo(const std::string& stream_label, |
158 const std::string track_id, | 158 const std::string track_id, |
159 uint32_t ssrc) | 159 uint32_t ssrc) |
160 : stream_label(stream_label), track_id(track_id), ssrc(ssrc) {} | 160 : stream_label(stream_label), track_id(track_id), ssrc(ssrc) {} |
| 161 bool operator==(const TrackInfo& other) { |
| 162 return this->stream_label == other.stream_label && |
| 163 this->track_id == other.track_id && this->ssrc == other.ssrc; |
| 164 } |
161 std::string stream_label; | 165 std::string stream_label; |
162 std::string track_id; | 166 std::string track_id; |
163 uint32_t ssrc; | 167 uint32_t ssrc; |
164 }; | 168 }; |
165 typedef std::vector<TrackInfo> TrackInfos; | 169 typedef std::vector<TrackInfo> TrackInfos; |
166 | 170 |
167 struct RemotePeerInfo { | 171 struct RemotePeerInfo { |
168 RemotePeerInfo() | 172 RemotePeerInfo() |
169 : msid_supported(false), | 173 : msid_supported(false), |
170 default_audio_track_needed(false), | 174 default_audio_track_needed(false), |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 // MediaStream and triggers DestroyAudioReceiver or DestroyVideoReceiver. | 276 // MediaStream and triggers DestroyAudioReceiver or DestroyVideoReceiver. |
273 void OnRemoteTrackRemoved(const std::string& stream_label, | 277 void OnRemoteTrackRemoved(const std::string& stream_label, |
274 const std::string& track_id, | 278 const std::string& track_id, |
275 cricket::MediaType media_type); | 279 cricket::MediaType media_type); |
276 | 280 |
277 // Finds remote MediaStreams without any tracks and removes them from | 281 // Finds remote MediaStreams without any tracks and removes them from |
278 // |remote_streams_| and notifies the observer that the MediaStreams no longer | 282 // |remote_streams_| and notifies the observer that the MediaStreams no longer |
279 // exist. | 283 // exist. |
280 void UpdateEndedRemoteMediaStreams(); | 284 void UpdateEndedRemoteMediaStreams(); |
281 | 285 |
| 286 void MaybeRemoveDefaultTracks(); |
282 void MaybeCreateDefaultStream(); | 287 void MaybeCreateDefaultStream(); |
283 | 288 |
284 // Set the MediaStreamTrackInterface::TrackState to |kEnded| on all remote | 289 // Set the MediaStreamTrackInterface::TrackState to |kEnded| on all remote |
285 // tracks of type |media_type|. | 290 // tracks of type |media_type|. |
286 void EndRemoteTracks(cricket::MediaType media_type); | 291 void EndRemoteTracks(cricket::MediaType media_type); |
287 | 292 |
288 // Loops through the vector of |streams| and finds added and removed | 293 // Loops through the vector of |streams| and finds added and removed |
289 // StreamParams since last time this method was called. | 294 // StreamParams since last time this method was called. |
290 // For each new or removed StreamParam, OnLocalTrackSeen or | 295 // For each new or removed StreamParam, OnLocalTrackSeen or |
291 // OnLocalTrackRemoved is invoked. | 296 // OnLocalTrackRemoved is invoked. |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 // because its destruction fires signals (such as VoiceChannelDestroyed) | 406 // because its destruction fires signals (such as VoiceChannelDestroyed) |
402 // which will trigger some final actions in PeerConnection... | 407 // which will trigger some final actions in PeerConnection... |
403 rtc::scoped_ptr<WebRtcSession> session_; | 408 rtc::scoped_ptr<WebRtcSession> session_; |
404 // ... But stats_ depends on session_ so it should be destroyed even earlier. | 409 // ... But stats_ depends on session_ so it should be destroyed even earlier. |
405 rtc::scoped_ptr<StatsCollector> stats_; | 410 rtc::scoped_ptr<StatsCollector> stats_; |
406 }; | 411 }; |
407 | 412 |
408 } // namespace webrtc | 413 } // namespace webrtc |
409 | 414 |
410 #endif // TALK_APP_WEBRTC_PEERCONNECTION_H_ | 415 #endif // TALK_APP_WEBRTC_PEERCONNECTION_H_ |
OLD | NEW |