Add LiGetMillis() for clients to use for latency calculation

This commit is contained in:
Cameron Gutman
2018-09-25 00:47:22 -07:00
parent b2ebba2167
commit dd7820f100
5 changed files with 15 additions and 7 deletions

View File

@@ -105,9 +105,9 @@ typedef struct _DECODE_UNIT {
// Frame type
int frameType;
// Receive time of first buffer
// NOTE: This will be populated from gettimeofday() if !HAVE_CLOCK_GETTIME and
// populated from clock_gettime(CLOCK_MONOTONIC) if HAVE_CLOCK_GETTIME
// Receive time of first buffer. This value uses an implementation-defined epoch.
// To compute actual latency values, use LiGetMillis() to get a timestamp that
// shares the same epoch as this value.
unsigned long long receiveTimeMs;
// Length of the entire buffer chain in bytes
@@ -389,6 +389,11 @@ int LiSendMultiControllerEvent(short controllerNumber, short activeGamepadMask,
// This function queues a vertical scroll event to the remote server.
int LiSendScrollEvent(signed char scrollClicks);
// This function returns a time in milliseconds with an implementation-defined epoch.
// NOTE: This will be populated from gettimeofday() if !HAVE_CLOCK_GETTIME and
// populated from clock_gettime(CLOCK_MONOTONIC) if HAVE_CLOCK_GETTIME.
unsigned long long LiGetMillis(void);
#ifdef __cplusplus
}
#endif

View File

@@ -88,3 +88,7 @@ void LiInitializeConnectionCallbacks(PCONNECTION_LISTENER_CALLBACKS clCallbacks)
void LiInitializeServerInformation(PSERVER_INFORMATION serverInfo) {
memset(serverInfo, 0, sizeof(*serverInfo));
}
unsigned long long LiGetMillis(void) {
return PltGetMillis();
}

View File

@@ -293,7 +293,7 @@ int PltWaitForEvent(PLT_EVENT* event) {
#endif
}
uint64_t PltGetMillis(void) {
unsigned long long PltGetMillis(void) {
#if defined(LC_WINDOWS)
return GetTickCount64();
#elif HAVE_CLOCK_GETTIME

View File

@@ -2,7 +2,6 @@
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
@@ -63,4 +62,4 @@
int initializePlatform(void);
void cleanupPlatform(void);
uint64_t PltGetMillis(void);
unsigned long long PltGetMillis(void);

View File

@@ -8,7 +8,7 @@
typedef struct _RTP_QUEUE_ENTRY {
PRTP_PACKET packet;
uint64_t queueTimeMs;
unsigned long long queueTimeMs;
struct _RTP_QUEUE_ENTRY* next;
struct _RTP_QUEUE_ENTRY* prev;