Skip to content

input: decoder: fix drain/flush execution order

Thomas Guillem requested to merge tguillem/vlc:input-fix-drain-flush into master

This fixes a possible (but unlikely) assert, from vlc_aout_stream_Drain(): assert(atomic_load_explicit(&stream->drain_deadline, memory_order_relaxed) == VLC_TICK_INVALID);

It can happen when vlc_aout_stream_Drain() is called more than time in a row, that is illegal: Drain should be the last command or can be cancelled by a Flush to continue the playback.

If drain and flush are called in that order

  • vlc_input_decoder_Drain()
  • vlc_input_decoder_Flush()
  • vlc_input_decoder_Drain()

It was possible that vlc_aout_stream_Flush() was called before the first vlc_input_decoder_Drain().

To fix this issue, cancel the draining state when flushing the decoder and do check that the decoder is still draining after unlocking/locking (after draining the decoder module).

Regression from 34a548cc

Fixes #27499 (closed)

Edited by Thomas Guillem

Merge request reports