diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2020-07-14 15:46:16 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2020-07-14 15:51:38 -0700 |
commit | b75da7c41ea49c78ac9362f8837d4df9469613c6 (patch) | |
tree | f8ee4f7ad88a8dbd63868cb32734b0c2c6fdb4a8 /src/rmd_math.h | |
parent | 48dae516a3fadc46eaf3228eb519728e2a3961e6 (diff) |
timer: implement AV-sync
This is focused on keeping --on-the-fly-encoding in sync even
over long videos. The existing code inevitably would fall into a
permanently negative pdata->avd value letting things get
increasingly out of sync and never correcting.
Before removing the vestigial negative avd "don't wait" logic
from get_frame when this permanently negative avd state was
entered, get_frame would just start sampling at an unregulated
fps.
The timer thread which drives get_frame now consults avd on every
tick, Depending on which which half is ahead, the timer will
either cause get_frame to drop frames by advancing the frameno by
more than one, or it will adjust its sleep delay in proportion to
the delta.
See comments in rmd_timer.c for more details.
Note that in testing especially with a loaded system I observed
some surprisingly large deltas where multi-second sleeps occurred
to let the sound catch back up. I expect to revisit this issue
more in the future, but would just like to get things more
correct for now.
Diffstat (limited to 'src/rmd_math.h')
0 files changed, 0 insertions, 0 deletions