mirror of https://git.ffmpeg.org/ffmpeg.git
avformat/mov: Avoid allocation+copy when moving extradata
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
parent
88dc77e243
commit
526f5f59df
|
@ -2545,11 +2545,8 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
|
||||||
|
|
||||||
/* Move the current stream extradata to the stream context one. */
|
/* Move the current stream extradata to the stream context one. */
|
||||||
sc->extradata_size[pseudo_stream_id] = extra_size;
|
sc->extradata_size[pseudo_stream_id] = extra_size;
|
||||||
sc->extradata[pseudo_stream_id] = av_malloc(extra_size + AV_INPUT_BUFFER_PADDING_SIZE);
|
sc->extradata[pseudo_stream_id] = st->codecpar->extradata;
|
||||||
if (!sc->extradata[pseudo_stream_id])
|
st->codecpar->extradata = NULL;
|
||||||
return AVERROR(ENOMEM);
|
|
||||||
memcpy(sc->extradata[pseudo_stream_id], st->codecpar->extradata, extra_size);
|
|
||||||
av_freep(&st->codecpar->extradata);
|
|
||||||
st->codecpar->extradata_size = 0;
|
st->codecpar->extradata_size = 0;
|
||||||
}
|
}
|
||||||
sc->stsd_count++;
|
sc->stsd_count++;
|
||||||
|
|
Loading…
Reference in New Issue