| 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 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 834 observer_->OnRemoveStream(stream); | 834 observer_->OnRemoveStream(stream); |
| 835 } | 835 } |
| 836 | 836 |
| 837 void PeerConnection::OnAddDataChannel(DataChannelInterface* data_channel) { | 837 void PeerConnection::OnAddDataChannel(DataChannelInterface* data_channel) { |
| 838 observer_->OnDataChannel(DataChannelProxy::Create(signaling_thread(), | 838 observer_->OnDataChannel(DataChannelProxy::Create(signaling_thread(), |
| 839 data_channel)); | 839 data_channel)); |
| 840 } | 840 } |
| 841 | 841 |
| 842 void PeerConnection::OnAddRemoteAudioTrack(MediaStreamInterface* stream, | 842 void PeerConnection::OnAddRemoteAudioTrack(MediaStreamInterface* stream, |
| 843 AudioTrackInterface* audio_track, | 843 AudioTrackInterface* audio_track, |
| 844 uint32 ssrc) { | 844 uint32_t ssrc) { |
| 845 receivers_.push_back(new AudioRtpReceiver(audio_track, ssrc, session_.get())); | 845 receivers_.push_back(new AudioRtpReceiver(audio_track, ssrc, session_.get())); |
| 846 } | 846 } |
| 847 | 847 |
| 848 void PeerConnection::OnAddRemoteVideoTrack(MediaStreamInterface* stream, | 848 void PeerConnection::OnAddRemoteVideoTrack(MediaStreamInterface* stream, |
| 849 VideoTrackInterface* video_track, | 849 VideoTrackInterface* video_track, |
| 850 uint32 ssrc) { | 850 uint32_t ssrc) { |
| 851 receivers_.push_back(new VideoRtpReceiver(video_track, ssrc, session_.get())); | 851 receivers_.push_back(new VideoRtpReceiver(video_track, ssrc, session_.get())); |
| 852 } | 852 } |
| 853 | 853 |
| 854 // TODO(deadbeef): Keep RtpReceivers around even if track goes away in remote | 854 // TODO(deadbeef): Keep RtpReceivers around even if track goes away in remote |
| 855 // description. | 855 // description. |
| 856 void PeerConnection::OnRemoveRemoteAudioTrack( | 856 void PeerConnection::OnRemoveRemoteAudioTrack( |
| 857 MediaStreamInterface* stream, | 857 MediaStreamInterface* stream, |
| 858 AudioTrackInterface* audio_track) { | 858 AudioTrackInterface* audio_track) { |
| 859 auto it = FindReceiverForTrack(audio_track); | 859 auto it = FindReceiverForTrack(audio_track); |
| 860 if (it == receivers_.end()) { | 860 if (it == receivers_.end()) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 874 LOG(LS_WARNING) << "RtpReceiver for track with id " << video_track->id() | 874 LOG(LS_WARNING) << "RtpReceiver for track with id " << video_track->id() |
| 875 << " doesn't exist."; | 875 << " doesn't exist."; |
| 876 } else { | 876 } else { |
| 877 (*it)->Stop(); | 877 (*it)->Stop(); |
| 878 receivers_.erase(it); | 878 receivers_.erase(it); |
| 879 } | 879 } |
| 880 } | 880 } |
| 881 | 881 |
| 882 void PeerConnection::OnAddLocalAudioTrack(MediaStreamInterface* stream, | 882 void PeerConnection::OnAddLocalAudioTrack(MediaStreamInterface* stream, |
| 883 AudioTrackInterface* audio_track, | 883 AudioTrackInterface* audio_track, |
| 884 uint32 ssrc) { | 884 uint32_t ssrc) { |
| 885 senders_.push_back(new AudioRtpSender(audio_track, ssrc, session_.get())); | 885 senders_.push_back(new AudioRtpSender(audio_track, ssrc, session_.get())); |
| 886 stats_->AddLocalAudioTrack(audio_track, ssrc); | 886 stats_->AddLocalAudioTrack(audio_track, ssrc); |
| 887 } | 887 } |
| 888 | 888 |
| 889 void PeerConnection::OnAddLocalVideoTrack(MediaStreamInterface* stream, | 889 void PeerConnection::OnAddLocalVideoTrack(MediaStreamInterface* stream, |
| 890 VideoTrackInterface* video_track, | 890 VideoTrackInterface* video_track, |
| 891 uint32 ssrc) { | 891 uint32_t ssrc) { |
| 892 senders_.push_back(new VideoRtpSender(video_track, ssrc, session_.get())); | 892 senders_.push_back(new VideoRtpSender(video_track, ssrc, session_.get())); |
| 893 } | 893 } |
| 894 | 894 |
| 895 // TODO(deadbeef): Keep RtpSenders around even if track goes away in local | 895 // TODO(deadbeef): Keep RtpSenders around even if track goes away in local |
| 896 // description. | 896 // description. |
| 897 void PeerConnection::OnRemoveLocalAudioTrack(MediaStreamInterface* stream, | 897 void PeerConnection::OnRemoveLocalAudioTrack(MediaStreamInterface* stream, |
| 898 AudioTrackInterface* audio_track, | 898 AudioTrackInterface* audio_track, |
| 899 uint32 ssrc) { | 899 uint32_t ssrc) { |
| 900 auto it = FindSenderForTrack(audio_track); | 900 auto it = FindSenderForTrack(audio_track); |
| 901 if (it == senders_.end()) { | 901 if (it == senders_.end()) { |
| 902 LOG(LS_WARNING) << "RtpSender for track with id " << audio_track->id() | 902 LOG(LS_WARNING) << "RtpSender for track with id " << audio_track->id() |
| 903 << " doesn't exist."; | 903 << " doesn't exist."; |
| 904 return; | 904 return; |
| 905 } else { | 905 } else { |
| 906 (*it)->Stop(); | 906 (*it)->Stop(); |
| 907 senders_.erase(it); | 907 senders_.erase(it); |
| 908 } | 908 } |
| 909 stats_->RemoveLocalAudioTrack(audio_track, ssrc); | 909 stats_->RemoveLocalAudioTrack(audio_track, ssrc); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 989 std::vector<rtc::scoped_refptr<RtpReceiverInterface>>::iterator | 989 std::vector<rtc::scoped_refptr<RtpReceiverInterface>>::iterator |
| 990 PeerConnection::FindReceiverForTrack(MediaStreamTrackInterface* track) { | 990 PeerConnection::FindReceiverForTrack(MediaStreamTrackInterface* track) { |
| 991 return std::find_if( | 991 return std::find_if( |
| 992 receivers_.begin(), receivers_.end(), | 992 receivers_.begin(), receivers_.end(), |
| 993 [track](const rtc::scoped_refptr<RtpReceiverInterface>& receiver) { | 993 [track](const rtc::scoped_refptr<RtpReceiverInterface>& receiver) { |
| 994 return receiver->track() == track; | 994 return receiver->track() == track; |
| 995 }); | 995 }); |
| 996 } | 996 } |
| 997 | 997 |
| 998 } // namespace webrtc | 998 } // namespace webrtc |
| OLD | NEW |