[vlc-commits] ffmpeg_ReleaseFrameBuf: simplify

Rafaël Carré git at videolan.org
Tue Jun 4 20:05:18 CEST 2013


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Mon May 27 09:18:56 2013 +0200| [67464c078157e38724ccd97071f4a0744481df13] | committer: Rémi Denis-Courmont

ffmpeg_ReleaseFrameBuf: simplify

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=67464c078157e38724ccd97071f4a0744481df13
---

 modules/codec/avcodec/video.c |   16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 933cd96..bffce38 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -1032,24 +1032,16 @@ static void ffmpeg_ReleaseFrameBuf( struct AVCodecContext *p_context,
     decoder_sys_t *p_sys = p_dec->p_sys;
 
     if( p_sys->p_va )
-    {
         vlc_va_Release( p_sys->p_va, p_ff_pic );
-    }
-    else if( !p_ff_pic->opaque )
-    {
+    else if( p_ff_pic->opaque )
+        decoder_UnlinkPicture( p_dec, (picture_t*)p_ff_pic->opaque);
+    else if( p_ff_pic->type == FF_BUFFER_TYPE_INTERNAL )
         /* We can end up here without the AVFrame being allocated by
          * avcodec_default_get_buffer() if VA is used and the frame is
          * released when the decoder is closed
          */
-        if( p_ff_pic->type == FF_BUFFER_TYPE_INTERNAL )
-            avcodec_default_release_buffer( p_context, p_ff_pic );
-    }
-    else
-    {
-        picture_t *p_pic = (picture_t*)p_ff_pic->opaque;
+        avcodec_default_release_buffer( p_context, p_ff_pic );
 
-        decoder_UnlinkPicture( p_dec, p_pic );
-    }
     for( int i = 0; i < 4; i++ )
         p_ff_pic->data[i] = NULL;
 }



More information about the vlc-commits mailing list