Yeah, I don't like this approach much just from looking at it. I don't know that timing is a concern (although I'm also not sure that it's *not*), but I don't like how non-obvious the threading is here.
If I had to prescribe an approach, I'd just use a separate CV for flushing. This will require a separate lock, but we really should have one anyway to protect filter->streaming.