summaryrefslogtreecommitdiff
path: root/libavcodec/avpacket.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/avpacket.c')
-rw-r--r--libavcodec/avpacket.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index fa2844d2cf..a485064eee 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -198,6 +198,7 @@ static int copy_packet_data(AVPacket *pkt, const AVPacket *src, int dup)
{
pkt->data = NULL;
pkt->side_data = NULL;
+ pkt->side_data_elems = 0;
if (pkt->buf) {
AVBufferRef *ref = av_buffer_ref(src->buf);
if (!ref)
@@ -207,9 +208,11 @@ static int copy_packet_data(AVPacket *pkt, const AVPacket *src, int dup)
} else {
DUP_DATA(pkt->data, src->data, pkt->size, 1, ALLOC_BUF);
}
- if (pkt->side_data_elems && dup)
+ if (src->side_data_elems && dup) {
pkt->side_data = src->side_data;
- if (pkt->side_data_elems && !dup) {
+ pkt->side_data_elems = src->side_data_elems;
+ }
+ if (src->side_data_elems && !dup) {
return av_copy_packet_side_data(pkt, src);
}
return 0;