<html><head></head><body>Hi,<br><br>I think it's useless/redundant now. With all the continue's, we'll go back to checking the flag anyway.<br><br><div class="gmail_quote">Le 10 février 2020 09:04:04 GMT+02:00, Steve Lhomme <robux4@ycbcr.xyz> 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">On 2020-02-09 14:34, Rémi Denis-Courmont wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;">In this case, it was ostensibly making things more complicated.<hr> src/input/decoder.c | 27 +++++++--------------------<br> 1 file changed, 7 insertions(+), 20 deletions(-)<br><br>diff --git a/src/input/decoder.c b/src/input/decoder.c<br>index e2eac473c7..d7f85243d3 100644<br>--- a/src/input/decoder.c<br>+++ b/src/input/decoder.c<br>@@ -157,6 +157,7 @@ struct decoder_owner<br> bool b_draining;<br> atomic_bool drained;<br> bool b_idle;<br>+ bool aborting;<br> <br> /* CC */<br> #define MAX_CC_DECODERS 64 /* The es_out only creates one type of es */<br>@@ -1633,22 +1634,18 @@ static void *DecoderThread( void *p_data )<br> <br> /* The decoder's main loop */<br> vlc_fifo_Lock( p_owner->p_fifo );<br>- vlc_fifo_CleanupPush( p_owner->p_fifo );<br> <br>- for( ;; )<br>+ while( !p_owner->aborting )<br> {<br> if( p_owner->flushing )<br> { /* Flush before/regardless of pause. We do not want to resume just<br> * for the sake of flushing (glitches could otherwise happen). */<br>- int canc = vlc_savecancel();<br>-<br> vlc_fifo_Unlock( p_owner->p_fifo );<br> <br> /* Flush the decoder (and the output) */<br> DecoderThread_Flush( p_owner );<br> <br> vlc_fifo_Lock( p_owner->p_fifo );<br>- vlc_restorecancel( canc );<br> <br> /* Reset flushing after DecoderThread_ProcessInput in case input_DecoderFlush<br> * is called again. This will avoid a second useless flush (but<br>@@ -1671,7 +1668,6 @@ static void *DecoderThread( void *p_data )<br> <br> if( paused != p_owner->paused )<br> { /* Update playing/paused status of the output */<br>- int canc = vlc_savecancel();<br> vlc_tick_t date = p_owner->pause_date;<br> <br> paused = p_owner->paused;<br>@@ -1679,35 +1675,28 @@ static void *DecoderThread( void *p_data )<br> <br> DecoderThread_ChangePause( p_owner, paused, date );<br> <br>- vlc_restorecancel( canc );<br> vlc_fifo_Lock( p_owner->p_fifo );<br> continue;<br> }<br> <br> if( rate != p_owner->request_rate )<br> {<br>- int canc = vlc_savecancel();<br>-<br> rate = p_owner->request_rate;<br> vlc_fifo_Unlock( p_owner->p_fifo );<br> <br> DecoderThread_ChangeRate( p_owner, rate );<br> <br>- vlc_restorecancel( canc );<br> vlc_fifo_Lock( p_owner->p_fifo );<br> continue;<br> }<br> <br> if( delay != p_owner->delay )<br> {<br>- int canc = vlc_savecancel();<br>-<br> delay = p_owner->delay;<br> vlc_fifo_Unlock( p_owner->p_fifo );<br> <br> DecoderThread_ChangeDelay( p_owner, delay );<br> <br>- vlc_restorecancel( canc );<br> vlc_fifo_Lock( p_owner->p_fifo );<br> continue;<br> }<br>@@ -1722,7 +1711,6 @@ static void *DecoderThread( void *p_data )<br> }<br> <br> vlc_cond_signal( &p_owner->wait_fifo );<br>- vlc_testcancel(); /* forced expedited cancellation in case of stop */<br></blockquote><br>It seems we are missing a feature here. Wouldn't the equivalent be to <br>check at that point that p_owner->aborting isn't set ?<br><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"> block_t *p_block = vlc_fifo_DequeueUnlocked( p_owner->p_fifo );<br> if( p_block == NULL )<br>@@ -1741,7 +1729,6 @@ static void *DecoderThread( void *p_data )<br> <br> vlc_fifo_Unlock( p_owner->p_fifo );<br> <br>- int canc = vlc_savecancel();<br> DecoderThread_ProcessInput( p_owner, p_block );<br> <br> if( p_block == NULL && p_owner->dec.fmt_out.i_cat == AUDIO_ES )<br>@@ -1750,7 +1737,6 @@ static void *DecoderThread( void *p_data )<br> if( p_owner->p_aout != NULL )<br> aout_DecDrain( p_owner->p_aout );<br> }<br>- vlc_restorecancel( canc );<br> <br> /* TODO? Wait for draining instead of polling. */<br> vlc_mutex_lock( &p_owner->lock );<br>@@ -1763,8 +1749,9 @@ static void *DecoderThread( void *p_data )<br> vlc_cond_signal( &p_owner->wait_acknowledge );<br> vlc_mutex_unlock( &p_owner->lock );<br> }<br>- vlc_cleanup_pop();<br>- vlc_assert_unreachable();<br>+<br>+ vlc_fifo_Unlock( p_owner->p_fifo );<br>+ return NULL;<br> }<br> <br> static const struct decoder_owner_callbacks dec_video_cbs =<br>@@ -2183,10 +2170,10 @@ void input_DecoderDelete( decoder_t *p_dec )<br> {<br> struct decoder_owner *p_owner = dec_get_owner( p_dec );<br> <br>- vlc_cancel( p_owner->thread );<br>-<br> vlc_fifo_Lock( p_owner->p_fifo );<br>+ p_owner->aborting = true;<br> p_owner->flushing = true;<br>+ vlc_fifo_Signal( p_owner->p_fifo );<br> vlc_fifo_Unlock( p_owner->p_fifo );<br> <br> /* Make sure we aren't waiting/decoding anymore */<br>-- <br>2.25.0<hr>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br><br></blockquote><hr>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a></pre></blockquote></div><br>-- <br>Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>