Forráskód Böngészése

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.

tududweb 3 éve
szülő
commit
07b0786892
1 módosított fájl, 2 hozzáadás és 1 törlés
  1. 2 1
      plugins/obs-ffmpeg/obs-ffmpeg-source.c

+ 2 - 1
plugins/obs-ffmpeg/obs-ffmpeg-source.c

@@ -337,7 +337,8 @@ static void ffmpeg_source_start(struct ffmpeg_source *s)
 		return;
 		return;
 
 
 	mp_media_play(&s->media, s->is_looping, s->reconnecting);
 	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);
 		obs_source_show_preloaded_video(s->source);
 	else
 	else
 		obs_source_output_video(s->source, NULL);
 		obs_source_output_video(s->source, NULL);