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

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

Issue 2470023004: Return false if PeerConnection::GetStats() is called on invalid tracks (Closed)
Patch Set: Change the function parameter. 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
« no previous file with comments | « 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(const std::string& track_id) {
553 return reports_.Find(StatsReport::NewTypedId(
554 StatsReport::kStatsReportTypeTrack, track_id)) != nullptr;
555 }
556
552 StatsReport* StatsCollector::AddCertificateReports( 557 StatsReport* StatsCollector::AddCertificateReports(
553 const rtc::SSLCertificate* cert) { 558 const rtc::SSLCertificate* cert) {
554 RTC_DCHECK(pc_->session()->signaling_thread()->IsCurrent()); 559 RTC_DCHECK(pc_->session()->signaling_thread()->IsCurrent());
555 RTC_DCHECK(cert != NULL); 560 RTC_DCHECK(cert != NULL);
556 561
557 std::unique_ptr<rtc::SSLCertificateStats> first_stats = cert->GetStats(); 562 std::unique_ptr<rtc::SSLCertificateStats> first_stats = cert->GetStats();
558 StatsReport* first_report = nullptr; 563 StatsReport* first_report = nullptr;
559 StatsReport* prev_report = nullptr; 564 StatsReport* prev_report = nullptr;
560 for (rtc::SSLCertificateStats* stats = first_stats.get(); stats; 565 for (rtc::SSLCertificateStats* stats = first_stats.get(); stats;
561 stats = stats->issuer.get()) { 566 stats = stats->issuer.get()) {
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 StatsReport* report = entry.second; 980 StatsReport* report = entry.second;
976 report->set_timestamp(stats_gathering_started_); 981 report->set_timestamp(stats_gathering_started_);
977 } 982 }
978 } 983 }
979 984
980 void StatsCollector::ClearUpdateStatsCacheForTest() { 985 void StatsCollector::ClearUpdateStatsCacheForTest() {
981 stats_gathering_started_ = 0; 986 stats_gathering_started_ = 0;
982 } 987 }
983 988
984 } // namespace webrtc 989 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/api/statscollector.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698