Browse Source

avpacket: fix setting AVPacket.data in av_packet_ref()

The data field does not necessarily point to the beginning of the
underlying AVBuffer.

CC: libav-stable@libav.org
tags/n3.1
Anton Khirnov 9 years ago
parent
commit
8996515b13
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      libavcodec/avpacket.c

+ 4
- 1
libavcodec/avpacket.c View File

@@ -365,16 +365,19 @@ int av_packet_ref(AVPacket *dst, AVPacket *src)
if (ret < 0)
goto fail;
memcpy(dst->buf->data, src->data, src->size);

dst->data = dst->buf->data;
} else {
dst->buf = av_buffer_ref(src->buf);
if (!dst->buf) {
ret = AVERROR(ENOMEM);
goto fail;
}
dst->data = src->data;
}

dst->size = src->size;
dst->data = dst->buf->data;
return 0;
fail:
av_packet_free_side_data(dst);


Loading…
Cancel
Save