Enables comparison with infinite timestamps.

Bug: webrtc:8415
Change-Id: Ia96c7a537d994c281d8b24e648dbb2e17de3ed4a
Reviewed-on: https://webrtc-review.googlesource.com/78182
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23383}
diff --git a/api/units/timestamp.h b/api/units/timestamp.h
index af62b3b..40f3e92 100644
--- a/api/units/timestamp.h
+++ b/api/units/timestamp.h
@@ -78,10 +78,18 @@
   bool operator!=(const Timestamp& other) const {
     return microseconds_ != other.microseconds_;
   }
-  bool operator<=(const Timestamp& other) const { return us() <= other.us(); }
-  bool operator>=(const Timestamp& other) const { return us() >= other.us(); }
-  bool operator>(const Timestamp& other) const { return us() > other.us(); }
-  bool operator<(const Timestamp& other) const { return us() < other.us(); }
+  bool operator<=(const Timestamp& other) const {
+    return microseconds_ <= other.microseconds_;
+  }
+  bool operator>=(const Timestamp& other) const {
+    return microseconds_ >= other.microseconds_;
+  }
+  bool operator>(const Timestamp& other) const {
+    return microseconds_ > other.microseconds_;
+  }
+  bool operator<(const Timestamp& other) const {
+    return microseconds_ < other.microseconds_;
+  }
 
  private:
   explicit Timestamp(int64_t us) : microseconds_(us) {}
diff --git a/api/units/timestamp_unittest.cc b/api/units/timestamp_unittest.cc
index 549a9c8..3b2770c 100644
--- a/api/units/timestamp_unittest.cc
+++ b/api/units/timestamp_unittest.cc
@@ -46,6 +46,8 @@
   const int64_t kLarge = 451;
 
   EXPECT_EQ(Timestamp::Infinity(), Timestamp::Infinity());
+  EXPECT_GE(Timestamp::Infinity(), Timestamp::Infinity());
+  EXPECT_GT(Timestamp::Infinity(), Timestamp::ms(kLarge));
   EXPECT_EQ(Timestamp::ms(kSmall), Timestamp::ms(kSmall));
   EXPECT_LE(Timestamp::ms(kSmall), Timestamp::ms(kSmall));
   EXPECT_GE(Timestamp::ms(kSmall), Timestamp::ms(kSmall));