提交 ebee6709 编写于 作者: J jp9000

libobs: Prevent video cache clear on first frame

Fix a bug where when a source first starts up its async cache, it
unintentionally resets its cache, which means that the first few frames
would be lost.
上级 2d5c6dfa
......@@ -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++) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册