diff options
author | wm4 <wm4@nowhere> | 2020-02-29 20:00:21 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2020-02-29 20:12:31 +0100 |
commit | 84fe9c2a474e58a69c1b11e6de92107c78598604 (patch) | |
tree | 7441e6a91d344ce60da515ba09465e7c938b623f | |
parent | b0b5de306387f03f7f79a34ecc7d2aaf223f180a (diff) | |
download | mpv-84fe9c2a474e58a69c1b11e6de92107c78598604.tar.bz2 mpv-84fe9c2a474e58a69c1b11e6de92107c78598604.tar.xz |
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.
-rw-r--r-- | filters/filter.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/filters/filter.c b/filters/filter.c index beec13c210..84596b723e 100644 --- a/filters/filter.c +++ b/filters/filter.c @@ -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); } |