[vlc-devel] [PATCH] avcodec: encoder: fix MPEG4 matrix passed as const
Steve Lhomme
robux4 at ycbcr.xyz
Wed Jul 10 08:23:58 CEST 2019
lavc expects a pointer that it will free in avcodec_free_context().
---
modules/codec/avcodec/encoder.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
index cbac0d3394..2564e0a518 100644
--- a/modules/codec/avcodec/encoder.c
+++ b/modules/codec/avcodec/encoder.c
@@ -580,8 +580,14 @@ int InitVideoEnc( vlc_object_t *p_this )
if ( p_sys->b_mpeg4_matrix )
{
- p_context->intra_matrix = mpeg4_default_intra_matrix;
- p_context->inter_matrix = mpeg4_default_non_intra_matrix;
+ p_context->intra_matrix = av_malloc( sizeof(mpeg4_default_intra_matrix) );
+ if ( p_context->intra_matrix )
+ memcpy( p_context->intra_matrix, mpeg4_default_intra_matrix,
+ sizeof(mpeg4_default_intra_matrix));
+ p_context->inter_matrix = av_malloc( sizeof(mpeg4_default_non_intra_matrix) );
+ if ( p_context->inter_matrix )
+ memcpy( p_context->inter_matrix, mpeg4_default_non_intra_matrix,
+ sizeof(mpeg4_default_non_intra_matrix));
}
if ( p_sys->b_pre_me )
--
2.17.1
More information about the vlc-devel
mailing list