diff options
author | Anton Khirnov <anton@khirnov.net> | 2016-05-12 15:34:58 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2016-05-16 10:31:08 +0200 |
commit | 8996515b137f962e3a8691241c285c96437b6c53 (patch) | |
tree | 06ef1c0c3bc3138593cd52e62a14a45813554f6a /libavcodec/avpacket.c | |
parent | e62ff72fc1052273deb708ba715f73e5187281d4 (diff) | |
download | ffmpeg-8996515b137f962e3a8691241c285c96437b6c53.tar.gz |
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
Diffstat (limited to 'libavcodec/avpacket.c')
-rw-r--r-- | libavcodec/avpacket.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c index 59fc6f29da..04d6244163 100644 --- a/libavcodec/avpacket.c +++ b/libavcodec/avpacket.c @@ -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); |