mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-09-20 13:08:50 +02:00
libobs: Correctly set texture size
Correctly set texture size according to the frame to be rendered this time. Fixes the mismatch between frame and texture when async-delay-filter on.
This commit is contained in:
parent
c7da23bf96
commit
90a409fe58
@ -744,7 +744,6 @@ struct obs_source {
|
|||||||
bool async_flip;
|
bool async_flip;
|
||||||
bool async_linear_alpha;
|
bool async_linear_alpha;
|
||||||
bool async_active;
|
bool async_active;
|
||||||
bool async_update_texture;
|
|
||||||
bool async_unbuffered;
|
bool async_unbuffered;
|
||||||
bool async_decoupled;
|
bool async_decoupled;
|
||||||
struct obs_source_frame *async_preload_frame;
|
struct obs_source_frame *async_preload_frame;
|
||||||
|
@ -1206,10 +1206,6 @@ static void async_tick(obs_source_t *source)
|
|||||||
|
|
||||||
source->last_sys_timestamp = sys_time;
|
source->last_sys_timestamp = sys_time;
|
||||||
pthread_mutex_unlock(&source->async_mutex);
|
pthread_mutex_unlock(&source->async_mutex);
|
||||||
|
|
||||||
if (source->cur_async_frame)
|
|
||||||
source->async_update_texture =
|
|
||||||
set_async_texture_size(source, source->cur_async_frame);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void obs_source_video_tick(obs_source_t *source, float seconds)
|
void obs_source_video_tick(obs_source_t *source, float seconds)
|
||||||
@ -1975,9 +1971,6 @@ static inline bool init_gpu_conversion(struct obs_source *source,
|
|||||||
bool set_async_texture_size(struct obs_source *source,
|
bool set_async_texture_size(struct obs_source *source,
|
||||||
const struct obs_source_frame *frame)
|
const struct obs_source_frame *frame)
|
||||||
{
|
{
|
||||||
enum convert_type cur =
|
|
||||||
get_convert_type(frame->format, frame->full_range, frame->trc);
|
|
||||||
|
|
||||||
if (source->async_width == frame->width &&
|
if (source->async_width == frame->width &&
|
||||||
source->async_height == frame->height &&
|
source->async_height == frame->height &&
|
||||||
source->async_format == frame->format &&
|
source->async_format == frame->format &&
|
||||||
@ -2007,7 +2000,9 @@ bool set_async_texture_size(struct obs_source *source,
|
|||||||
|
|
||||||
const enum gs_color_format format =
|
const enum gs_color_format format =
|
||||||
convert_video_format(frame->format, frame->trc);
|
convert_video_format(frame->format, frame->trc);
|
||||||
const bool async_gpu_conversion = (cur != CONVERT_NONE) &&
|
const enum convert_type type =
|
||||||
|
get_convert_type(frame->format, frame->full_range, frame->trc);
|
||||||
|
const bool async_gpu_conversion = (type != CONVERT_NONE) &&
|
||||||
init_gpu_conversion(source, frame);
|
init_gpu_conversion(source, frame);
|
||||||
source->async_gpu_conversion = async_gpu_conversion;
|
source->async_gpu_conversion = async_gpu_conversion;
|
||||||
if (async_gpu_conversion) {
|
if (async_gpu_conversion) {
|
||||||
@ -2382,6 +2377,9 @@ static void obs_source_update_async_video(obs_source_t *source)
|
|||||||
|
|
||||||
source->async_rendered = true;
|
source->async_rendered = true;
|
||||||
if (frame) {
|
if (frame) {
|
||||||
|
const bool async_update_texture =
|
||||||
|
set_async_texture_size(source, frame);
|
||||||
|
|
||||||
check_to_swap_bgrx_bgra(source, frame);
|
check_to_swap_bgrx_bgra(source, frame);
|
||||||
|
|
||||||
if (!source->async_decoupled ||
|
if (!source->async_decoupled ||
|
||||||
@ -2391,11 +2389,10 @@ static void obs_source_update_async_video(obs_source_t *source)
|
|||||||
source->timing_set = true;
|
source->timing_set = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (source->async_update_texture) {
|
if (async_update_texture) {
|
||||||
update_async_textures(source, frame,
|
update_async_textures(source, frame,
|
||||||
source->async_textures,
|
source->async_textures,
|
||||||
source->async_texrender);
|
source->async_texrender);
|
||||||
source->async_update_texture = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
obs_source_release_frame(source, frame);
|
obs_source_release_frame(source, frame);
|
||||||
|
Loading…
Reference in New Issue
Block a user