[vlc-devel] [RFC PATCH 0/3] decoder: mutexes and conds cleanup
thomas at gllm.fr
Wed Apr 1 16:13:15 CEST 2015
I have been trying to fix a race when the input wait for the decoder that has
not decoded any data yet and won't decode anything. See mail "[PATCH] decoder:
My biggest issue was that the function input_DecoderWait waited for 2 different
variables protected by 2 different mutexes and signaled by 2 different cond. So
I decided to minimize the number of mutexes and conds.
Now, in decoder.c, the input Fifo and the DecoderThread share the same mutex
and the same cond. I had to move some long function call (the ones calling
aout/vout) outside the lock in order to don't block or wait too long while the
mutex is locked.
For my third patch (can be squashed with the second one), I think that
p_vout/p_aout must also be locked on read (and also p_spu_vout ?). Indeed, the
vout_update_format function, that set/unset the vout and that is called from
decoder_NewPicture, can be called from any threads and not only the
DecoderThread. It's the case when using avcodec with direct rendering.
Theses patches are still WIP, I'll need to triple check again if accepted.
Any comments are welcome. I would like to know If I'm on the right track...
Thomas Guillem (3):
fifo: add block_FifoNewExt: create a fifo with custom lock and cond
decoder: merge locks and conds
decoder: protect vout and aout during read
include/vlc_block.h | 1 +
src/input/decoder.c | 220 ++++++++++++++++++++++++++++++++--------------------
src/libvlccore.sym | 1 +
src/misc/fifo.c | 71 +++++++++++------
4 files changed, 187 insertions(+), 106 deletions(-)
More information about the vlc-devel