mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-11-13 07:17:28 +00:00
[client] audio: reduce LGMP stream latency
Poll active audio streams every 25 to 250 microseconds and reset the adaptive delay whenever records arrive.
This commit is contained in:
@@ -37,7 +37,7 @@
|
|||||||
#include <sys/random.h>
|
#include <sys/random.h>
|
||||||
|
|
||||||
#define AUDIO_IDLE_POLL_MS 20U
|
#define AUDIO_IDLE_POLL_MS 20U
|
||||||
#define AUDIO_ACTIVE_POLL_MS 2U
|
#define AUDIO_ACTIVE_POLL_US 250U
|
||||||
#define AUDIO_CLAIM_RETRY_US 200000U
|
#define AUDIO_CLAIM_RETRY_US 200000U
|
||||||
#define AUDIO_OWNER_RETRY_US 1200000U
|
#define AUDIO_OWNER_RETRY_US 1200000U
|
||||||
#define AUDIO_DRAIN_MAX 32U
|
#define AUDIO_DRAIN_MAX 32U
|
||||||
@@ -1740,9 +1740,9 @@ static int audioThread(void * opaque)
|
|||||||
LGMPAudio * audio = opaque;
|
LGMPAudio * audio = opaque;
|
||||||
const struct LGMPStreamPollConfig pollConfig =
|
const struct LGMPStreamPollConfig pollConfig =
|
||||||
{
|
{
|
||||||
.spinCount = 32,
|
.spinCount = 64,
|
||||||
.minWaitUs = 100,
|
.minWaitUs = 25,
|
||||||
.maxWaitUs = AUDIO_ACTIVE_POLL_MS * 1000U,
|
.maxWaitUs = AUDIO_ACTIVE_POLL_US,
|
||||||
};
|
};
|
||||||
if (lgmpStreamPollInit(&audio->streamPoll, pollConfig) != LGMP_OK)
|
if (lgmpStreamPollInit(&audio->streamPoll, pollConfig) != LGMP_OK)
|
||||||
return -1;
|
return -1;
|
||||||
@@ -1751,6 +1751,8 @@ static int audioThread(void * opaque)
|
|||||||
{
|
{
|
||||||
processResponse(audio);
|
processResponse(audio);
|
||||||
const unsigned drained = drainInbound(audio);
|
const unsigned drained = drainInbound(audio);
|
||||||
|
if (drained)
|
||||||
|
lgmpStreamPollActivity(&audio->streamPoll);
|
||||||
maintainBinding(audio);
|
maintainBinding(audio);
|
||||||
if (atomic_exchange_explicit(
|
if (atomic_exchange_explicit(
|
||||||
&audio->dataPlaneLost, false, memory_order_acq_rel))
|
&audio->dataPlaneLost, false, memory_order_acq_rel))
|
||||||
|
|||||||
Reference in New Issue
Block a user