提交 fea4f751 编写于 作者: J jp9000

libobs: Update async video texture before effect filters

When an async video source is about to be rendered, the async texture
should be updated before any effect filtering occurs, rather than right
when it's about to render.

Fixes a few bugs:

- If the async texture hadn't drawn for its first time, and the source
  has an effect filter, it would never end up rendering the first
  frame due to the fact that it would fail on obs-source.c:2434 for the
  first filter, causing it to never actually render the source, and thus
  never get to a point in which it could call set_async_texture_size to
  establish the async texture width/height for the first time.

- Any time the async texture size changed, it would only update the
  async texture size at the end of the filter loop, which means that the
  first frame after a size change would use the old size for the filters
  rather than update to the new size right away.
上级 db7aebb9
......@@ -1340,7 +1340,7 @@ static void obs_source_draw_async_texture(struct obs_source *source)
static inline struct obs_source_frame *filter_async_video(obs_source_t *source,
struct obs_source_frame *in);
static void obs_source_render_async_video(obs_source_t *source)
static void obs_source_update_async_video(obs_source_t *source)
{
if (!source->async_rendered) {
struct obs_source_frame *frame = obs_source_get_frame(source);
......@@ -1362,7 +1362,10 @@ static void obs_source_render_async_video(obs_source_t *source)
obs_source_release_frame(source, frame);
}
}
static inline void obs_source_render_async_video(obs_source_t *source)
{
if (source->async_texture && source->async_active)
obs_source_draw_async_texture(source);
}
......@@ -1418,6 +1421,11 @@ void obs_source_video_render(obs_source_t *source)
(source->info.output_flags & OBS_SOURCE_VIDEO) == 0)
return;
if (source->info.type == OBS_SOURCE_TYPE_INPUT &&
(source->info.output_flags & OBS_SOURCE_ASYNC) != 0 &&
!source->rendering_filter)
obs_source_update_async_video(source);
if (!source->context.data || !source->enabled) {
if (source->filter_parent)
obs_source_skip_video_filter(source);
......@@ -2464,7 +2472,9 @@ void obs_source_process_filter_end(obs_source_t *filter, gs_effect_t *effect,
render_filter_bypass(target, effect, use_matrix);
} else {
texture = gs_texrender_get_texture(filter->filter_texrender);
render_filter_tex(texture, effect, width, height, use_matrix);
if (texture)
render_filter_tex(texture, effect, width, height,
use_matrix);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册