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

Side by Side Diff: webrtc/api/statscollector.cc

Issue 2470023004: Return false if PeerConnection::GetStats() is called on invalid tracks (Closed)
Patch Set: Created 4 years, 1 month 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
« webrtc/api/peerconnection.cc ('K') | « webrtc/api/statscollector.h ('k') | 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 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2012 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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 // FYI - for remote reports, the timestamp will be overwritten later. 542 // FYI - for remote reports, the timestamp will be overwritten later.
543 report->set_timestamp(stats_gathering_started_); 543 report->set_timestamp(stats_gathering_started_);
544 544
545 report->AddInt64(StatsReport::kStatsValueNameSsrc, ssrc); 545 report->AddInt64(StatsReport::kStatsValueNameSsrc, ssrc);
546 report->AddString(StatsReport::kStatsValueNameTrackId, track_id); 546 report->AddString(StatsReport::kStatsValueNameTrackId, track_id);
547 // Add the mapping of SSRC to transport. 547 // Add the mapping of SSRC to transport.
548 report->AddId(StatsReport::kStatsValueNameTransportId, transport_id); 548 report->AddId(StatsReport::kStatsValueNameTransportId, transport_id);
549 return report; 549 return report;
550 } 550 }
551 551
552 bool StatsCollector::IsValidTrack(MediaStreamTrackInterface* track) {
553 // The track is allowed to be a nullptr.
554 return !track ||
555 reports_.Find(StatsReport::NewTypedId(
556 StatsReport::kStatsReportTypeTrack, track->id())) != nullptr;
557 }
558
552 StatsReport* StatsCollector::AddCertificateReports( 559 StatsReport* StatsCollector::AddCertificateReports(
553 const rtc::SSLCertificate* cert) { 560 const rtc::SSLCertificate* cert) {
554 RTC_DCHECK(pc_->session()->signaling_thread()->IsCurrent()); 561 RTC_DCHECK(pc_->session()->signaling_thread()->IsCurrent());
555 RTC_DCHECK(cert != NULL); 562 RTC_DCHECK(cert != NULL);
556 563
557 std::unique_ptr<rtc::SSLCertificateStats> first_stats = cert->GetStats(); 564 std::unique_ptr<rtc::SSLCertificateStats> first_stats = cert->GetStats();
558 StatsReport* first_report = nullptr; 565 StatsReport* first_report = nullptr;
559 StatsReport* prev_report = nullptr; 566 StatsReport* prev_report = nullptr;
560 for (rtc::SSLCertificateStats* stats = first_stats.get(); stats; 567 for (rtc::SSLCertificateStats* stats = first_stats.get(); stats;
561 stats = stats->issuer.get()) { 568 stats = stats->issuer.get()) {
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 StatsReport* report = entry.second; 982 StatsReport* report = entry.second;
976 report->set_timestamp(stats_gathering_started_); 983 report->set_timestamp(stats_gathering_started_);
977 } 984 }
978 } 985 }
979 986
980 void StatsCollector::ClearUpdateStatsCacheForTest() { 987 void StatsCollector::ClearUpdateStatsCacheForTest() {
981 stats_gathering_started_ = 0; 988 stats_gathering_started_ = 0;
982 } 989 }
983 990
984 } // namespace webrtc 991 } // namespace webrtc
OLDNEW
« webrtc/api/peerconnection.cc ('K') | « webrtc/api/statscollector.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698