aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/cbs_h2645.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2018-04-27 20:44:39 -0300
committerJames Almer <jamrial@gmail.com>2018-04-30 20:30:02 -0300
commit0807a771600956e1f3e36a202fd3877418541eb0 (patch)
tree688b73f3a2970738d25758bdcc4fe7fdf680d389 /libavcodec/cbs_h2645.c
parent65d36473c930b2cefaab96da8e514cd200330c94 (diff)
downloadffmpeg-0807a771600956e1f3e36a202fd3877418541eb0.tar.gz
avcodec/cbs_h2645: 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_h2645.c')
-rw-r--r--libavcodec/cbs_h2645.c18
1 files changed, 4 insertions, 14 deletions
diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c
index 5585831cf6..5e5598f377 100644
--- a/libavcodec/cbs_h2645.c
+++ b/libavcodec/cbs_h2645.c
@@ -776,15 +776,10 @@ static int cbs_h264_read_nal_unit(CodedBitstreamContext *ctx,
}
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;
- memcpy(slice->data,
- unit->data + pos / 8, slice->data_size);
- memset(slice->data + slice->data_size, 0,
- AV_INPUT_BUFFER_PADDING_SIZE);
+ slice->data = unit->data + pos / 8;
slice->data_bit_start = pos % 8;
}
break;
@@ -946,15 +941,10 @@ static int cbs_h265_read_nal_unit(CodedBitstreamContext *ctx,
}
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;
- memcpy(slice->data,
- unit->data + pos / 8, slice->data_size);
- memset(slice->data + slice->data_size, 0,
- AV_INPUT_BUFFER_PADDING_SIZE);
+ slice->data = unit->data + pos / 8;
slice->data_bit_start = pos % 8;
}
break;