Commit b6be2be7 authored by Andreas Rheinhardt's avatar Andreas Rheinhardt Committed by James Almer

avformat/utils: ensure that all packets in AVPacketList are reference counted

This is done so that its data is really owned by the packet.
This was already true for the current callers.
Signed-off-by: 's avatarJames Almer <jamrial@gmail.com>
parent 4f589d66
...@@ -763,7 +763,8 @@ void ff_format_set_url(AVFormatContext *s, char *url); ...@@ -763,7 +763,8 @@ void ff_format_set_url(AVFormatContext *s, char *url);
* *
* @param head List head element * @param head List head element
* @param tail List tail element * @param tail List tail element
* @param pkt The packet being appended * @param pkt The packet being appended. The data described in it will
* be made reference counted if it isn't already.
* @param flags Any combination of FF_PACKETLIST_FLAG_* flags * @param flags Any combination of FF_PACKETLIST_FLAG_* flags
* @return 0 on success, negative AVERROR value on failure. On failure, * @return 0 on success, negative AVERROR value on failure. On failure,
the list is unchanged the list is unchanged
......
...@@ -460,6 +460,11 @@ int ff_packet_list_put(AVPacketList **packet_buffer, ...@@ -460,6 +460,11 @@ int ff_packet_list_put(AVPacketList **packet_buffer,
return ret; return ret;
} }
} else { } else {
ret = av_packet_make_refcounted(pkt);
if (ret < 0) {
av_free(pktl);
return ret;
}
av_packet_move_ref(&pktl->pkt, pkt); av_packet_move_ref(&pktl->pkt, pkt);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment