Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(308)

Side by Side Diff: webrtc/pc/rtcstatscollector.cc

Issue 2978793002: RTCStatsCollector: Get track IDs from senders/receivers instead of streams (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698