瀏覽代碼

libobs: Start video output even if there is no mix

This fixes a change in PR 11605 that breaks Decklink video outputs.
get_mix_for_video() returns NULL for those outputs, causing
start_raw_video() to return before connecting the output.
Marco 3 月之前
父節點
當前提交
46ce91e582
共有 1 個文件被更改,包括 10 次插入6 次删除
  1. 10 6
      libobs/obs.c

+ 10 - 6
libobs/obs.c

@@ -3047,18 +3047,22 @@ void start_raw_video(video_t *v, const struct video_scale_info *conversion, uint
 		     void (*callback)(void *param, struct video_data *frame), void *param)
 {
 	struct obs_core_video_mix *video = get_mix_for_video(v);
-	if (!video)
-		return;
-	if (video_output_connect2(v, conversion, frame_rate_divisor, callback, param))
+
+	// TODO: Make affected outputs use views/canvasses, and revert this later.
+	// https://github.com/obsproject/obs-studio/pull/12379
+	// https://github.com/obsproject/obs-studio/issues/12366
+	if (video_output_connect2(v, conversion, frame_rate_divisor, callback, param) && video)
 		os_atomic_inc_long(&video->raw_active);
 }
 
 void stop_raw_video(video_t *v, void (*callback)(void *param, struct video_data *frame), void *param)
 {
 	struct obs_core_video_mix *video = get_mix_for_video(v);
-	if (!video)
-		return;
-	if (video_output_disconnect2(v, callback, param))
+
+	// TODO: Make affected outputs use views/canvasses, and revert this later.
+	// https://github.com/obsproject/obs-studio/pull/12379
+	// https://github.com/obsproject/obs-studio/issues/12366
+	if (video_output_disconnect2(v, callback, param) && video)
 		os_atomic_dec_long(&video->raw_active);
 }