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

Unified Diff: webrtc/api/peerconnection.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/api/peerconnectioninterface_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/peerconnection.cc
diff --git a/webrtc/api/peerconnection.cc b/webrtc/api/peerconnection.cc
index 34beeffa7c152f78fce1486abd4c9f0b31647f3f..3fdbefb8a9f5dc39cd51fe339a3e8fd787f88348 100644
--- a/webrtc/api/peerconnection.cc
+++ b/webrtc/api/peerconnection.cc
@@ -886,6 +886,13 @@ bool PeerConnection::GetStats(StatsObserver* observer,
}
stats_->UpdateStats(level);
+ // The StatsCollector is used to tell if a track is valid because it may
+ // remember tracks that the PeerConnection previously removed.
+ if (track && !stats_->IsValidTrack(track->id())) {
+ LOG(LS_WARNING) << "GetStats is called with an invalid track: "
+ << track->id();
+ return false;
+ }
signaling_thread()->Post(RTC_FROM_HERE, this, MSG_GETSTATS,
new GetStatsMsg(observer, track));
return true;
« no previous file with comments | « no previous file | webrtc/api/peerconnectioninterface_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698