filter: process asynchronous wakeups during filtering

If a filter receives an asynchronous wakeup during filtering, then
process newly pending filters resulting from that as well, before
returning to the user. Might possibly skip some redundant playloop
cycles.

There is an explicit comment in the code about how this shouldn't be
done, but I think it makes no sense. Filters have no business trying to
interrupt the mainloop, and mp_filter_graph_interrupt() provides a
proper mechanism to do this (though intended to be used by the filter
user, not filters).
This commit is contained in:
wm4 2020-04-10 00:34:20 +02:00
parent 73e565dc0f
commit c3b2e7ec07
1 changed files with 5 additions and 4 deletions

View File

@ -194,8 +194,6 @@ bool mp_filter_graph_run(struct mp_filter *filter)
r->filtering = true;
// Note: some filters may call mp_filter_wakeup() from process on themselves
// to queue a wakeup again later. So do not call this in the loop.
flush_async_notifications(r);
while (1) {
@ -210,8 +208,11 @@ bool mp_filter_graph_run(struct mp_filter *filter)
break;
}
if (!r->num_pending)
break;
if (!r->num_pending) {
flush_async_notifications(r);
if (!r->num_pending)
break;
}
struct mp_filter *next = r->pending[r->num_pending - 1];
r->num_pending -= 1;