[FFmpeg-devel] [RFC] v4l2_m2m: Fix races around freeing data on close

Jorge Ramirez jorge.ramirez-ortiz at linaro.org
Fri Oct 20 12:26:28 EEST 2017


On 10/19/2017 07:55 PM, Jorge Ramirez wrote:
>
> ok so I guess there is no point to discuss further what I tried to put 
> forward (I could provide my implementation to compare against this RFC 
> - it is just a handful of lines of code - but I guess there is no 
> point given that everyone is comfortable with the current way of doing 
> things.).
>
> so let's make this work then and fix the SIGSEGV present in master 
> asap (btw this RFC also seg-fault when the above is applied)

dont worry too much about fixing this anyway - this implementation is 
incorrect and needs a couple of modifications (full reinit currently 
closes the driver when it should just send the stop command - that was 
to work around an issue in the venus driver stop ).

a fix to venus (db410/db820c hw) has been sent to the kernel mailing 
list so will validate and fix.

>
> diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c
> index 831fd81..1dd8cf0 100644
> --- a/libavcodec/v4l2_m2m_dec.c
> +++ b/libavcodec/v4l2_m2m_dec.c
> @@ -176,8 +176,8 @@ static av_cold int v4l2_decode_init(AVCodecContext 
> *avctx)
>       * by the v4l2 driver; this event will trigger a full pipeline 
> reconfig and
>       * the proper values will be retrieved from the kernel driver.
>       */
> -    output->height = capture->height = avctx->coded_height;
> -    output->width = capture->width = avctx->coded_width;
> +    output->height = capture->height = 0; //avctx->coded_height;
> +    output->width = capture->width = 0; //avctx->coded_width;
>
>      output->av_codec_id = avctx->codec_id;
>      output->av_pix_fmt  = AV_PIX_FMT_NONE;



More information about the ffmpeg-devel mailing list