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 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 default_remote_stream = | 732 default_remote_stream = |
733 remote_stream_factory_->CreateMediaStream(kDefaultStreamLabel); | 733 remote_stream_factory_->CreateMediaStream(kDefaultStreamLabel); |
734 remote_streams_->AddStream(default_remote_stream); | 734 remote_streams_->AddStream(default_remote_stream); |
735 } | 735 } |
736 if (remote_info_.default_audio_track_needed && | 736 if (remote_info_.default_audio_track_needed && |
737 default_remote_stream->GetAudioTracks().size() == 0) { | 737 default_remote_stream->GetAudioTracks().size() == 0) { |
738 remote_audio_tracks_.push_back(TrackInfo(kDefaultStreamLabel, | 738 remote_audio_tracks_.push_back(TrackInfo(kDefaultStreamLabel, |
739 kDefaultAudioTrackLabel, 0)); | 739 kDefaultAudioTrackLabel, 0)); |
740 | 740 |
741 OnRemoteTrackSeen(kDefaultStreamLabel, kDefaultAudioTrackLabel, 0, | 741 OnRemoteTrackSeen(kDefaultStreamLabel, kDefaultAudioTrackLabel, 0, |
742 cricket::MEDIA_TYPE_AUDIO); | 742 cricket::MEDIA_TYPE_AUDIO); |
743 } | 743 } |
744 if (remote_info_.default_video_track_needed && | 744 if (remote_info_.default_video_track_needed && |
745 default_remote_stream->GetVideoTracks().size() == 0) { | 745 default_remote_stream->GetVideoTracks().size() == 0) { |
746 remote_video_tracks_.push_back(TrackInfo(kDefaultStreamLabel, | 746 remote_video_tracks_.push_back(TrackInfo(kDefaultStreamLabel, |
747 kDefaultVideoTrackLabel, 0)); | 747 kDefaultVideoTrackLabel, 0)); |
748 OnRemoteTrackSeen(kDefaultStreamLabel, kDefaultVideoTrackLabel, 0, | 748 OnRemoteTrackSeen(kDefaultStreamLabel, kDefaultVideoTrackLabel, 0, |
749 cricket::MEDIA_TYPE_VIDEO); | 749 cricket::MEDIA_TYPE_VIDEO); |
750 } | 750 } |
751 if (default_created) { | 751 if (default_created) { |
752 stream_observer_->OnAddRemoteStream(default_remote_stream); | 752 stream_observer_->OnAddRemoteStream(default_remote_stream); |
753 } | 753 } |
754 } | 754 } |
755 | 755 |
756 MediaStreamSignaling::TrackInfos* MediaStreamSignaling::GetRemoteTracks( | 756 MediaStreamSignaling::TrackInfos* MediaStreamSignaling::GetRemoteTracks( |
757 cricket::MediaType type) { | 757 cricket::MediaType type) { |
758 if (type == cricket::MEDIA_TYPE_AUDIO) | 758 if (type == cricket::MEDIA_TYPE_AUDIO) |
759 return &remote_audio_tracks_; | 759 return &remote_audio_tracks_; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 // The sync_label is the MediaStream label and the |stream.id| is the | 800 // The sync_label is the MediaStream label and the |stream.id| is the |
801 // track id. | 801 // track id. |
802 const std::string& stream_label = it->sync_label; | 802 const std::string& stream_label = it->sync_label; |
803 const std::string& track_id = it->id; | 803 const std::string& track_id = it->id; |
804 uint32 ssrc = it->first_ssrc(); | 804 uint32 ssrc = it->first_ssrc(); |
805 const TrackInfo* track_info = FindTrackInfo(*current_tracks, | 805 const TrackInfo* track_info = FindTrackInfo(*current_tracks, |
806 stream_label, | 806 stream_label, |
807 track_id); | 807 track_id); |
808 if (!track_info) { | 808 if (!track_info) { |
809 current_tracks->push_back(TrackInfo(stream_label, track_id, ssrc)); | 809 current_tracks->push_back(TrackInfo(stream_label, track_id, ssrc)); |
810 OnLocalTrackSeen(stream_label, track_id, it->first_ssrc(), | 810 OnLocalTrackSeen(stream_label, track_id, it->first_ssrc(), media_type); |
811 media_type); | |
812 } | 811 } |
813 } | 812 } |
814 } | 813 } |
815 | 814 |
816 void MediaStreamSignaling::OnLocalTrackSeen( | 815 void MediaStreamSignaling::OnLocalTrackSeen(const std::string& stream_label, |
817 const std::string& stream_label, | 816 const std::string& track_id, |
818 const std::string& track_id, | 817 uint32 ssrc, |
819 uint32 ssrc, | 818 cricket::MediaType media_type) { |
820 cricket::MediaType media_type) { | |
821 MediaStreamInterface* stream = local_streams_->find(stream_label); | 819 MediaStreamInterface* stream = local_streams_->find(stream_label); |
822 if (!stream) { | 820 if (!stream) { |
823 LOG(LS_WARNING) << "An unknown local MediaStream with label " | 821 LOG(LS_WARNING) << "An unknown local MediaStream with label " |
824 << stream_label << " has been configured."; | 822 << stream_label << " has been configured."; |
825 return; | 823 return; |
826 } | 824 } |
827 | 825 |
828 if (media_type == cricket::MEDIA_TYPE_AUDIO) { | 826 if (media_type == cricket::MEDIA_TYPE_AUDIO) { |
829 AudioTrackInterface* audio_track = stream->FindAudioTrack(track_id); | 827 AudioTrackInterface* audio_track = stream->FindAudioTrack(track_id); |
830 if (!audio_track) { | 828 if (!audio_track) { |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1021 int MediaStreamSignaling::FindDataChannelBySid(int sid) const { | 1019 int MediaStreamSignaling::FindDataChannelBySid(int sid) const { |
1022 for (size_t i = 0; i < sctp_data_channels_.size(); ++i) { | 1020 for (size_t i = 0; i < sctp_data_channels_.size(); ++i) { |
1023 if (sctp_data_channels_[i]->id() == sid) { | 1021 if (sctp_data_channels_[i]->id() == sid) { |
1024 return static_cast<int>(i); | 1022 return static_cast<int>(i); |
1025 } | 1023 } |
1026 } | 1024 } |
1027 return -1; | 1025 return -1; |
1028 } | 1026 } |
1029 | 1027 |
1030 } // namespace webrtc | 1028 } // namespace webrtc |
OLD | NEW |