diff options
author | wm4 <nfxjfg at googlemail.com> | 2015-09-24 08:49:41 +0200 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2015-09-24 10:34:46 +0200 |
commit | a9b8c638cfe2f82191db65e3e3a39f3b35df81f5 (patch) | |
tree | 1103a5ea95cdcbbc273386acb1fc4833110b0bf1 /libavcodec/mmaldec.c | |
parent | 49623f531972be5dc2dd8c1b4b8748cad7c424ff (diff) | |
download | ffmpeg-a9b8c638cfe2f82191db65e3e3a39f3b35df81f5.tar.gz |
mmal: Fix AVBufferRef usage
AVBufferRef.data and AVPacket.data don't need to have the same value.
AVPacket could point anywhere into the buffer. Likewise, the sizes
don't need to be the same.
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavcodec/mmaldec.c')
-rw-r--r-- | libavcodec/mmaldec.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libavcodec/mmaldec.c b/libavcodec/mmaldec.c index fea3fc43b4..ae9d749fc9 100644 --- a/libavcodec/mmaldec.c +++ b/libavcodec/mmaldec.c @@ -433,17 +433,20 @@ static int ffmmal_add_packet(AVCodecContext *avctx, AVPacket *avpkt, if (avpkt->size) { if (avpkt->buf) { buf = av_buffer_ref(avpkt->buf); + size = avpkt->size; + data = avpkt->data; } else { buf = av_buffer_alloc(avpkt->size); - if (buf) + if (buf) { memcpy(buf->data, avpkt->data, avpkt->size); + size = buf->size; + data = buf->data; + } } if (!buf) { ret = AVERROR(ENOMEM); goto done; } - size = buf->size; - data = buf->data; if (!is_extradata) ctx->packets_sent++; } else { |