mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-11-12 14:57:20 +00:00
[client/idd] input: reduce network latency
Route input through a dedicated high-priority stream, send pointer motion as cumulative datagrams, and recover suspected loss reliably. Reduce downstream input queuing with age-aware coalescing and input thread scheduling.
This commit is contained in:
@@ -601,7 +601,7 @@ static LG_TransportStatus networkAudioSendDatagramNL(NetworkAudio * audio,
|
||||
{
|
||||
return networkConnectionSendDatagram(audio->connection,
|
||||
LG_NET_SERVICE_AUDIO, messageType, audio->serviceVersion, 0,
|
||||
audio->subscriptionEpoch, requestID, payload, payloadLength, false);
|
||||
audio->subscriptionEpoch, requestID, payload, payloadLength, 0, false);
|
||||
}
|
||||
|
||||
static bool networkAudioSendSubscribeNL(NetworkAudio * audio)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -51,6 +51,8 @@ typedef void (*NetworkConnectionStateFn)(void * opaque, bool connected,
|
||||
LG_TransportStatus reason);
|
||||
typedef void (*NetworkSendReadyFn)(void * opaque, LGNetService service,
|
||||
NetworkPacketDelivery delivery);
|
||||
typedef void (*NetworkDatagramLostFn)(void * opaque, LGNetService service,
|
||||
uint64_t componentEpoch, uint64_t applicationSequence);
|
||||
|
||||
typedef struct NetworkConnectionParams
|
||||
{
|
||||
@@ -63,6 +65,7 @@ typedef struct NetworkConnectionParams
|
||||
NetworkPacketFn packet;
|
||||
NetworkConnectionStateFn state;
|
||||
NetworkSendReadyFn sendReady;
|
||||
NetworkDatagramLostFn datagramLost;
|
||||
const LGNetCapability * capabilities;
|
||||
uint32_t capabilityCount;
|
||||
void * opaque;
|
||||
@@ -92,7 +95,8 @@ LG_TransportStatus networkConnectionSendDatagram(
|
||||
NetworkConnection * connection, LGNetService service,
|
||||
uint16_t messageType, uint16_t serviceVersion,
|
||||
LGNetEnvelopeFlags flags, uint64_t componentEpoch, uint64_t requestID,
|
||||
const void * payload, uint32_t payloadLength, bool discardIfBlocked);
|
||||
const void * payload, uint32_t payloadLength,
|
||||
uint64_t applicationSequence, bool discardIfBlocked);
|
||||
LG_TransportStatus networkConnectionSendBulk(NetworkConnection * connection,
|
||||
LGNetService service, uint16_t messageType, uint16_t serviceVersion,
|
||||
LGNetEnvelopeFlags flags, uint64_t componentEpoch, uint64_t requestID,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -37,5 +37,9 @@ void networkInputDestroy(NetworkInput ** input);
|
||||
const LG_InputOps * networkInputGetOps(void);
|
||||
|
||||
void networkInputConnectionState(NetworkInput * input, bool connected);
|
||||
void networkInputSendReady(NetworkInput * input,
|
||||
NetworkPacketDelivery delivery);
|
||||
void networkInputDatagramLost(NetworkInput * input,
|
||||
uint64_t claimEpoch, uint64_t pointerSequence);
|
||||
bool networkInputPacket(NetworkInput * input,
|
||||
const LGNetPacketView * packet, bool datagram);
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
#define NETWORK_FILE_MAX_PAYLOAD \
|
||||
(LG_NET_FILE_CHUNK_HEADER_WIRE_SIZE + NETWORK_TRANSFER_CHUNK)
|
||||
#define NETWORK_VIDEO_MAX_PAYLOAD LG_NET_MAX_PAYLOAD_LENGTH
|
||||
#define NETWORK_INPUT_MAX_PAYLOAD LG_NET_INPUT_ABSOLUTE_WIRE_SIZE
|
||||
|
||||
static const LGNetCapability NETWORK_CAPABILITIES[] =
|
||||
{
|
||||
@@ -91,9 +92,9 @@ static const LGNetCapability NETWORK_CAPABILITIES[] =
|
||||
.flags = LG_NET_CAPABILITY_RELIABLE |
|
||||
LG_NET_CAPABILITY_DATAGRAM,
|
||||
.features = 0,
|
||||
.maxPayloadLength = NETWORK_MAX_PAYLOAD,
|
||||
.maxDatagramPayload = NETWORK_MAX_DATAGRAM,
|
||||
.maxBidirectionalStreams = 0,
|
||||
.maxPayloadLength = NETWORK_INPUT_MAX_PAYLOAD,
|
||||
.maxDatagramPayload = NETWORK_INPUT_MAX_PAYLOAD,
|
||||
.maxBidirectionalStreams = 1,
|
||||
.maxUnidirectionalStreams = 0,
|
||||
},
|
||||
{
|
||||
@@ -473,6 +474,8 @@ static void networkSendReady(void * opaque, LGNetService service,
|
||||
LG_Transport * this = opaque;
|
||||
const bool datagram =
|
||||
delivery == NETWORK_PACKET_DELIVERY_DATAGRAM;
|
||||
if (service == LG_NET_SERVICE_INPUT)
|
||||
networkInputSendReady(this->input, delivery);
|
||||
if (service == LG_NET_SERVICE_AUDIO &&
|
||||
delivery != NETWORK_PACKET_DELIVERY_BULK)
|
||||
networkAudioSendReady(this->audio, datagram);
|
||||
@@ -484,6 +487,15 @@ static void networkSendReady(void * opaque, LGNetService service,
|
||||
networkVideoSendReady(this->video, datagram);
|
||||
}
|
||||
|
||||
static void networkDatagramLost(void * opaque, LGNetService service,
|
||||
uint64_t componentEpoch, uint64_t applicationSequence)
|
||||
{
|
||||
LG_Transport * this = opaque;
|
||||
if (service == LG_NET_SERVICE_INPUT)
|
||||
networkInputDatagramLost(
|
||||
this->input, componentEpoch, applicationSequence);
|
||||
}
|
||||
|
||||
static bool networkCreate(LG_Transport ** result)
|
||||
{
|
||||
if (!result)
|
||||
@@ -552,6 +564,7 @@ static bool networkCreate(LG_Transport ** result)
|
||||
.packet = networkPacket,
|
||||
.state = networkConnectionState,
|
||||
.sendReady = networkSendReady,
|
||||
.datagramLost = networkDatagramLost,
|
||||
.capabilities = NETWORK_CAPABILITIES,
|
||||
.capabilityCount = sizeof(NETWORK_CAPABILITIES) /
|
||||
sizeof(NETWORK_CAPABILITIES[0]),
|
||||
|
||||
@@ -592,7 +592,7 @@ static LG_TransportStatus networkVideoSendDatagramNL(NetworkVideo * video,
|
||||
{
|
||||
return networkConnectionSendDatagram(video->connection,
|
||||
LG_NET_SERVICE_VIDEO, messageType, video->serviceVersion, 0,
|
||||
componentEpoch, 0, payload, payloadLength, true);
|
||||
componentEpoch, 0, payload, payloadLength, 0, true);
|
||||
}
|
||||
|
||||
static void networkVideoSendSubscribeNL(NetworkVideo * video, uint64_t now)
|
||||
|
||||
Reference in New Issue
Block a user