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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/pc/rtcstatscollector.cc
diff --git a/webrtc/pc/rtcstatscollector.cc b/webrtc/pc/rtcstatscollector.cc
index f5b8c8a936c1b569826ff20d98741e62ddb5e550..81b4d3e4d8ddf80d7622b4a233cb412613fdcae7 100644
--- a/webrtc/pc/rtcstatscollector.cc
+++ b/webrtc/pc/rtcstatscollector.cc
@@ -1201,22 +1201,15 @@ std::map<MediaStreamTrackInterface*, std::string>
RTCStatsCollector::PrepareTrackToID_s() const {
RTC_DCHECK(signaling_thread_->IsCurrent());
std::map<MediaStreamTrackInterface*, std::string> track_to_id;
- StreamCollectionInterface* local_and_remote_streams[] =
- { pc_->local_streams().get(), pc_->remote_streams().get() };
- for (auto& streams : local_and_remote_streams) {
- if (streams) {
- for (size_t i = 0; i < streams->count(); ++i) {
- MediaStreamInterface* stream = streams->at(i);
- for (const rtc::scoped_refptr<AudioTrackInterface>& audio_track :
- stream->GetAudioTracks()) {
- track_to_id[audio_track.get()] = audio_track->id();
- }
- for (const rtc::scoped_refptr<VideoTrackInterface>& video_track :
- stream->GetVideoTracks()) {
- track_to_id[video_track.get()] = video_track->id();
- }
- }
- }
+ for (auto sender : pc_->GetSenders()) {
+ auto track = sender->track();
+ if (track)
+ track_to_id[track.get()] = track->id();
+ }
+ for (auto receiver : pc_->GetReceivers()) {
+ auto track = receiver->track();
+ if (track)
+ track_to_id[track.get()] = track->id();
}
return track_to_id;
}
« 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