0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 03:52:22 +02:00

filter: fix possibly lost async wakeups

mp_filter_mark_async_progress() can asynchronously mark a filter for
processing, without waking up the filter thread. (It's some sort of
idiotic micro-optimization I guess?) But since it sets async_pending
without doing the wakeup, a mp_filter_wakeup() after this will do
nothing, and the wakeup is lost. Fix it by checking for the needed
wakeup separately.

Fortunately, nothing used this function yet, so there is no impact.
This commit is contained in:
wm4 2020-02-29 20:00:21 +01:00
parent b0b5de3063
commit 84fe9c2a47

View File

@ -614,11 +614,11 @@ static void filter_wakeup(struct mp_filter *f, bool mark_only)
f->in->async_pending = true;
// (not using a talloc parent for thread safety reasons)
MP_TARRAY_APPEND(NULL, r->async_pending, r->num_async_pending, f);
if (!mark_only && !r->async_wakeup_sent) {
if (r->wakeup_cb)
r->wakeup_cb(r->wakeup_ctx);
r->async_wakeup_sent = true;
}
}
if (!mark_only && !r->async_wakeup_sent) {
if (r->wakeup_cb)
r->wakeup_cb(r->wakeup_ctx);
r->async_wakeup_sent = true;
}
pthread_mutex_unlock(&r->async_lock);
}