Open Bug 1751051 Opened 2 years ago Updated 1 year ago

Make decoding to shmem work on AV1 video as well

Categories

(Core :: Audio/Video: Playback, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: alwu, Assigned: alwu)

References

Details

Bug 1745285 enabled using ffvpx for decoding AV1, and bug 1713276 enabled decoding to shmem directly for ffmpeg and ffvpx.

Decoding to shmem should work on AV1 as well, but by my testing, it didn't. Our custom get_buffer2() implementation wasn't being called during AV1 decoding.

[libdav1d @ 0x7ff1ad9b8900] Requested frame threading with a custom get_buffer2() implementation which is not marked as thread safe. This is not supported anymore, make your callback thread-safe.

I saw this message, and probably libdav1d will explicitly check that thread_safe_callbacks attribute to determine if they should run a custom allocator or not. Currently, we will set thread_safe_callbacks when FF_API_THREAD_SAFE_CALLBACKS is defined, but that seems not enough?

I think libdav1d is handled somehow "special" and get_buffer2 is not called at all. see dav1d_thread_picture_alloc():
https://searchfox.org/mozilla-central/rev/5d2b9e940ca09bd1cbc15aa681f69424cde8904c/third_party/dav1d/src/decode.c#3649

I found that the allocation and deallocation functions are set here. But not sure how we should do, because that means we need to hook and transfer our custom allocator into those dav1 specific callbacks.

Priority: P1 → P3
You need to log in before you can comment on or make changes to this bug.