[FFmpeg-devel] [PATCH 2/2] avcodec/v4l2: fix segmentation fault on codec exit
Jorge Ramirez-Ortiz
jorge.ramirez-ortiz at linaro.org
Fri Oct 6 21:59:40 EEST 2017
On 10/06/2017 09:52 AM, Jorge Ramirez-Ortiz wrote:
> It occurs when the codec is closed while buffer references still
> exist. This is a regression from the original patchset where support
> for this use-case was implemented.
>
> The regression occurred while cleaning the code for the last patchset
> (decoding was tested only with ffplay which disposes of the buffer
> straightaway hence the feature went in broken/untested)
> ---
> libavcodec/v4l2_m2m.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
bug fix. needed in 3.4
>
> diff --git a/libavcodec/v4l2_m2m.c b/libavcodec/v4l2_m2m.c
> index bd96a6d..5e85bcb 100644
> --- a/libavcodec/v4l2_m2m.c
> +++ b/libavcodec/v4l2_m2m.c
> @@ -331,8 +331,10 @@ int ff_v4l2_m2m_codec_end(AVCodecContext *avctx)
>
> ff_v4l2_context_release(&s->output);
>
> - if (atomic_load(&s->refcount))
> - av_log(avctx, AV_LOG_ERROR, "ff_v4l2m2m_codec_end leaving pending buffers\n");
> + if (atomic_load(&s->refcount)) {
> + av_log(avctx, AV_LOG_DEBUG, "ff_v4l2m2m_codec_end leaving pending buffers\n");
> + return 0;
> + }
>
> ff_v4l2_context_release(&s->capture);
> sem_destroy(&s->refsync);
More information about the ffmpeg-devel
mailing list