瀏覽代碼

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)