mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-20 22:40:47 +00:00
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
This commit is contained in:
parent
e62ff72fc1
commit
8996515b13
@ -365,16 +365,19 @@ int av_packet_ref(AVPacket *dst, AVPacket *src)
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
memcpy(dst->buf->data, src->data, src->size);
|
memcpy(dst->buf->data, src->data, src->size);
|
||||||
|
|
||||||
|
dst->data = dst->buf->data;
|
||||||
} else {
|
} else {
|
||||||
dst->buf = av_buffer_ref(src->buf);
|
dst->buf = av_buffer_ref(src->buf);
|
||||||
if (!dst->buf) {
|
if (!dst->buf) {
|
||||||
ret = AVERROR(ENOMEM);
|
ret = AVERROR(ENOMEM);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
dst->data = src->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
dst->size = src->size;
|
dst->size = src->size;
|
||||||
dst->data = dst->buf->data;
|
|
||||||
return 0;
|
return 0;
|
||||||
fail:
|
fail:
|
||||||
av_packet_free_side_data(dst);
|
av_packet_free_side_data(dst);
|
||||||
|
Loading…
Reference in New Issue
Block a user