Quellcode durchsuchen

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.
tt2468 vor 3 Jahren
Ursprung
Commit
079e6cebee
1 geänderte Dateien mit 4 neuen und 0 gelöschten Zeilen
  1. 4 0
      libobs/obs-source.c

+ 4 - 0
libobs/obs-source.c

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