avcodec/avpacket: Respect payload offset in av_packet_ref

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Andriy Lysnevych 2016-05-12 17:47:09 +03:00 committed by Michael Niedermayer
parent 77d1e88cf5
commit ed3a02547c
1 changed files with 3 additions and 1 deletions

View File

@ -568,16 +568,18 @@ int av_packet_ref(AVPacket *dst, const 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);