From 11922265de65e16e22d0033cbc21a1183ea5fe50 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Wed, 2 Dec 2015 07:37:55 -0800 Subject: [PATCH] libobs: Keep reference to source when rendering --- libobs/obs-source.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/libobs/obs-source.c b/libobs/obs-source.c index 0ca393b06..40f080744 100644 --- a/libobs/obs-source.c +++ b/libobs/obs-source.c @@ -1412,11 +1412,8 @@ static inline void obs_source_main_render(obs_source_t *source) static bool ready_async_frame(obs_source_t *source, uint64_t sys_time); -void obs_source_video_render(obs_source_t *source) +static inline void render_video(obs_source_t *source) { - if (!obs_source_valid(source, "obs_source_video_render")) - return; - if (source->info.type != OBS_SOURCE_TYPE_FILTER && (source->info.output_flags & OBS_SOURCE_VIDEO) == 0) return; @@ -1445,6 +1442,16 @@ void obs_source_video_render(obs_source_t *source) obs_source_render_async_video(source); } +void obs_source_video_render(obs_source_t *source) +{ + if (!obs_source_valid(source, "obs_source_video_render")) + return; + + obs_source_addref(source); + render_video(source); + obs_source_release(source); +} + static uint32_t get_base_width(const obs_source_t *source) { bool is_filter = (source->info.type == OBS_SOURCE_TYPE_FILTER);