From e4028bfe09ea77a99cc74ab03c9c3d69ae57d05e Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Mon, 13 Jul 2020 13:07:29 -0700 Subject: 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. --- src/rmd_get_frame.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/rmd_get_frame.c') 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); -- cgit v1.2.3