Skip to content

Commit

Permalink
obs-ffmpeg: Fix frame remain after changing file
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tuduweb authored and tt2468 committed Jul 28, 2022
1 parent 90b705f commit 07b0786
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion plugins/obs-ffmpeg/obs-ffmpeg-source.c
Expand Up @@ -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);
Expand Down

0 comments on commit 07b0786

Please sign in to comment.