From 6b0dd0b128bffdb05f3aa1fef2d64cd6166dd76f 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 | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libobs/obs.c b/libobs/obs.c index 845c9d49b7e6c1..2f9238db6ecc80 100644 --- a/libobs/obs.c +++ b/libobs/obs.c @@ -2929,17 +2929,15 @@ 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 && 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 && 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,