Commit 65d36473 authored by James Almer's avatar James Almer

avcodec/cbs_mpeg2: create a reference to the existing buffer when decomposing slice units

Reviewed-by: 's avatarMark Thompson <sw@jkqxz.net>
Signed-off-by: 's avatarJames Almer <jamrial@gmail.com>
parent e3866ea2
......@@ -191,16 +191,11 @@ static int cbs_mpeg2_read_unit(CodedBitstreamContext *ctx,
len = unit->data_size;
slice->data_size = len - pos / 8;
slice->data_ref = av_buffer_alloc(slice->data_size +
AV_INPUT_BUFFER_PADDING_SIZE);
slice->data_ref = av_buffer_ref(unit->data_ref);
if (!slice->data_ref)
return AVERROR(ENOMEM);
slice->data = slice->data_ref->data;
slice->data = unit->data + pos / 8;
memcpy(slice->data,
unit->data + pos / 8, slice->data_size);
memset(slice->data + slice->data_size, 0,
AV_INPUT_BUFFER_PADDING_SIZE);
slice->data_bit_start = pos % 8;
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment