Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2018-04-28 01:08:42 +0300
committerJames Almer <jamrial@gmail.com>2018-05-01 02:30:01 +0300
commit65d36473c930b2cefaab96da8e514cd200330c94 (patch)
treed932fdb1c025e91db3e57eefcbf1506c85465317 /libavcodec/cbs_mpeg2.c
parente3866ea20d55a17119cfcdeb630c70f0f93e1020 (diff)
avcodec/cbs_mpeg2: create a reference to the existing buffer when decomposing slice units
Reviewed-by: Mark Thompson <sw@jkqxz.net> Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/cbs_mpeg2.c')
-rw-r--r--libavcodec/cbs_mpeg2.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/libavcodec/cbs_mpeg2.c b/libavcodec/cbs_mpeg2.c
index 989daf0a4d..8ca47061fe 100644
--- a/libavcodec/cbs_mpeg2.c
+++ b/libavcodec/cbs_mpeg2.c
@@ -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 {