From 2341ddfcd96f72cc4ee2c4f1e091ff2306caf62a Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Fri, 13 Nov 2020 21:58:22 -0800 Subject: opendev: bump granularity of audio capture periods This only applies to ALSA, but the av-sync precision is entirely dependent on the granularity of what ALSA refers to as "periods". The pdata->avd delay is decremented by the audio capture in period aligned steps, meaning the smallest decrement it can possibly do is the period size. Between these period sized intervals, rmdGetFrames kind of flies blind if the FPS is high enough for frametime to be substantially smaller than the period time. A smaller period does increase the ALSA capture overhead, basically increasing the number of times ALSA returns data to userspace, kind of like a higher interrupt rate. But it seems negligible for a modern system. --- src/rmd_opendev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/rmd_opendev.c') diff --git a/src/rmd_opendev.c b/src/rmd_opendev.c index c8460d9..e5347a3 100644 --- a/src/rmd_opendev.c +++ b/src/rmd_opendev.c @@ -52,7 +52,7 @@ snd_pcm_t *rmdOpenDev( const char *pcm_dev, { snd_pcm_t *mhandle; snd_pcm_hw_params_t *hwparams; - unsigned int periods = 2; + unsigned int periods = 4; unsigned int exactrate = *frequency; // The compiler might warn us because the expansion starts with -- cgit v1.2.1