OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1194 std::move(video_media_info), | 1194 std::move(video_media_info), |
1195 pc_->GetSenders(), | 1195 pc_->GetSenders(), |
1196 pc_->GetReceivers())); | 1196 pc_->GetReceivers())); |
1197 return track_media_info_map; | 1197 return track_media_info_map; |
1198 } | 1198 } |
1199 | 1199 |
1200 std::map<MediaStreamTrackInterface*, std::string> | 1200 std::map<MediaStreamTrackInterface*, std::string> |
1201 RTCStatsCollector::PrepareTrackToID_s() const { | 1201 RTCStatsCollector::PrepareTrackToID_s() const { |
1202 RTC_DCHECK(signaling_thread_->IsCurrent()); | 1202 RTC_DCHECK(signaling_thread_->IsCurrent()); |
1203 std::map<MediaStreamTrackInterface*, std::string> track_to_id; | 1203 std::map<MediaStreamTrackInterface*, std::string> track_to_id; |
1204 StreamCollectionInterface* local_and_remote_streams[] = | 1204 for (auto sender : pc_->GetSenders()) { |
1205 { pc_->local_streams().get(), pc_->remote_streams().get() }; | 1205 auto track = sender->track(); |
1206 for (auto& streams : local_and_remote_streams) { | 1206 if (track) |
1207 if (streams) { | 1207 track_to_id[track.get()] = track->id(); |
1208 for (size_t i = 0; i < streams->count(); ++i) { | 1208 } |
1209 MediaStreamInterface* stream = streams->at(i); | 1209 for (auto receiver : pc_->GetReceivers()) { |
1210 for (const rtc::scoped_refptr<AudioTrackInterface>& audio_track : | 1210 auto track = receiver->track(); |
1211 stream->GetAudioTracks()) { | 1211 if (track) |
1212 track_to_id[audio_track.get()] = audio_track->id(); | 1212 track_to_id[track.get()] = track->id(); |
1213 } | |
1214 for (const rtc::scoped_refptr<VideoTrackInterface>& video_track : | |
1215 stream->GetVideoTracks()) { | |
1216 track_to_id[video_track.get()] = video_track->id(); | |
1217 } | |
1218 } | |
1219 } | |
1220 } | 1213 } |
1221 return track_to_id; | 1214 return track_to_id; |
1222 } | 1215 } |
1223 | 1216 |
1224 void RTCStatsCollector::OnDataChannelCreated(DataChannel* channel) { | 1217 void RTCStatsCollector::OnDataChannelCreated(DataChannel* channel) { |
1225 channel->SignalOpened.connect(this, &RTCStatsCollector::OnDataChannelOpened); | 1218 channel->SignalOpened.connect(this, &RTCStatsCollector::OnDataChannelOpened); |
1226 channel->SignalClosed.connect(this, &RTCStatsCollector::OnDataChannelClosed); | 1219 channel->SignalClosed.connect(this, &RTCStatsCollector::OnDataChannelClosed); |
1227 } | 1220 } |
1228 | 1221 |
1229 void RTCStatsCollector::OnDataChannelOpened(DataChannel* channel) { | 1222 void RTCStatsCollector::OnDataChannelOpened(DataChannel* channel) { |
(...skipping 18 matching lines...) Expand all Loading... |
1248 const std::string& type) { | 1241 const std::string& type) { |
1249 return CandidateTypeToRTCIceCandidateType(type); | 1242 return CandidateTypeToRTCIceCandidateType(type); |
1250 } | 1243 } |
1251 | 1244 |
1252 const char* DataStateToRTCDataChannelStateForTesting( | 1245 const char* DataStateToRTCDataChannelStateForTesting( |
1253 DataChannelInterface::DataState state) { | 1246 DataChannelInterface::DataState state) { |
1254 return DataStateToRTCDataChannelState(state); | 1247 return DataStateToRTCDataChannelState(state); |
1255 } | 1248 } |
1256 | 1249 |
1257 } // namespace webrtc | 1250 } // namespace webrtc |
OLD | NEW |