From f9349028ee1f3490ddc1886a7f68449d8235c63f Mon Sep 17 00:00:00 2001 From: derrod Date: Sun, 8 Dec 2024 21:17:52 +0100 Subject: [PATCH] libobs: Only modify raw_active counter if (dis-)connection succeeded --- libobs/obs.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libobs/obs.c b/libobs/obs.c index 845c9d49b7e6c1..81c96036bb99ef 100644 --- a/libobs/obs.c +++ b/libobs/obs.c @@ -2929,17 +2929,19 @@ 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) + if (!video) + return; + if (video_output_connect2(v, conversion, frame_rate_divisor, callback, param)) os_atomic_inc_long(&video->raw_active); - video_output_connect2(v, conversion, frame_rate_divisor, callback, param); } 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) + if (!video) + return; + if (video_output_disconnect2(v, callback, param)) os_atomic_dec_long(&video->raw_active); - video_output_disconnect(v, callback, param); } void obs_add_raw_video_callback(const struct video_scale_info *conversion,