libobs: Free async cache when sources output NULL frames

When sources output NULL frames, it is generally used to disable the
source and prevent the last frame from being left on screen. However,
when the source begins outputting video again, the last frame is
still in the async cache.

Depending on the stability of the source's frame output, this still
frame can end up being shown for 5+ output frames.

By freeing the async cache when a NULL frame is submitted, we avoid
the issue of old frames being re-displayed.
This commit is contained in:
tt2468 2021-11-23 22:26:58 -08:00 committed by Jim
parent 67d2b50a91
commit 079e6cebee

View File

@ -2940,7 +2940,11 @@ obs_source_output_video_internal(obs_source_t *source,
return;
if (!frame) {
pthread_mutex_lock(&source->async_mutex);
source->async_active = false;
source->last_frame_ts = 0;
free_async_cache(source);
pthread_mutex_unlock(&source->async_mutex);
return;
}