Add implicit conversion between rtc:PacketTime and int64_t.
This is a preparation for deleting rtc::PacketTime. Next step, after
downstream code has been updated to not access the |timestamp| member,
is to make rtc::PacketTime an alias for int64_t.
Also delete the unused member rtc::PacketTime::not_before.
Bug: webrtc:9584
Change-Id: Iba9d2d55047d69565ad62b1beb525591fd432ae2
Reviewed-on: https://webrtc-review.googlesource.com/c/108860
Commit-Queue: Niels Moller <nisse@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25468}
diff --git a/rtc_base/asyncpacketsocket.h b/rtc_base/asyncpacketsocket.h
index bb0b3bc..e671f0d 100644
--- a/rtc_base/asyncpacketsocket.h
+++ b/rtc_base/asyncpacketsocket.h
@@ -12,6 +12,7 @@
#define RTC_BASE_ASYNCPACKETSOCKET_H_
#include "rtc_base/constructormagic.h"
+#include "rtc_base/deprecation.h"
#include "rtc_base/dscp.h"
#include "rtc_base/socket.h"
#include "rtc_base/third_party/sigslot/sigslot.h"
@@ -53,21 +54,21 @@
// This structure will have the information about when packet is actually
// received by socket.
struct PacketTime {
- PacketTime() : timestamp(-1), not_before(-1) {}
- PacketTime(int64_t timestamp, int64_t not_before)
- : timestamp(timestamp), not_before(not_before) {}
+ PacketTime() : timestamp(-1) {}
+ // Intentionally implicit.
+ PacketTime(int64_t timestamp) : timestamp(timestamp) {}
+ // Deprecated
+ PacketTime(int64_t timestamp, int64_t /* not_before */)
+ : timestamp(timestamp) {}
+
+ operator int64_t() const { return timestamp; }
int64_t timestamp; // Receive time after socket delivers the data.
-
- // Earliest possible time the data could have arrived, indicating the
- // potential error in the |timestamp| value, in case the system, is busy. For
- // example, the time of the last select() call.
- // If unknown, this value will be set to zero.
- int64_t not_before;
};
-inline PacketTime CreatePacketTime(int64_t not_before) {
- return PacketTime(TimeMicros(), not_before);
+// Deprecated
+inline PacketTime CreatePacketTime(int64_t /* not_before */) {
+ return TimeMicros();
}
// Provides the ability to receive packets asynchronously. Sends are not