Преглед изворни кода

obs-ffmpeg: Fix media source always STATE_ENDED

Previously would always end up with OBS_MEDIA_STATE_ENDED whether the
video reaches the end or the user stops the source (state is set to
STOPPED, but becomes ENDED right after). This fixes it so that if the
user stops the source, it will remain stopped.
CodeYan01 пре 2 година
родитељ
комит
56b93c7601
1 измењених фајлова са 4 додато и 2 уклоњено
  1. 4 2
      plugins/obs-ffmpeg/obs-ffmpeg-source.c

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

@@ -316,8 +316,10 @@ static void media_stopped(void *opaque)
 	if ((s->close_when_inactive || !s->is_local_file) && s->media)
 		s->destroy_media = true;
 
-	set_media_state(s, OBS_MEDIA_STATE_ENDED);
-	obs_source_media_ended(s->source);
+	if (s->state != OBS_MEDIA_STATE_STOPPED) {
+		set_media_state(s, OBS_MEDIA_STATE_ENDED);
+		obs_source_media_ended(s->source);
+	}
 }
 
 static void ffmpeg_source_open(struct ffmpeg_source *s)