Merge pull request #2012 from jpark37/stale-format

libobs: Fix stale format in async frame cache
master
Jim 2019-08-08 20:08:17 -07:00 committed by GitHub
commit 16783a4658
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -2426,14 +2426,17 @@ cache_video(struct obs_source *source, const struct obs_source_frame *frame)
free_async_cache(source); free_async_cache(source);
source->async_cache_width = frame->width; source->async_cache_width = frame->width;
source->async_cache_height = frame->height; source->async_cache_height = frame->height;
source->async_cache_format = frame->format;
source->async_cache_full_range = frame->full_range;
} }
const enum video_format format = frame->format;
source->async_cache_format = format;
source->async_cache_full_range = frame->full_range;
for (size_t i = 0; i < source->async_cache.num; i++) { for (size_t i = 0; i < source->async_cache.num; i++) {
struct async_frame *af = &source->async_cache.array[i]; struct async_frame *af = &source->async_cache.array[i];
if (!af->used) { if (!af->used) {
new_frame = af->frame; new_frame = af->frame;
new_frame->format = format;
af->used = true; af->used = true;
af->unused_count = 0; af->unused_count = 0;
break; break;
@ -2444,7 +2447,6 @@ cache_video(struct obs_source *source, const struct obs_source_frame *frame)
if (!new_frame) { if (!new_frame) {
struct async_frame new_af; struct async_frame new_af;
enum video_format format = frame->format;
new_frame = obs_source_frame_create(format, frame->width, new_frame = obs_source_frame_create(format, frame->width,
frame->height); frame->height);