summaryrefslogtreecommitdiff
path: root/libavformat/utils.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2019-09-28 04:42:24 +0200
committerJames Almer <jamrial@gmail.com>2019-09-28 18:32:43 -0300
commitada02cf85fffd7806ac48e907f45082dd91efc18 (patch)
treee824a178da2e37a73f4048ab17b05cf64a7b0422 /libavformat/utils.c
parentbf79e4426a94d17ca49b01ab1624c5d59ae59bb2 (diff)
avformat/utils: Don't create unnecessary references
When AVFMT_FLAG_GENPTS is set, av_read_frame would put a reference to a packet in the packet list (via av_packet_ref) and then immediately thereafter unreference the original packet. This has been changed to move the reference instead. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r--libavformat/utils.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 1292fef3df..fe40ead438 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1858,10 +1858,11 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt)
ret = ff_packet_list_put(&s->internal->packet_buffer,
&s->internal->packet_buffer_end,
- pkt, FF_PACKETLIST_FLAG_REF_PACKET);
- av_packet_unref(pkt);
- if (ret < 0)
+ pkt, 0);
+ if (ret < 0) {
+ av_packet_unref(pkt);
return ret;
+ }
}
return_packet: