aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-06-14 21:04:36 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-06-22 13:12:49 +0200
commit526f5f59df4008487748e19ca88f45e05e784db4 (patch)
tree56b20f633a6568bd5c8c83bfe40b2bd65f7768d3
parent88dc77e243c486f50f60da981ac328d502791111 (diff)
downloadffmpeg-526f5f59df4008487748e19ca88f45e05e784db4.tar.gz
avformat/mov: Avoid allocation+copy when moving extradata
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
-rw-r--r--libavformat/mov.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index cb0849f9d7..f78245fa28 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -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. */
sc->extradata_size[pseudo_stream_id] = extra_size;
- sc->extradata[pseudo_stream_id] = av_malloc(extra_size + AV_INPUT_BUFFER_PADDING_SIZE);
- if (!sc->extradata[pseudo_stream_id])
- return AVERROR(ENOMEM);
- memcpy(sc->extradata[pseudo_stream_id], st->codecpar->extradata, extra_size);
- av_freep(&st->codecpar->extradata);
+ sc->extradata[pseudo_stream_id] = st->codecpar->extradata;
+ st->codecpar->extradata = NULL;
st->codecpar->extradata_size = 0;
}
sc->stsd_count++;