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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/api/peerconnectioninterface_unittest.cc » ('j') | 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 868 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 MediaStreamTrackInterface* track, 879 MediaStreamTrackInterface* track,
880 StatsOutputLevel level) { 880 StatsOutputLevel level) {
881 TRACE_EVENT0("webrtc", "PeerConnection::GetStats"); 881 TRACE_EVENT0("webrtc", "PeerConnection::GetStats");
882 RTC_DCHECK(signaling_thread()->IsCurrent()); 882 RTC_DCHECK(signaling_thread()->IsCurrent());
883 if (!VERIFY(observer != NULL)) { 883 if (!VERIFY(observer != NULL)) {
884 LOG(LS_ERROR) << "GetStats - observer is NULL."; 884 LOG(LS_ERROR) << "GetStats - observer is NULL.";
885 return false; 885 return false;
886 } 886 }
887 887
888 stats_->UpdateStats(level); 888 stats_->UpdateStats(level);
889 // The StatsCollector is used to tell if a track is valid because it may
890 // remember tracks that the PeerConnection previously removed.
891 if (track && !stats_->IsValidTrack(track->id())) {
892 LOG(LS_WARNING) << "GetStats is called with an invalid track: "
893 << track->id();
894 return false;
895 }
889 signaling_thread()->Post(RTC_FROM_HERE, this, MSG_GETSTATS, 896 signaling_thread()->Post(RTC_FROM_HERE, this, MSG_GETSTATS,
890 new GetStatsMsg(observer, track)); 897 new GetStatsMsg(observer, track));
891 return true; 898 return true;
892 } 899 }
893 900
894 void PeerConnection::GetStats(RTCStatsCollectorCallback* callback) { 901 void PeerConnection::GetStats(RTCStatsCollectorCallback* callback) {
895 RTC_DCHECK(stats_collector_); 902 RTC_DCHECK(stats_collector_);
896 stats_collector_->GetStatsReport(callback); 903 stats_collector_->GetStatsReport(callback);
897 } 904 }
898 905
(...skipping 1443 matching lines...) Expand 10 before | Expand all | Expand 10 after
2342 2349
2343 bool PeerConnection::StartRtcEventLog_w(rtc::PlatformFile file, 2350 bool PeerConnection::StartRtcEventLog_w(rtc::PlatformFile file,
2344 int64_t max_size_bytes) { 2351 int64_t max_size_bytes) {
2345 return event_log_->StartLogging(file, max_size_bytes); 2352 return event_log_->StartLogging(file, max_size_bytes);
2346 } 2353 }
2347 2354
2348 void PeerConnection::StopRtcEventLog_w() { 2355 void PeerConnection::StopRtcEventLog_w() {
2349 event_log_->StopLogging(); 2356 event_log_->StopLogging();
2350 } 2357 }
2351 } // namespace webrtc 2358 } // namespace webrtc
OLDNEW
« 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