| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 // Triggered when the remote SessionDescription removes a stream. | 60 // Triggered when the remote SessionDescription removes a stream. |
| 61 virtual void OnRemoveRemoteStream(MediaStreamInterface* stream) = 0; | 61 virtual void OnRemoveRemoteStream(MediaStreamInterface* stream) = 0; |
| 62 | 62 |
| 63 // Triggered when the remote SessionDescription has a new data channel. | 63 // Triggered when the remote SessionDescription has a new data channel. |
| 64 virtual void OnAddDataChannel(DataChannelInterface* data_channel) = 0; | 64 virtual void OnAddDataChannel(DataChannelInterface* data_channel) = 0; |
| 65 | 65 |
| 66 // Triggered when the remote SessionDescription has a new audio track. | 66 // Triggered when the remote SessionDescription has a new audio track. |
| 67 virtual void OnAddRemoteAudioTrack(MediaStreamInterface* stream, | 67 virtual void OnAddRemoteAudioTrack(MediaStreamInterface* stream, |
| 68 AudioTrackInterface* audio_track, | 68 AudioTrackInterface* audio_track, |
| 69 uint32 ssrc) = 0; | 69 uint32_t ssrc) = 0; |
| 70 | 70 |
| 71 // Triggered when the remote SessionDescription has a new video track. | 71 // Triggered when the remote SessionDescription has a new video track. |
| 72 virtual void OnAddRemoteVideoTrack(MediaStreamInterface* stream, | 72 virtual void OnAddRemoteVideoTrack(MediaStreamInterface* stream, |
| 73 VideoTrackInterface* video_track, | 73 VideoTrackInterface* video_track, |
| 74 uint32 ssrc) = 0; | 74 uint32_t ssrc) = 0; |
| 75 | 75 |
| 76 // Triggered when the remote SessionDescription has removed an audio track. | 76 // Triggered when the remote SessionDescription has removed an audio track. |
| 77 virtual void OnRemoveRemoteAudioTrack(MediaStreamInterface* stream, | 77 virtual void OnRemoveRemoteAudioTrack(MediaStreamInterface* stream, |
| 78 AudioTrackInterface* audio_track) = 0; | 78 AudioTrackInterface* audio_track) = 0; |
| 79 | 79 |
| 80 // Triggered when the remote SessionDescription has removed a video track. | 80 // Triggered when the remote SessionDescription has removed a video track. |
| 81 virtual void OnRemoveRemoteVideoTrack(MediaStreamInterface* stream, | 81 virtual void OnRemoveRemoteVideoTrack(MediaStreamInterface* stream, |
| 82 VideoTrackInterface* video_track) = 0; | 82 VideoTrackInterface* video_track) = 0; |
| 83 | 83 |
| 84 // Triggered when the local SessionDescription has a new audio track. | 84 // Triggered when the local SessionDescription has a new audio track. |
| 85 virtual void OnAddLocalAudioTrack(MediaStreamInterface* stream, | 85 virtual void OnAddLocalAudioTrack(MediaStreamInterface* stream, |
| 86 AudioTrackInterface* audio_track, | 86 AudioTrackInterface* audio_track, |
| 87 uint32 ssrc) = 0; | 87 uint32_t ssrc) = 0; |
| 88 | 88 |
| 89 // Triggered when the local SessionDescription has a new video track. | 89 // Triggered when the local SessionDescription has a new video track. |
| 90 virtual void OnAddLocalVideoTrack(MediaStreamInterface* stream, | 90 virtual void OnAddLocalVideoTrack(MediaStreamInterface* stream, |
| 91 VideoTrackInterface* video_track, | 91 VideoTrackInterface* video_track, |
| 92 uint32 ssrc) = 0; | 92 uint32_t ssrc) = 0; |
| 93 | 93 |
| 94 // Triggered when the local SessionDescription has removed an audio track. | 94 // Triggered when the local SessionDescription has removed an audio track. |
| 95 virtual void OnRemoveLocalAudioTrack(MediaStreamInterface* stream, | 95 virtual void OnRemoveLocalAudioTrack(MediaStreamInterface* stream, |
| 96 AudioTrackInterface* audio_track, | 96 AudioTrackInterface* audio_track, |
| 97 uint32 ssrc) = 0; | 97 uint32_t ssrc) = 0; |
| 98 | 98 |
| 99 // Triggered when the local SessionDescription has removed a video track. | 99 // Triggered when the local SessionDescription has removed a video track. |
| 100 virtual void OnRemoveLocalVideoTrack(MediaStreamInterface* stream, | 100 virtual void OnRemoveLocalVideoTrack(MediaStreamInterface* stream, |
| 101 VideoTrackInterface* video_track) = 0; | 101 VideoTrackInterface* video_track) = 0; |
| 102 | 102 |
| 103 // Triggered when RemoveLocalStream is called. |stream| is no longer used | 103 // Triggered when RemoveLocalStream is called. |stream| is no longer used |
| 104 // when negotiating and all tracks in |stream| should stop providing data to | 104 // when negotiating and all tracks in |stream| should stop providing data to |
| 105 // this PeerConnection. This doesn't mean that the local session description | 105 // this PeerConnection. This doesn't mean that the local session description |
| 106 // has changed and OnRemoveLocalAudioTrack and OnRemoveLocalVideoTrack is not | 106 // has changed and OnRemoveLocalAudioTrack and OnRemoveLocalVideoTrack is not |
| 107 // called for each individual track. | 107 // called for each individual track. |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 | 247 |
| 248 // Returns all current known local MediaStreams. | 248 // Returns all current known local MediaStreams. |
| 249 StreamCollectionInterface* local_streams() const { return local_streams_;} | 249 StreamCollectionInterface* local_streams() const { return local_streams_;} |
| 250 | 250 |
| 251 // Returns all current remote MediaStreams. | 251 // Returns all current remote MediaStreams. |
| 252 StreamCollectionInterface* remote_streams() const { | 252 StreamCollectionInterface* remote_streams() const { |
| 253 return remote_streams_.get(); | 253 return remote_streams_.get(); |
| 254 } | 254 } |
| 255 void OnDataTransportCreatedForSctp(); | 255 void OnDataTransportCreatedForSctp(); |
| 256 void OnDtlsRoleReadyForSctp(rtc::SSLRole role); | 256 void OnDtlsRoleReadyForSctp(rtc::SSLRole role); |
| 257 void OnRemoteSctpDataChannelClosed(uint32 sid); | 257 void OnRemoteSctpDataChannelClosed(uint32_t sid); |
| 258 | 258 |
| 259 const SctpDataChannels& sctp_data_channels() const { | 259 const SctpDataChannels& sctp_data_channels() const { |
| 260 return sctp_data_channels_; | 260 return sctp_data_channels_; |
| 261 } | 261 } |
| 262 | 262 |
| 263 private: | 263 private: |
| 264 struct RemotePeerInfo { | 264 struct RemotePeerInfo { |
| 265 RemotePeerInfo() | 265 RemotePeerInfo() |
| 266 : msid_supported(false), | 266 : msid_supported(false), |
| 267 default_audio_track_needed(false), | 267 default_audio_track_needed(false), |
| (...skipping 11 matching lines...) Expand all Loading... |
| 279 bool IsDefaultMediaStreamNeeded() { | 279 bool IsDefaultMediaStreamNeeded() { |
| 280 return !msid_supported && (default_audio_track_needed || | 280 return !msid_supported && (default_audio_track_needed || |
| 281 default_video_track_needed); | 281 default_video_track_needed); |
| 282 } | 282 } |
| 283 }; | 283 }; |
| 284 | 284 |
| 285 struct TrackInfo { | 285 struct TrackInfo { |
| 286 TrackInfo() : ssrc(0) {} | 286 TrackInfo() : ssrc(0) {} |
| 287 TrackInfo(const std::string& stream_label, | 287 TrackInfo(const std::string& stream_label, |
| 288 const std::string track_id, | 288 const std::string track_id, |
| 289 uint32 ssrc) | 289 uint32_t ssrc) |
| 290 : stream_label(stream_label), track_id(track_id), ssrc(ssrc) {} | 290 : stream_label(stream_label), track_id(track_id), ssrc(ssrc) {} |
| 291 std::string stream_label; | 291 std::string stream_label; |
| 292 std::string track_id; | 292 std::string track_id; |
| 293 uint32 ssrc; | 293 uint32_t ssrc; |
| 294 }; | 294 }; |
| 295 typedef std::vector<TrackInfo> TrackInfos; | 295 typedef std::vector<TrackInfo> TrackInfos; |
| 296 | 296 |
| 297 // Makes sure a MediaStream Track is created for each StreamParam in | 297 // Makes sure a MediaStream Track is created for each StreamParam in |
| 298 // |streams|. |media_type| is the type of the |streams| and can be either | 298 // |streams|. |media_type| is the type of the |streams| and can be either |
| 299 // audio or video. | 299 // audio or video. |
| 300 // If a new MediaStream is created it is added to |new_streams|. | 300 // If a new MediaStream is created it is added to |new_streams|. |
| 301 void UpdateRemoteStreamsList( | 301 void UpdateRemoteStreamsList( |
| 302 const std::vector<cricket::StreamParams>& streams, | 302 const std::vector<cricket::StreamParams>& streams, |
| 303 cricket::MediaType media_type, | 303 cricket::MediaType media_type, |
| 304 StreamCollection* new_streams); | 304 StreamCollection* new_streams); |
| 305 | 305 |
| 306 // Triggered when a remote track has been seen for the first time in a remote | 306 // Triggered when a remote track has been seen for the first time in a remote |
| 307 // session description. It creates a remote MediaStreamTrackInterface | 307 // session description. It creates a remote MediaStreamTrackInterface |
| 308 // implementation and triggers MediaStreamSignaling::OnAddRemoteAudioTrack or | 308 // implementation and triggers MediaStreamSignaling::OnAddRemoteAudioTrack or |
| 309 // MediaStreamSignaling::OnAddRemoteVideoTrack. | 309 // MediaStreamSignaling::OnAddRemoteVideoTrack. |
| 310 void OnRemoteTrackSeen(const std::string& stream_label, | 310 void OnRemoteTrackSeen(const std::string& stream_label, |
| 311 const std::string& track_id, | 311 const std::string& track_id, |
| 312 uint32 ssrc, | 312 uint32_t ssrc, |
| 313 cricket::MediaType media_type); | 313 cricket::MediaType media_type); |
| 314 | 314 |
| 315 // Triggered when a remote track has been removed from a remote session | 315 // Triggered when a remote track has been removed from a remote session |
| 316 // description. It removes the remote track with id |track_id| from a remote | 316 // description. It removes the remote track with id |track_id| from a remote |
| 317 // MediaStream and triggers MediaStreamSignaling::OnRemoveRemoteAudioTrack or | 317 // MediaStream and triggers MediaStreamSignaling::OnRemoveRemoteAudioTrack or |
| 318 // MediaStreamSignaling::OnRemoveRemoteVideoTrack. | 318 // MediaStreamSignaling::OnRemoveRemoteVideoTrack. |
| 319 void OnRemoteTrackRemoved(const std::string& stream_label, | 319 void OnRemoteTrackRemoved(const std::string& stream_label, |
| 320 const std::string& track_id, | 320 const std::string& track_id, |
| 321 cricket::MediaType media_type); | 321 cricket::MediaType media_type); |
| 322 | 322 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 343 cricket::MediaType media_type); | 343 cricket::MediaType media_type); |
| 344 | 344 |
| 345 // Triggered when a local track has been seen for the first time in a local | 345 // Triggered when a local track has been seen for the first time in a local |
| 346 // session description. | 346 // session description. |
| 347 // This method triggers MediaStreamSignaling::OnAddLocalAudioTrack or | 347 // This method triggers MediaStreamSignaling::OnAddLocalAudioTrack or |
| 348 // MediaStreamSignaling::OnAddLocalVideoTrack if the rtp streams in the local | 348 // MediaStreamSignaling::OnAddLocalVideoTrack if the rtp streams in the local |
| 349 // SessionDescription can be mapped to a MediaStreamTrack in a MediaStream in | 349 // SessionDescription can be mapped to a MediaStreamTrack in a MediaStream in |
| 350 // |local_streams_| | 350 // |local_streams_| |
| 351 void OnLocalTrackSeen(const std::string& stream_label, | 351 void OnLocalTrackSeen(const std::string& stream_label, |
| 352 const std::string& track_id, | 352 const std::string& track_id, |
| 353 uint32 ssrc, | 353 uint32_t ssrc, |
| 354 cricket::MediaType media_type); | 354 cricket::MediaType media_type); |
| 355 | 355 |
| 356 // Triggered when a local track has been removed from a local session | 356 // Triggered when a local track has been removed from a local session |
| 357 // description. | 357 // description. |
| 358 // This method triggers MediaStreamSignaling::OnRemoveLocalAudioTrack or | 358 // This method triggers MediaStreamSignaling::OnRemoveLocalAudioTrack or |
| 359 // MediaStreamSignaling::OnRemoveLocalVideoTrack if a stream has been removed | 359 // MediaStreamSignaling::OnRemoveLocalVideoTrack if a stream has been removed |
| 360 // from the local SessionDescription and the stream can be mapped to a | 360 // from the local SessionDescription and the stream can be mapped to a |
| 361 // MediaStreamTrack in a MediaStream in |local_streams_|. | 361 // MediaStreamTrack in a MediaStream in |local_streams_|. |
| 362 void OnLocalTrackRemoved(const std::string& stream_label, | 362 void OnLocalTrackRemoved(const std::string& stream_label, |
| 363 const std::string& track_id, | 363 const std::string& track_id, |
| 364 uint32 ssrc, | 364 uint32_t ssrc, |
| 365 cricket::MediaType media_type); | 365 cricket::MediaType media_type); |
| 366 | 366 |
| 367 void UpdateLocalRtpDataChannels(const cricket::StreamParamsVec& streams); | 367 void UpdateLocalRtpDataChannels(const cricket::StreamParamsVec& streams); |
| 368 void UpdateRemoteRtpDataChannels(const cricket::StreamParamsVec& streams); | 368 void UpdateRemoteRtpDataChannels(const cricket::StreamParamsVec& streams); |
| 369 void UpdateClosingDataChannels( | 369 void UpdateClosingDataChannels( |
| 370 const std::vector<std::string>& active_channels, bool is_local_update); | 370 const std::vector<std::string>& active_channels, bool is_local_update); |
| 371 void CreateRemoteDataChannel(const std::string& label, uint32 remote_ssrc); | 371 void CreateRemoteDataChannel(const std::string& label, uint32_t remote_ssrc); |
| 372 | 372 |
| 373 const TrackInfo* FindTrackInfo(const TrackInfos& infos, | 373 const TrackInfo* FindTrackInfo(const TrackInfos& infos, |
| 374 const std::string& stream_label, | 374 const std::string& stream_label, |
| 375 const std::string track_id) const; | 375 const std::string track_id) const; |
| 376 | 376 |
| 377 // Returns the index of the specified SCTP DataChannel in sctp_data_channels_, | 377 // Returns the index of the specified SCTP DataChannel in sctp_data_channels_, |
| 378 // or -1 if not found. | 378 // or -1 if not found. |
| 379 int FindDataChannelBySid(int sid) const; | 379 int FindDataChannelBySid(int sid) const; |
| 380 | 380 |
| 381 RemotePeerInfo remote_info_; | 381 RemotePeerInfo remote_info_; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 394 int last_allocated_sctp_even_sid_; | 394 int last_allocated_sctp_even_sid_; |
| 395 int last_allocated_sctp_odd_sid_; | 395 int last_allocated_sctp_odd_sid_; |
| 396 | 396 |
| 397 RtpDataChannels rtp_data_channels_; | 397 RtpDataChannels rtp_data_channels_; |
| 398 SctpDataChannels sctp_data_channels_; | 398 SctpDataChannels sctp_data_channels_; |
| 399 }; | 399 }; |
| 400 | 400 |
| 401 } // namespace webrtc | 401 } // namespace webrtc |
| 402 | 402 |
| 403 #endif // TALK_APP_WEBRTC_MEDIASTREAMSIGNALING_H_ | 403 #endif // TALK_APP_WEBRTC_MEDIASTREAMSIGNALING_H_ |
| OLD | NEW |