Spurious decoder_NewPicture failure leading to decoder error
For AV1 in MP4, dav1d failed after seek:
Decoder feed error -1
dav1d get new picture buffer via NewPicture()
. It turns out that the error is triggered by decoder_NewPicture()
, which in turn is triggered by picture_pool_Cancel()
in vlc_input_decoder_Flush()
.
@tguillem add picture_pool_Cancel()
to vlc_input_decoder_Flush()
to solve the slow flush issue:
commit 9602cf7e738c5d3cc4f0b0156017110c844cdfb3
Author: Thomas Guillem <thomas@gllm.fr>
Date: Fri Nov 27 16:18:44 2020 +0100
decoder: fix slow video flush
Video flush was taking between 1 seconds to 10 seconds because the flush
request was not processed by the DecoderThread that was stuck in
pf_decode() callbacks waiting for new pictures.
Looks like it doesn't work well with decoder_NewPicture()
:
-
decoder_NewPicture()
return NULL on error, we don't know if it's malloc failure, or cancel on purpose. - Most decoder can continue after
decoder_NewPicture()
return NULL, dav1d is an exception. - Continue after
decoder_NewPicture()
failure is more like a bug, unlessdecoder_NewPicture()
can notify error code. - Even if
decoder_NewPicture()
can notify something like EAGAIN, third party decoders may not able to handle that and recover, since picture buffer callback is more like malloc(), either success or critical failure.
Maybe we need another method to solve the slow flush issue.