On Sat, May 4, 2019 at 2:15 PM Luca Barbato <[email protected]> wrote:
>
> From: James Almer <[email protected]>
>
> Reviewed-by: Mark Thompson <[email protected]>
> Signed-off-by: James Almer <[email protected]>
> ---
>  libavcodec/cbs_h2645.c | 18 ++++--------------
>  1 file changed, 4 insertions(+), 14 deletions(-)
>
> diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c
> index bf16343db5..8cd6db3fb4 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;
> --
> 2.12.2
>
OK
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to