diff --git a/libobs/obs-source.c b/libobs/obs-source.c index f4d025e8b..0e23a26ed 100644 --- a/libobs/obs-source.c +++ b/libobs/obs-source.c @@ -196,6 +196,9 @@ obs_source_t *obs_source_create(enum obs_source_type type, const char *id, source->flags = source->default_flags; + /* prevents the source from clearing the cache on the first frame */ + source->async_reset_texture = true; + if (info && info->type == OBS_SOURCE_TYPE_TRANSITION) os_atomic_inc_long(&obs->data.active_transitions); return source; @@ -1474,11 +1477,14 @@ static inline struct obs_source_frame *cache_video(struct obs_source *source, pthread_mutex_lock(&source->async_mutex); if (async_texture_changed(source, frame)) { + /* prevents the cache from being freed on the first frame */ + if (!source->async_reset_texture) + free_async_cache(source); + source->async_width = frame->width; source->async_height = frame->height; source->async_format = frame->format; source->async_reset_texture = true; - free_async_cache(source); } for (size_t i = 0; i < source->async_cache.num; i++) {