- We should be respecting the AM_SEEKING_NoFlush flags.
OK, I'll add this in new version.
- We should check for stopped state; we don't want to flush anything if not stopped.
- Stopping the filter seems wrong. Did you mean to stop the IWMReader? I don't think even that's necessary, though.
I don't think so. See https://learn.microsoft.com/en-us/windows/win32/directshow/supporting-seekin....
The document talks about seeking on condition of streaming thread running, so I don't think we should only send flush command downstream in stop state. If not in stop state, we drop the pending buffers by flushing, downstream filters chould handle this.
Stopping the filter is necessary, it finally calls asf_reader_cleanup_stream() to decommit the allocator to prevent futher buffer allocating. Buffer allocating failure makes upstream filters unable to send more buffers downstream, which is what we expected when we are seeking. If we don't, there may be race conditions, although I can not precisely says what condition it is.