[FFmpeg-devel] [PATCH 6/7] avformat/dashenc: add missing padding to the updated extradata

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Fri Aug 2 18:09:00 EEST 2019


James Almer:
> On 8/2/2019 11:46 AM, Andreas Rheinhardt wrote:
>> James Almer:
>>> Signed-off-by: James Almer <jamrial at gmail.com>
>>> ---
>>>  libavformat/dashenc.c | 3 ++-
>>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
>>> index bded260806..50eba370d9 100644
>>> --- a/libavformat/dashenc.c
>>> +++ b/libavformat/dashenc.c
>>> @@ -1476,12 +1476,13 @@ static int update_stream_extradata(AVFormatContext *s, OutputStream *os,
>>>      if (!extradata_size)
>>>          return 0;
>>>  
>>> -    new_extradata = av_malloc(extradata_size);
>>> +    new_extradata = av_malloc(extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
>>>  
>>>      if (!new_extradata)
>>>          return AVERROR(ENOMEM);
>>>  
>>>      memcpy(new_extradata, extradata, extradata_size);
>>> +    memset(new_extradata + extradata_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
>>>  
>>>      os->ctx->streams[0]->codecpar->extradata = new_extradata;
>>>      os->ctx->streams[0]->codecpar->extradata_size = extradata_size;
>>>
>> Is there a reason you are not using ff_alloc_extradata?
>>
>> - Andreas
> 
> Not really. I can replace this patch with one implementing
> ff_alloc_extradata().

I have no strong feelings about this. Proceed as you wish.

- Andreas



More information about the ffmpeg-devel mailing list