[vlc-devel] [PATCH] decoder: remove misleading comment

Steve Lhomme robux4 at ycbcr.xyz
Tue Sep 3 13:22:43 CEST 2019

The p_aout and p_vout need locking for reading as well (it wouldn't make much
sense to only lock when writing).

For example p_aout can be modified in the DecoderThread during a ReloadDecoder.

p_vout cannot be modified outside of the vout_update_format/spu_new_buffer but
it is also access in the DecoderThread, for example during DecoderProcessFlush()
or the OutputChangeXXX functions.

For functions only called by the decoder, it might be OK not to lock as the
p_out/p_aout should only change during vout_update_format/aout_update_format
which the decoder should call before doing other calls from various threads.
 src/input/decoder.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index 65e3dd6f6c..7011c99226 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -101,12 +101,11 @@ struct decoder_owner
     vlc_cond_t  wait_acknowledge;
     vlc_cond_t  wait_fifo; /* TODO: merge with wait_acknowledge */
-    /* -- These variables need locking on write(only) -- */
+    /* -- Theses variables need locking on read *and* write -- */
     audio_output_t *p_aout;
     vout_thread_t   *p_vout;
-    /* -- Theses variables need locking on read *and* write -- */
     /* Preroll */
     vlc_tick_t i_preroll_end;

More information about the vlc-devel mailing list