| 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 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 observer_->OnRemoveStream(stream); | 855 observer_->OnRemoveStream(stream); |
| 856 } | 856 } |
| 857 | 857 |
| 858 void PeerConnection::OnAddDataChannel(DataChannelInterface* data_channel) { | 858 void PeerConnection::OnAddDataChannel(DataChannelInterface* data_channel) { |
| 859 observer_->OnDataChannel(DataChannelProxy::Create(signaling_thread(), | 859 observer_->OnDataChannel(DataChannelProxy::Create(signaling_thread(), |
| 860 data_channel)); | 860 data_channel)); |
| 861 } | 861 } |
| 862 | 862 |
| 863 void PeerConnection::OnAddRemoteAudioTrack(MediaStreamInterface* stream, | 863 void PeerConnection::OnAddRemoteAudioTrack(MediaStreamInterface* stream, |
| 864 AudioTrackInterface* audio_track, | 864 AudioTrackInterface* audio_track, |
| 865 uint32 ssrc) { | 865 uint32_t ssrc) { |
| 866 receivers_.push_back(new AudioRtpReceiver(audio_track, ssrc, session_.get())); | 866 receivers_.push_back(new AudioRtpReceiver(audio_track, ssrc, session_.get())); |
| 867 } | 867 } |
| 868 | 868 |
| 869 void PeerConnection::OnAddRemoteVideoTrack(MediaStreamInterface* stream, | 869 void PeerConnection::OnAddRemoteVideoTrack(MediaStreamInterface* stream, |
| 870 VideoTrackInterface* video_track, | 870 VideoTrackInterface* video_track, |
| 871 uint32 ssrc) { | 871 uint32_t ssrc) { |
| 872 receivers_.push_back(new VideoRtpReceiver(video_track, ssrc, session_.get())); | 872 receivers_.push_back(new VideoRtpReceiver(video_track, ssrc, session_.get())); |
| 873 } | 873 } |
| 874 | 874 |
| 875 // TODO(deadbeef): Keep RtpReceivers around even if track goes away in remote | 875 // TODO(deadbeef): Keep RtpReceivers around even if track goes away in remote |
| 876 // description. | 876 // description. |
| 877 void PeerConnection::OnRemoveRemoteAudioTrack( | 877 void PeerConnection::OnRemoveRemoteAudioTrack( |
| 878 MediaStreamInterface* stream, | 878 MediaStreamInterface* stream, |
| 879 AudioTrackInterface* audio_track) { | 879 AudioTrackInterface* audio_track) { |
| 880 auto it = FindReceiverForTrack(audio_track); | 880 auto it = FindReceiverForTrack(audio_track); |
| 881 if (it == receivers_.end()) { | 881 if (it == receivers_.end()) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 895 LOG(LS_WARNING) << "RtpReceiver for track with id " << video_track->id() | 895 LOG(LS_WARNING) << "RtpReceiver for track with id " << video_track->id() |
| 896 << " doesn't exist."; | 896 << " doesn't exist."; |
| 897 } else { | 897 } else { |
| 898 (*it)->Stop(); | 898 (*it)->Stop(); |
| 899 receivers_.erase(it); | 899 receivers_.erase(it); |
| 900 } | 900 } |
| 901 } | 901 } |
| 902 | 902 |
| 903 void PeerConnection::OnAddLocalAudioTrack(MediaStreamInterface* stream, | 903 void PeerConnection::OnAddLocalAudioTrack(MediaStreamInterface* stream, |
| 904 AudioTrackInterface* audio_track, | 904 AudioTrackInterface* audio_track, |
| 905 uint32 ssrc) { | 905 uint32_t ssrc) { |
| 906 senders_.push_back(new AudioRtpSender(audio_track, ssrc, session_.get())); | 906 senders_.push_back(new AudioRtpSender(audio_track, ssrc, session_.get())); |
| 907 stats_->AddLocalAudioTrack(audio_track, ssrc); | 907 stats_->AddLocalAudioTrack(audio_track, ssrc); |
| 908 } | 908 } |
| 909 | 909 |
| 910 void PeerConnection::OnAddLocalVideoTrack(MediaStreamInterface* stream, | 910 void PeerConnection::OnAddLocalVideoTrack(MediaStreamInterface* stream, |
| 911 VideoTrackInterface* video_track, | 911 VideoTrackInterface* video_track, |
| 912 uint32 ssrc) { | 912 uint32_t ssrc) { |
| 913 senders_.push_back(new VideoRtpSender(video_track, ssrc, session_.get())); | 913 senders_.push_back(new VideoRtpSender(video_track, ssrc, session_.get())); |
| 914 } | 914 } |
| 915 | 915 |
| 916 // TODO(deadbeef): Keep RtpSenders around even if track goes away in local | 916 // TODO(deadbeef): Keep RtpSenders around even if track goes away in local |
| 917 // description. | 917 // description. |
| 918 void PeerConnection::OnRemoveLocalAudioTrack(MediaStreamInterface* stream, | 918 void PeerConnection::OnRemoveLocalAudioTrack(MediaStreamInterface* stream, |
| 919 AudioTrackInterface* audio_track, | 919 AudioTrackInterface* audio_track, |
| 920 uint32 ssrc) { | 920 uint32_t ssrc) { |
| 921 auto it = FindSenderForTrack(audio_track); | 921 auto it = FindSenderForTrack(audio_track); |
| 922 if (it == senders_.end()) { | 922 if (it == senders_.end()) { |
| 923 LOG(LS_WARNING) << "RtpSender for track with id " << audio_track->id() | 923 LOG(LS_WARNING) << "RtpSender for track with id " << audio_track->id() |
| 924 << " doesn't exist."; | 924 << " doesn't exist."; |
| 925 return; | 925 return; |
| 926 } else { | 926 } else { |
| 927 (*it)->Stop(); | 927 (*it)->Stop(); |
| 928 senders_.erase(it); | 928 senders_.erase(it); |
| 929 } | 929 } |
| 930 stats_->RemoveLocalAudioTrack(audio_track, ssrc); | 930 stats_->RemoveLocalAudioTrack(audio_track, ssrc); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1010 std::vector<rtc::scoped_refptr<RtpReceiverInterface>>::iterator | 1010 std::vector<rtc::scoped_refptr<RtpReceiverInterface>>::iterator |
| 1011 PeerConnection::FindReceiverForTrack(MediaStreamTrackInterface* track) { | 1011 PeerConnection::FindReceiverForTrack(MediaStreamTrackInterface* track) { |
| 1012 return std::find_if( | 1012 return std::find_if( |
| 1013 receivers_.begin(), receivers_.end(), | 1013 receivers_.begin(), receivers_.end(), |
| 1014 [track](const rtc::scoped_refptr<RtpReceiverInterface>& receiver) { | 1014 [track](const rtc::scoped_refptr<RtpReceiverInterface>& receiver) { |
| 1015 return receiver->track() == track; | 1015 return receiver->track() == track; |
| 1016 }); | 1016 }); |
| 1017 } | 1017 } |
| 1018 | 1018 |
| 1019 } // namespace webrtc | 1019 } // namespace webrtc |
| OLD | NEW |