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

Unified Diff: webrtc/stats/rtcstatscollector.h

Issue 2299643002: RTCStatsCollector: timestamps updated. (Closed)
Patch Set: uint64_t -> int64_t timestamps Created 4 years, 4 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 | « webrtc/stats/rtcstats_unittest.cc ('k') | webrtc/stats/rtcstatscollector.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/stats/rtcstatscollector.h
diff --git a/webrtc/stats/rtcstatscollector.h b/webrtc/stats/rtcstatscollector.h
index 1e4d6c3c2685f8e0961d78b9ca3c9b86eadf7624..735421d5410533e0b642125c3b27262aed30062a 100644
--- a/webrtc/stats/rtcstatscollector.h
+++ b/webrtc/stats/rtcstatscollector.h
@@ -16,7 +16,7 @@
#include "webrtc/api/rtcstats_objects.h"
#include "webrtc/api/rtcstatsreport.h"
#include "webrtc/base/scoped_ref_ptr.h"
-#include "webrtc/base/timing.h"
+#include "webrtc/base/timeutils.h"
namespace webrtc {
@@ -28,9 +28,7 @@ class RTCStatsCollector {
public:
explicit RTCStatsCollector(
PeerConnection* pc,
- double cache_lifetime = 0.05,
- std::unique_ptr<rtc::Timing> timing = std::unique_ptr<rtc::Timing>(
- new rtc::Timing()));
+ int64_t cache_lifetime_us = 50 * rtc::kNumMicrosecsPerMillisec);
// Gets a recent stats report. If there is a report cached that is still fresh
// it is returned, otherwise new stats are gathered and returned. A report is
@@ -44,13 +42,16 @@ class RTCStatsCollector {
private:
bool IsOnSignalingThread() const;
- std::unique_ptr<RTCPeerConnectionStats> ProducePeerConnectionStats() const;
+ std::unique_ptr<RTCPeerConnectionStats> ProducePeerConnectionStats(
+ int64_t timestamp_us) const;
PeerConnection* const pc_;
- mutable std::unique_ptr<rtc::Timing> timing_;
- // Time relative to the UNIX epoch (Jan 1, 1970, UTC), in seconds.
- double cache_timestamp_;
- double cache_lifetime_; // In seconds.
+ // A timestamp, in microseconds, that is based on a timer that is
+ // monotonically increasing. That is, even if the system clock is modified the
+ // difference between the timer and this timestamp is how fresh the cached
+ // report is.
+ int64_t cache_timestamp_us_;
+ int64_t cache_lifetime_us_;
rtc::scoped_refptr<const RTCStatsReport> cached_report_;
};
« no previous file with comments | « webrtc/stats/rtcstats_unittest.cc ('k') | webrtc/stats/rtcstatscollector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698