From 07b0786892c0acfdc83ab3cd6d111e651dfcf173 Mon Sep 17 00:00:00 2001 From: tududweb Date: Fri, 29 Jul 2022 01:59:24 +0800 Subject: [PATCH] obs-ffmpeg: Fix frame remain after changing file After changing the media source from video file to audio file, the last video's frame (preloaded) maybe still rendered. This commit ensures that when media source changed to another one without video, clean the source's video output, by simply add judgement to check whether the media has video. --- plugins/obs-ffmpeg/obs-ffmpeg-source.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/obs-ffmpeg/obs-ffmpeg-source.c b/plugins/obs-ffmpeg/obs-ffmpeg-source.c index f7791afdc2496..2a1156f9762ce 100644 --- a/plugins/obs-ffmpeg/obs-ffmpeg-source.c +++ b/plugins/obs-ffmpeg/obs-ffmpeg-source.c @@ -337,7 +337,8 @@ static void ffmpeg_source_start(struct ffmpeg_source *s) return; mp_media_play(&s->media, s->is_looping, s->reconnecting); - if (s->is_local_file && (s->is_clear_on_media_end || s->is_looping)) + if (s->is_local_file && s->media.has_video && + (s->is_clear_on_media_end || s->is_looping)) obs_source_show_preloaded_video(s->source); else obs_source_output_video(s->source, NULL);