[Libva] [PATCH 1/3] Fix the segfault while encoding multiple slice per frame.

Zhao, Yakui yakui.zhao at intel.com
Wed May 28 17:43:18 PDT 2014


On Wed, 2014-05-28 at 15:02 -0600, sreerenj.balachandran at intel.com
wrote:
> From: Sreerenj Balachandran <sreerenj.balachandran at intel.com>
> 
> Zero initialize the packed raw data index array and
> packed slice header index array during each preallocation.

Looks good to me. 

Add: Reviewed-by: Zhao, Yakui <yakui.zhao at intel.com>

Thanks.
    Yakui
> ---
>  src/i965_drv_video.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/src/i965_drv_video.c b/src/i965_drv_video.c
> index c5a4f37..44da864 100755
> --- a/src/i965_drv_video.c
> +++ b/src/i965_drv_video.c
> @@ -2293,6 +2293,7 @@ i965_encoder_render_picture(VADriverContextP ctx,
>                   * the packed data index/count for the slice
>                   */
>                  if (encode->max_slice_params_ext > encode->slice_num) {
> +                    int slice_num = encode->slice_num;
>                      encode->slice_num = encode->max_slice_params_ext;
>                      encode->slice_rawdata_index = realloc(encode->slice_rawdata_index,
>                                                            encode->slice_num * sizeof(int));
> @@ -2300,6 +2301,12 @@ i965_encoder_render_picture(VADriverContextP ctx,
>                                                            encode->slice_num * sizeof(int));
>                      encode->slice_header_index = realloc(encode->slice_header_index,
>                                                            encode->slice_num * sizeof(int));
> +                    memset(encode->slice_rawdata_index + slice_num, 0,
> +                        sizeof(int) * NUM_SLICES);
> +                    memset(encode->slice_rawdata_count + slice_num, 0,
> +                        sizeof(int) * NUM_SLICES);
> +                    memset(encode->slice_header_index + slice_num, 0,
> +                        sizeof(int) * NUM_SLICES);
>                      if ((encode->slice_rawdata_index == NULL) ||
>                          (encode->slice_header_index == NULL)  ||
>                          (encode->slice_rawdata_count == NULL)) {




More information about the Libva mailing list