libobs: Fix stale format in async frame cache
The video format is not updated if switching between cache-compatible formats, e.g. YUY2 and YVYU, resulting in the wrong conversion technique being used. This change ensures the format is always up-to-date.
This commit is contained in:
parent
deaeb5e632
commit
b0e7c5d0d3
@ -2426,14 +2426,17 @@ cache_video(struct obs_source *source, const struct obs_source_frame *frame)
|
||||
free_async_cache(source);
|
||||
source->async_cache_width = frame->width;
|
||||
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++) {
|
||||
struct async_frame *af = &source->async_cache.array[i];
|
||||
if (!af->used) {
|
||||
new_frame = af->frame;
|
||||
new_frame->format = format;
|
||||
af->used = true;
|
||||
af->unused_count = 0;
|
||||
break;
|
||||
@ -2444,7 +2447,6 @@ cache_video(struct obs_source *source, const struct obs_source_frame *frame)
|
||||
|
||||
if (!new_frame) {
|
||||
struct async_frame new_af;
|
||||
enum video_format format = frame->format;
|
||||
|
||||
new_frame = obs_source_frame_create(format, frame->width,
|
||||
frame->height);
|
||||
|
Loading…
x
Reference in New Issue
Block a user