[FFmpeg-trac] #9957(avcodec:new): v4l2_m2m decoding: trying to dequeue capture queue while queue is not allocated

FFmpeg trac at avcodec.org
Mon Oct 3 16:17:55 EEST 2022


#9957: v4l2_m2m decoding: trying to dequeue capture queue while queue is not
allocated
------------------------------------+-----------------------------------
             Reporter:  trya        |                    Owner:  (none)
                 Type:  defect      |                   Status:  new
             Priority:  normal      |                Component:  avcodec
              Version:  git-master  |               Resolution:
             Keywords:  v4l2m2m     |               Blocked By:
             Blocking:              |  Reproduced by developer:  0
Analyzed by developer:  0           |
------------------------------------+-----------------------------------
Description changed by trya:

Old description:

> Summary of the bug:
>
> At the first call of v4l2_receive_frame(), if the packet fails to be
> decoded with error EAGAIN, the function tries to dequeue from the capture
> context, while the capture buffers have not been allocated yet (they will
> be on a further call to v4l2_try_start()), thus causing a segfault in
> that case.
>
> How to reproduce:
>
> Play or decode any H264 video on a Raspberry Pi. I encountered the
> problem with mpv first (any version), and couldn't get to reproduce it
> with neither ffmpeg or ffplay, because the first call to
> ff_decode_get_packet() doesn't fail with EAGAIN, thus allowing the
> capture buffers to be allocated after then.
> Calling v4l2_try_start() between ff_decode_get_packet() and
> ff_v4l2_context_dequeue_frame() seems to prevent segfault on mpv. But
> then, mpv cannot either seek or loop the video, and ffplay cannot seek
> either, but that seems unrelated to this issue.

New description:

 Summary of the bug:

 At the first call of v4l2_receive_frame(), if the packet fails to be
 decoded with error EAGAIN, the function tries to dequeue from the capture
 context, while the capture buffers have not been allocated yet (they will
 be on a further call to v4l2_try_start()), thus causing a segfault in that
 case.

 How to reproduce:

 Play or decode any H264 video on a Raspberry Pi with the h264_v4l2m2m
 decoder. I encountered the problem with mpv first (any version), and
 couldn't get to reproduce it with neither ffmpeg or ffplay, because the
 first call to ff_decode_get_packet() doesn't fail with EAGAIN, thus
 allowing the capture buffers to be allocated after then.
 Calling v4l2_try_start() between ff_decode_get_packet() and
 ff_v4l2_context_dequeue_frame() seems to prevent segfault on mpv. But
 then, mpv cannot either seek or loop the video, and ffplay cannot seek
 either, but that seems unrelated to this issue.

--
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/9957#comment:2>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list