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

Unified Diff: webrtc/rtc_base/time_interval.cc

Issue 2979833002: Add a histogram metric tracking for how long audio RTP packets are sent (Closed)
Patch Set: Created 3 years, 5 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
Index: webrtc/rtc_base/time_interval.cc
diff --git a/webrtc/rtc_base/time_interval.cc b/webrtc/rtc_base/time_interval.cc
new file mode 100644
index 0000000000000000000000000000000000000000..940c424642dac4c45593df7c23b327ae98e097fd
--- /dev/null
+++ b/webrtc/rtc_base/time_interval.cc
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "webrtc/rtc_base/time_interval.h"
+#include "webrtc/rtc_base/timeutils.h"
+
+namespace rtc {
+
+TimeInterval::TimeInterval() {}
ossu 2017/07/14 11:13:15 = default instead of {}
saza WebRTC 2017/07/17 14:27:29 Done.
+TimeInterval::~TimeInterval() {}
ossu 2017/07/14 11:13:15 Same here.
saza WebRTC 2017/07/17 14:27:29 Done.
+
+void TimeInterval::Extend() {
+ Extend(TimeMillis());
+}
+
+void TimeInterval::Extend(int64_t time) {
+ if (!first_ || time < *first_) {
ossu 2017/07/14 11:13:15 Just a minor detail, but first_ and last_ aren't b
ossu 2017/07/14 15:37:32 Rietveld top-tip: If you reply to the comments ind
saza WebRTC 2017/07/17 14:27:29 Oh, thanks for the tip!
+ first_.emplace(time);
+ }
+ if (!last_ || *last_ < time) {
+ last_.emplace(time);
+ }
+}
+
+bool TimeInterval::Empty() const {
+ return !first_;
+}
+
+Optional<int64_t> TimeInterval::First() const {
+ return first_;
+}
+
+Optional<int64_t> TimeInterval::Last() const {
+ return last_;
+}
+
+} // namespace rtc

Powered by Google App Engine
This is Rietveld 408576698