[vlc-devel] [VLC-3.0 2/2] aom: don't pass the private structure pointer, just the index
Hugo Beauzée-Luyssen
hugo at beauzee.fr
Mon Apr 6 12:05:46 CEST 2020
From: Steve Lhomme <robux4 at ycbcr.xyz>
We can never get a NULL pointer from libaom this way. The PTS may be wrong but
it won't crash.
(cherry picked from commit 96a606dcaf1bb53537d902b2235c41856cc218bc)
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>
---
modules/codec/aom.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/modules/codec/aom.c b/modules/codec/aom.c
index eda86b5fac..4d53831255 100644
--- a/modules/codec/aom.c
+++ b/modules/codec/aom.c
@@ -145,13 +145,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_TS_INVALID) ? block->i_pts : block->i_dts;
+ p_sys->frame_priv[priv_index].pts = (block->i_pts != VLC_TS_INVALID) ? block->i_pts : block->i_dts;
}
else
{
@@ -160,7 +160,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);
@@ -206,13 +206,12 @@ 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 */
- mtime_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);
}
--
2.20.1
More information about the vlc-devel
mailing list