vlc | branch: master | Steve Lhomme <rob...@ycbcr.xyz> | Tue Aug 27 08:51:00 2019 +0200| [ee13e28863057d60869bc4b91dea31adc3aa171d] | committer: Steve Lhomme
decoder: simplify code No need for a label to jump to if it's only used at one location. And reorder DecoderPlayAudio() to match the same logic as the Video one. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ee13e28863057d60869bc4b91dea31adc3aa171d --- src/input/decoder.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/input/decoder.c b/src/input/decoder.c index b37d8b1c22..ead516f40c 100644 --- a/src/input/decoder.c +++ b/src/input/decoder.c @@ -1036,7 +1036,10 @@ static int DecoderPlayVideo( struct decoder_owner *p_owner, picture_t *p_picture /* */ if( p_vout == NULL ) - goto discard; + { + picture_Release( p_picture ); + return VLC_EGENERIC; + } if( p_picture->b_still ) { @@ -1046,9 +1049,6 @@ static int DecoderPlayVideo( struct decoder_owner *p_owner, picture_t *p_picture vout_PutPicture( p_vout, p_picture ); return VLC_SUCCESS; -discard: - picture_Release( p_picture ); - return VLC_EGENERIC; } static void DecoderUpdateStatVideo( struct decoder_owner *p_owner, @@ -1153,27 +1153,27 @@ static int DecoderPlayAudio( struct decoder_owner *p_owner, block_t *p_audio ) audio_output_t *p_aout = p_owner->p_aout; - if( p_aout != NULL ) + if( p_aout == NULL ) { - int status = aout_DecPlay( p_aout, p_audio ); - if( status == AOUT_DEC_CHANGED ) - { - /* Only reload the decoder */ - RequestReload( p_owner ); - } - else if( status == AOUT_DEC_FAILED ) - { - /* If we reload because the aout failed, we should release it. That - * way, a next call to aout_update_format() won't re-use the - * previous (failing) aout but will try to create a new one. */ - atomic_store( &p_owner->reload, RELOAD_DECODER_AOUT ); - } - return VLC_SUCCESS; + msg_Dbg( p_dec, "discarded audio buffer" ); + block_Release( p_audio ); + return VLC_EGENERIC; } - msg_Dbg( p_dec, "discarded audio buffer" ); - block_Release( p_audio ); - return VLC_EGENERIC; + int status = aout_DecPlay( p_aout, p_audio ); + if( status == AOUT_DEC_CHANGED ) + { + /* Only reload the decoder */ + RequestReload( p_owner ); + } + else if( status == AOUT_DEC_FAILED ) + { + /* If we reload because the aout failed, we should release it. That + * way, a next call to aout_update_format() won't re-use the + * previous (failing) aout but will try to create a new one. */ + atomic_store( &p_owner->reload, RELOAD_DECODER_AOUT ); + } + return VLC_SUCCESS; } static void DecoderUpdateStatAudio( struct decoder_owner *p_owner, _______________________________________________ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits