[vlc-commits] aom: don't pass the private structure pointer, just the index

Steve Lhomme git at videolan.org
Wed Sep 12 11:40:01 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Sep 12 11:38:14 2018 +0200| [96a606dcaf1bb53537d902b2235c41856cc218bc] | committer: Steve Lhomme

aom: don't pass the private structure pointer, just the index

We can never get a NULL pointer from libaom this way. The PTS may be wrong but
it won't crash.

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

 modules/codec/aom.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/modules/codec/aom.c b/modules/codec/aom.c
index 5bd40b1bc0..4e8464fc21 100644
--- a/modules/codec/aom.c
+++ b/modules/codec/aom.c
@@ -172,13 +172,13 @@ static int PushFrame(decoder_t *dec, block_t *block)
     size_t i_buffer;
 
     /* Associate packet PTS with decoded frame */
-    struct frame_priv_s *priv = &p_sys->frame_priv[p_sys->i_next_frame_priv++ % AOM_MAX_FRAMES_DEPTH];
+    uintptr_t priv_index = p_sys->i_next_frame_priv++ % AOM_MAX_FRAMES_DEPTH;
 
     if(likely(block))
     {
         p_buffer = block->p_buffer;
         i_buffer = block->i_buffer;
-        priv->pts = (block->i_pts != VLC_TICK_INVALID) ? block->i_pts : block->i_dts;
+        p_sys->frame_priv[priv_index].pts = (block->i_pts != VLC_TICK_INVALID) ? block->i_pts : block->i_dts;
     }
     else
     {
@@ -187,7 +187,7 @@ static int PushFrame(decoder_t *dec, block_t *block)
     }
 
     aom_codec_err_t err;
-    err = aom_codec_decode(ctx, p_buffer, i_buffer, priv);
+    err = aom_codec_decode(ctx, p_buffer, i_buffer, (void*)priv_index);
 
     if(block)
         block_Release(block);
@@ -233,13 +233,13 @@ static void OutputFrame(decoder_t *dec, const struct aom_image *img)
         picture_t *pic = decoder_NewPicture(dec);
         if (pic)
         {
+            decoder_sys_t *p_sys = dec->p_sys;
             CopyPicture(img, pic);
 
             /* fetches back the PTS */
-            vlc_tick_t pts = ((struct frame_priv_s *) img->user_priv)->pts;
 
             pic->b_progressive = true; /* codec does not support interlacing */
-            pic->date = pts;
+            pic->date = p_sys->frame_priv[(uintptr_t)img->user_priv].pts;
 
             decoder_QueueVideo(dec, pic);
         }



More information about the vlc-commits mailing list