vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Wed Jul 24 
18:41:55 2013 +0300| [e918aa681afe8a947a80de9fa5bc081a0d2022b2] | committer: 
Rémi Denis-Courmont

avcodec: factor frame initialization code

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

 modules/codec/avcodec/video.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 271f91e..fe21d75 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -996,8 +996,6 @@ static picture_t *lavc_dr_GetFrame(struct AVCodecContext 
*ctx,
     }
 
     /* Allocate buffer references */
-    for (unsigned i = 0; i < AV_NUM_DATA_POINTERS; i++)
-        frame->buf[i] = NULL;
     for (int i = 0; i < pic->i_planes; i++)
     {
         lavc_pic_ref_t *ref = malloc(sizeof (*ref));
@@ -1041,6 +1039,13 @@ static int lavc_GetFrame(struct AVCodecContext *ctx, 
AVFrame *frame, int flags)
     decoder_sys_t *sys = dec->p_sys;
     picture_t *pic;
 
+    for (unsigned i = 0; i < AV_NUM_DATA_POINTERS; i++)
+    {
+        frame->data[i] = NULL;
+        frame->linesize[i] = 0;
+        frame->buf[i] = NULL;
+    }
+
     if (sys->p_va != NULL)
         return lavc_va_GetFrame(ctx, frame);
 

_______________________________________________
vlc-commits mailing list
[email protected]
http://mailman.videolan.org/listinfo/vlc-commits

Reply via email to