Skip to content

Commit

Permalink
libobs: Only modify raw_active counter if (dis-)connection succeeded
Browse files Browse the repository at this point in the history
  • Loading branch information
derrod committed Dec 10, 2024
1 parent 32b92b9 commit f934902
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions libobs/obs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit f934902

Please sign in to comment.