avcodec/mmaldec: use decoupled dataflow
authorHo Ming Shun <cyph1984@gmail.com>
Fri, 24 Sep 2021 09:04:35 +0000 (17:04 +0800)
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
Sun, 12 Dec 2021 15:54:43 +0000 (16:54 +0100)
commitb54377b3a7cd427bc121af003f12c36a32169a74
tree481e489af43c65ecc2ee9675b5c9ed28851aed16
parent996b13fac4810efc35ff988f523f0c88a3b57ec9
avcodec/mmaldec: use decoupled dataflow

MMAL is an fundamentally an asynchronous decoder, which was a bad fit
for the legacy dataflow API. Often multiple packets are enqueued before
a flood of frames are returned from MMAL.

The previous lockstep dataflow meant that any delay in returning packets
from the VPU would cause ctx->queue_decoded_frames to grow with no way
of draining the queue.

Testing this with mpv streaming from a live RTSP source visibly reduced
latency introduced by frames waiting in queue_decoded_frames from
roughly 2s to 0.

Tested-by: Cameron Gutman <aicommander@gmail.com>
Signed-off-by: Ho Ming Shun <cyph1984@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
libavcodec/mmaldec.c