avcodec/avpacket: Respect payload offset in av_packet_ref
authorAndriy Lysnevych <andriy.lysnevych@gmail.com>
Thu, 12 May 2016 14:47:09 +0000 (17:47 +0300)
committerMichael Niedermayer <michael@niedermayer.cc>
Fri, 13 May 2016 01:49:26 +0000 (03:49 +0200)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/avpacket.c

index 9cdfafd..bcc7c79 100644 (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);