summaryrefslogtreecommitdiff
path: root/libavformat/mux.c
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2015-10-23 11:11:33 +0200
committerLuca Barbato <lu_zero@gentoo.org>2015-10-26 18:00:55 +0100
commit9b56d5c11488656254e9aed8d964ef2b7c2ff5e6 (patch)
tree83fe8dc6bd2410a174d214400dcf1dca290e7f49 /libavformat/mux.c
parentd584533cf38141172e20bae5436629ee17c8ce50 (diff)
avpacket: Deprecate av_dup_packet
As documented, `av_dup_packet` is broken by design, `av_packet_ref` matches the AVFrame ref-counted API and can be safely used instead.
Diffstat (limited to 'libavformat/mux.c')
-rw-r--r--libavformat/mux.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/libavformat/mux.c b/libavformat/mux.c
index e86d202713..4a81e36af5 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -416,12 +416,8 @@ int ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt,
this_pktl = av_mallocz(sizeof(AVPacketList));
if (!this_pktl)
return AVERROR(ENOMEM);
- this_pktl->pkt = *pkt;
- pkt->buf = NULL;
- pkt->side_data = NULL;
- pkt->side_data_elems = 0;
- // Duplicate the packet if it uses non-allocated memory
- if ((ret = av_dup_packet(&this_pktl->pkt)) < 0) {
+
+ if ((ret = av_packet_ref(&this_pktl->pkt, pkt)) < 0) {
av_free(this_pktl);
return ret;
}
@@ -450,6 +446,8 @@ next_non_null:
s->streams[pkt->stream_index]->last_in_packet_buffer =
*next_point = this_pktl;
+ av_packet_unref(pkt);
+
return 0;
}