提交 4ec87548 编写于 作者: R Richard Stanway

image-source: Don't check for changes when hidden

If an image source isn't visible there is no point polling for changes
during the time it's hidden as no one will see them. Should the image
be on unreachable media such as an unavailable network share, this
check would cause the graphics thread to periodically stall trying to
detect changes of a non-visible image source.

If the image is modified while it's hidden, the updated file will now
be loaded as soon as the source is made visible - the update timer
intentionally ticks up while hidden.

Partially fixes some of the behavior described in
https://github.com/obsproject/obs-studio/issues/3007, a full fix
likely requires significant changes to support OS-specific file change
notification APIs.
上级 72a94cb6
......@@ -160,12 +160,14 @@ static void image_source_tick(void *data, float seconds)
context->update_time_elapsed += seconds;
if (context->update_time_elapsed >= 1.0f) {
time_t t = get_modified_timestamp(context->file);
context->update_time_elapsed = 0.0f;
if (obs_source_showing(context->source)) {
if (context->update_time_elapsed >= 1.0f) {
time_t t = get_modified_timestamp(context->file);
context->update_time_elapsed = 0.0f;
if (context->file_timestamp != t) {
image_source_load(context);
if (context->file_timestamp != t) {
image_source_load(context);
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册