Browse Source

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 năm trước cách đây
mục cha
commit
56b93c7601
1 tập tin đã thay đổi với 4 bổ sung2 xóa
  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)