From 2f6dc93276d3feb7f9096baab18045502f20c11b Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 4 Feb 2018 20:00:32 +0100 Subject: filter: don't randomly lose async wakeup notifications Another "what was I thinking" thing - destroying filters explicitly skipped async wakeups for no reason. These were notifications for filters that are not going to be destroyed too, and so their wakeup will be lost, leading to stalled playback. This is completely unnecessary and the special code can be removed. Fixes #5488. (This case destroyed all audio filters due to AO init failure, which could make clear out the f_demux_in.c wakeup for video, and "freeze" playback.) --- filters/filter.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/filters/filter.c b/filters/filter.c index 60e9bc265e..c6c2603156 100644 --- a/filters/filter.c +++ b/filters/filter.c @@ -165,13 +165,12 @@ void mp_filter_internal_mark_progress(struct mp_filter *f) // Basically copy the async notifications to the sync ones. Done so that the // sync notifications don't need any locking. -static void flush_async_notifications(struct filter_runner *r, bool queue) +static void flush_async_notifications(struct filter_runner *r) { pthread_mutex_lock(&r->async_lock); for (int n = 0; n < r->num_async_pending; n++) { struct mp_filter *f = r->async_pending[n]; - if (queue) - add_pending(f); + add_pending(f); f->in->async_pending = false; } r->num_async_pending = 0; @@ -185,7 +184,7 @@ bool mp_filter_run(struct mp_filter *filter) r->filtering = true; - flush_async_notifications(r, true); + flush_async_notifications(r); while (r->num_pending) { struct mp_filter *next = r->pending[r->num_pending - 1]; @@ -653,7 +652,7 @@ static void filter_destructor(void *p) // Just make sure the filter is not still in the async notifications set. // There will be no more new notifications at this point (due to destroy()). - flush_async_notifications(r, false); + flush_async_notifications(r); for (int n = 0; n < r->num_pending; n++) { if (r->pending[n] == f) { -- cgit v1.2.3