diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2015-10-29 14:16:44 +0100 |
---|---|---|
committer | Hendrik Leppkes <h.leppkes@gmail.com> | 2015-10-29 14:16:44 +0100 |
commit | 87a6f532b46fb16eea07943325f5d322d08e13ed (patch) | |
tree | 26b4b24c5f3839c4aa7e66979870eb9ed98ddd00 /libavformat/mux.c | |
parent | 54de179caa39e1c2f3cbea61dd05f818bb78a3b6 (diff) | |
parent | 9b56d5c11488656254e9aed8d964ef2b7c2ff5e6 (diff) |
Merge commit '9b56d5c11488656254e9aed8d964ef2b7c2ff5e6'
* commit '9b56d5c11488656254e9aed8d964ef2b7c2ff5e6':
avpacket: Deprecate av_dup_packet
Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
Diffstat (limited to 'libavformat/mux.c')
-rw-r--r-- | libavformat/mux.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/libavformat/mux.c b/libavformat/mux.c index b2d843bc38..bf7a47296c 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -740,19 +740,14 @@ 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; if ((pkt->flags & AV_PKT_FLAG_UNCODED_FRAME)) { av_assert0(pkt->size == UNCODED_FRAME_PACKET_SIZE); av_assert0(((AVFrame *)pkt->data)->buf); - } else { - // Duplicate the packet if it uses non-allocated memory - if ((ret = av_dup_packet(&this_pktl->pkt)) < 0) { - av_free(this_pktl); - return ret; - } + } + + if ((ret = av_packet_ref(&this_pktl->pkt, pkt)) < 0) { + av_free(this_pktl); + return ret; } if (s->streams[pkt->stream_index]->last_in_packet_buffer) { @@ -803,6 +798,8 @@ next_non_null: s->streams[pkt->stream_index]->last_in_packet_buffer = *next_point = this_pktl; + av_packet_unref(pkt); + return 0; } |