diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2020-07-13 13:07:29 -0700 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2020-07-14 15:51:33 -0700 |
commit | e4028bfe09ea77a99cc74ab03c9c3d69ae57d05e (patch) | |
tree | 601b8682629d11fc8165b776377b272222928e09 /src/rmd_get_frame.c | |
parent | 5bf7e838d38debacd4ad624f1f3024b26e83f9eb (diff) |
get_frame: don't let avd influence frame sampling
Maybe this made sense at some point in the original code, but the
way I have this setup currently get_frame() should strictly
capture a frame on every tick of the timer at the desired FPS to
the best of its ability.
The capture_frameno gets propagated to the encoder whenever a new
frame is acquired on that timer. When the encoder consumes it,
it should just dupe the frame to fill any gaps between the last
encoded frameno and the new one.
As-is, this avd value seems to drift permanently negative
eventually at which point get_frame() ceases ever waiting on the
timer. That's obviously broken, and devolves into a pinned CPU
with get_frame() attempting an infinitely high frame rate. Which
likely just makes things worse not better by starving the encoder
of CPU time.
I need to go check out the encoder now to make sure it fills
frameno gaps.
Diffstat (limited to 'src/rmd_get_frame.c')
-rw-r--r-- | src/rmd_get_frame.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/rmd_get_frame.c b/src/rmd_get_frame.c index 3f5c084..86d56f7 100644 --- a/src/rmd_get_frame.c +++ b/src/rmd_get_frame.c @@ -331,13 +331,9 @@ void *rmdGetFrame(ProgData *pdata) { while (pdata->running) { unsigned time_frameno; - //if we are left behind we must not wait. - //also before actually pausing we must make sure the streams - //are synced. sound stops so this should only happen quickly. pthread_mutex_lock(&pdata->time_mutex); - while ( (pdata->avd > 0 || pdata->args.nosound) && - pdata->capture_frameno >= pdata->time_frameno) - pthread_cond_wait(&pdata->time_cond, &pdata->time_mutex); + while (pdata->capture_frameno >= pdata->time_frameno) + pthread_cond_wait(&pdata->time_cond, &pdata->time_mutex); time_frameno = pdata->time_frameno; pthread_mutex_unlock(&pdata->time_mutex); |