On Mon, 2018-09-10 at 17:00 +0200, Hans Verkuil wrote:
> From: Hans Verkuil <hans.verk...@cisco.com>
> 
> state->info was NULL since I completely forgot to set state->info.
> Oops.
> 
> Reported-by: Ezequiel Garcia <ezequ...@collabora.com>
> Signed-off-by: Hans Verkuil <hans.verk...@cisco.com>

For both patches:

Tested-by: Ezequiel Garcia <ezequ...@collabora.com>

With these changes, now this gstreamer pipeline no longer
crashes:

gst-launch-1.0 -v videotestsrc num-buffers=30 ! 
video/x-raw,width=1280,height=720 ! v4l2fwhtenc capture-io-mode=mmap 
output-io-mode=mmap ! v4l2fwhtdec
capture-io-mode=mmap output-io-mode=mmap ! fakesink

A few things:

  * You now need to mark "[PATCH] vicodec: fix sparse warning" as invalid.
  * v4l2fwhtenc/v4l2fwhtdec elements are not upstream yet.
  * Gstreamer doesn't end properly; and it seems to negotiate
    different sizes for encoded and decoded unless explicitly set.

Thanks!

>  drivers/media/platform/vicodec/vicodec-core.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/platform/vicodec/vicodec-core.c 
> b/drivers/media/platform/vicodec/vicodec-core.c
> index fdd77441a47b..5d42a8414283 100644
> --- a/drivers/media/platform/vicodec/vicodec-core.c
> +++ b/drivers/media/platform/vicodec/vicodec-core.c
> @@ -176,12 +176,15 @@ static int device_process(struct vicodec_ctx *ctx,
>       }
>  
>       if (ctx->is_enc) {
> -             unsigned int size = v4l2_fwht_encode(state, p_in, p_out);
> -
> -             vb2_set_plane_payload(&out_vb->vb2_buf, 0, size);
> +             state->info = q_out->info;
> +             ret = v4l2_fwht_encode(state, p_in, p_out);
> +             if (ret < 0)
> +                     return ret;
> +             vb2_set_plane_payload(&out_vb->vb2_buf, 0, ret);
>       } else {
> +             state->info = q_cap->info;
>               ret = v4l2_fwht_decode(state, p_in, p_out);
> -             if (ret)
> +             if (ret < 0)
>                       return ret;
>               vb2_set_plane_payload(&out_vb->vb2_buf, 0, q_cap->sizeimage);
>       }

Reply via email to