<html><head></head><body>No. Holding vout/aout gives access to variables and interface controls, nothing else.<br><br><div class="gmail_quote">Le 17 mai 2018 15:36:55 GMT+03:00, Thomas Guillem <thomas@gllm.fr> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">Since these variables can be written from any thread from format_update()<br>callbacks.<br>---<br> src/input/decoder.c | 59 +++++++++++++++++++++++++++++++++++++--------<br> 1 file changed, 49 insertions(+), 10 deletions(-)<br><br>diff --git a/src/input/decoder.c b/src/input/decoder.c<br>index 1fdc4fb7ed..e8e4c109ef 100644<br>--- a/src/input/decoder.c<br>+++ b/src/input/decoder.c<br>@@ -103,10 +103,11 @@ struct decoder_owner<br> vlc_cond_t wait_fifo; /* TODO: merge with wait_acknowledge */<br> vlc_cond_t wait_timed;<br> <br>- /* -- These variables need locking on write(only) -- */<br>+ /* These variables are written from the format_update() callbacks threads.<br>+ * They need locking when they are read from the DecoderThread (use<br>+ * dec_get_aout()/dec_get_vout() helpers). */<br> audio_output_t *p_aout;<br>-<br>- vout_thread_t *p_vout;<br>+ vout_thread_t *p_vout;<br> <br> /* -- Theses variables need locking on read *and* write -- */<br> /* Preroll */<br>@@ -158,6 +159,24 @@ static inline struct decoder_owner *dec_get_owner( decoder_t *p_dec )<br> return container_of( p_dec, struct decoder_owner, dec );<br> }<br> <br>+static audio_output_t *dec_get_aout( decoder_t *p_dec )<br>+{<br>+ struct decoder_owner *p_owner = dec_get_owner( p_dec );<br>+ vlc_mutex_lock( &p_owner->lock );<br>+ audio_output_t *p_aout = p_owner->p_aout ? vlc_object_hold( p_owner->p_aout ) : NULL;<br>+ vlc_mutex_unlock( &p_owner->lock );<br>+ return p_aout;<br>+}<br>+<br>+static vout_thread_t *dec_get_vout( decoder_t *p_dec )<br>+{<br>+ struct decoder_owner *p_owner = dec_get_owner( p_dec );<br>+ vlc_mutex_lock( &p_owner->lock );<br>+ vout_thread_t *p_vout = p_owner->p_vout ? vlc_object_hold( p_owner->p_vout ) : NULL;<br>+ vlc_mutex_unlock( &p_owner->lock );<br>+ return p_vout;<br>+}<br>+<br> /**<br> * Load a decoder module<br> */<br>@@ -238,15 +257,17 @@ static int ReloadDecoder( decoder_t *p_dec, bool b_packetizer,<br> if( reload == RELOAD_DECODER_AOUT )<br> {<br> assert( p_owner->fmt.i_cat == AUDIO_ES );<br>- audio_output_t *p_aout = p_owner->p_aout;<br> <br> vlc_mutex_lock( &p_owner->lock );<br>+ audio_output_t *p_aout = p_owner->p_aout ? vlc_object_hold( p_owner->p_aout ) : NULL;<br> p_owner->p_aout = NULL;<br> vlc_mutex_unlock( &p_owner->lock );<br>+<br> if( p_aout )<br> {<br> aout_DecDelete( p_aout );<br> input_resource_PutAout( p_owner->p_resource, p_aout );<br>+ vlc_object_release( p_aout );<br> }<br> }<br> <br>@@ -1538,13 +1559,25 @@ static void *DecoderThread( void *p_data )<br> switch( p_dec->fmt_out.i_cat )<br> {<br> case VIDEO_ES:<br>- if( p_owner->p_vout != NULL )<br>- vout_ChangePause( p_owner->p_vout, paused, date );<br>+ {<br>+ vout_thread_t *p_vout = dec_get_vout( p_dec );<br>+ if( p_vout != NULL )<br>+ {<br>+ vout_ChangePause( p_vout, paused, date );<br>+ vlc_object_release( p_vout );<br>+ }<br> break;<br>+ }<br> case AUDIO_ES:<br>- if( p_owner->p_aout != NULL )<br>- aout_DecChangePause( p_owner->p_aout, paused, date );<br>+ {<br>+ audio_output_t *p_aout = dec_get_aout( p_dec );<br>+ if( p_aout != NULL )<br>+ {<br>+ aout_DecChangePause( p_aout, paused, date );<br>+ vlc_object_release( p_aout );<br>+ }<br> break;<br>+ }<br> case SPU_ES:<br> break;<br> default:<br>@@ -1569,9 +1602,15 @@ static void *DecoderThread( void *p_data )<br> case VIDEO_ES:<br> break;<br> case AUDIO_ES:<br>- if( p_owner->p_aout != NULL )<br>- aout_DecChangeRate( p_owner->p_aout, rate );<br>+ {<br>+ audio_output_t *p_aout = dec_get_aout( p_dec );<br>+ if( p_aout != NULL )<br>+ {<br>+ aout_DecChangeRate( p_aout, rate );<br>+ vlc_object_release( p_aout );<br>+ }<br> break;<br>+ }<br> case SPU_ES:<br> break;<br> default:</pre></blockquote></div><br>
-- <br>
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>