summaryrefslogtreecommitdiff
path: root/libavcodec/cbs_mpeg2.c
diff options
context:
space:
mode:
authorMark Thompson <sw@jkqxz.net>2017-09-12 22:11:47 +0100
committerMark Thompson <sw@jkqxz.net>2017-09-12 22:11:47 +0100
commite7f64191b27bcf37cbf7006606f0f439c6cdc24f (patch)
tree533a7943c8536c84ae35087f1db7dc7ea41960b2 /libavcodec/cbs_mpeg2.c
parent44cde38c8acbef7d5250e6d1b52b1020871e093b (diff)
cbs: Add buffer padding when splitting fragments
Remove any trailing zeroes from H.26[45] NAL units at the same time.
Diffstat (limited to 'libavcodec/cbs_mpeg2.c')
-rw-r--r--libavcodec/cbs_mpeg2.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/cbs_mpeg2.c b/libavcodec/cbs_mpeg2.c
index cbee42e905..3c09377df3 100644
--- a/libavcodec/cbs_mpeg2.c
+++ b/libavcodec/cbs_mpeg2.c
@@ -131,10 +131,11 @@ static int cbs_mpeg2_split_fragment(CodedBitstreamContext *ctx,
unit_size = (end - 4) - (start - 1);
}
- unit_data = av_malloc(unit_size);
+ unit_data = av_malloc(unit_size + AV_INPUT_BUFFER_PADDING_SIZE);
if (!unit_data)
return AVERROR(ENOMEM);
memcpy(unit_data, start - 1, unit_size);
+ memset(unit_data + unit_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
err = ff_cbs_insert_unit_data(ctx, frag, i, unit_type,
unit_data, unit_size);