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.master
parent
2d5c6dfae9
commit
ebee67097a
|
@ -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++) {
|
||||
|
|
Loading…
Reference in New Issue