[FFmpeg-devel] [PATCH 2/2] hevc: Support extradata changes
Michael Niedermayer
michael at niedermayer.cc
Sat Nov 5 15:21:43 EET 2016
On Wed, Nov 02, 2016 at 11:48:58AM -0400, Vittorio Giovara wrote:
> Signed-off-by: Vittorio Giovara <vittorio.giovara at gmail.com>
> ---
> Please CC.
> Vittorio
>
> libavcodec/hevc.c | 18 ++++++++++++++++++
> libavformat/mov.c | 4 ----
> 2 files changed, 18 insertions(+), 4 deletions(-)
>
> diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
> index 29e0d49..b50120e 100644
> --- a/libavcodec/hevc.c
> +++ b/libavcodec/hevc.c
> @@ -3051,6 +3051,8 @@ static int hevc_decode_frame(AVCodecContext *avctx, void *data, int *got_output,
> AVPacket *avpkt)
> {
> int ret;
> + int new_extradata_size;
> + uint8_t *new_extradata;
> HEVCContext *s = avctx->priv_data;
>
> if (!avpkt->size) {
> @@ -3062,6 +3064,22 @@ static int hevc_decode_frame(AVCodecContext *avctx, void *data, int *got_output,
> return 0;
> }
>
> + new_extradata_size = 0;
> + new_extradata = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA,
> + &new_extradata_size);
> + if (new_extradata_size > 0 && new_extradata) {
new_extradata should be checked first, that should make
new_extradata_size = 0; unneeded
> + if (new_extradata_size > avctx->extradata_size) {
> + avctx->extradata = av_realloc(avctx->extradata, new_extradata_size);
This leaks on reallocation failure overwriting the allocated pointer
also can you add a fate test ?
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
It is what and why we do it that matters, not just one of them.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20161105/f4957b0d/attachment.sig>
More information about the ffmpeg-devel
mailing list