Skip to content

Backport of gstreamer V4L2 seeking fix #391

@ardera

Description

@ardera

There was a race condition in the gstreamer video4linux2 decoder plugin that resulted in seek operations leading to some buffer management issues, causing crashes like this later on:

0:01:04.181753782 30180   0x7f40022700 ERROR          v4l2allocator gstv4l2allocator.c:1328:gst_v4l2_allocator_dqbuf:<v4l2h264dec3:pool1:src:allocator> buffer 1 was not queued, this indicate a driver bug.
0:03:14.468175136  9634   0x7f6401b700 ERROR         v4l2bufferpool gstv4l2bufferpool.c:1491:gst_v4l2_buffer_pool_dqbuf:<v4l2h264dec0:pool1:src> No free buffer found in the pool at index 2.

(With crash I mean that gstreamer stops playback, not a real SIGSEGV). The gstreamer crashes also lead to buffer leaks of the dmabufs, which means it's not even possible to recover from it. (Because you'll quickly run out of (GPU?) memory). The only thing that can be done is terminating the process and restarting.

It is actually not that hard to trigger, you just have to do some seek operations while video playback is running. One occasion where you will definitely run into it is when doing looping video playback. E.g. when looping this video: https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4 using flutter-pi & Flutter, you will definitely see a crash after max. 5 minutes of looping.

It has been fixed in gstreamer 1.23: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4465
and the fix was backported to 1.22, and is present in 1.22.8 to 1.22.12: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5695

It would be very good if the distro package could be updated to at least gstreamer 1.22.8. I don't know who else is affected by this, but there's a lot of people complaining about this in the flutter-pi issues; and there's not really a good workaround, except disabling hardware decoding completely for affected gstreamer versions

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions