#9957 closed defect (fixed)

v4l2_m2m decoding: trying to dequeue capture queue while queue is not allocated

Reported by: trya Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: v4l2m2m
Cc: trya Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by trya)

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.

Change History (3)

comment:2 by trya, 20 months ago

Description: modified (diff)

comment:3 by Marton Balint, 10 months ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.