mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avcodec/v4l2_m2m_dec: dequeue frame if input isn't ready
The V4L2M2M API operates asynchronously, so multiple packets can be enqueued before getting a batch of frames back. Since it was only possible to receive a frame by submitting another packet, there wasn't a way to drain those excess output frames from when avcodec_receive_frame() returned AVERROR(EAGAIN). Reviewed-by: Andriy Gelman <andriy.gelman@gmail.com> Signed-off-by: Cameron Gutman <aicommander@gmail.com>
This commit is contained in:
parent
63d5b6f935
commit
30322ebe3c
@ -142,8 +142,12 @@ static int v4l2_receive_frame(AVCodecContext *avctx, AVFrame *frame)
|
||||
|
||||
if (!s->buf_pkt.size) {
|
||||
ret = ff_decode_get_packet(avctx, &s->buf_pkt);
|
||||
if (ret < 0 && ret != AVERROR_EOF)
|
||||
return ret;
|
||||
if (ret < 0) {
|
||||
if (ret == AVERROR(EAGAIN))
|
||||
return ff_v4l2_context_dequeue_frame(capture, frame, 0);
|
||||
else if (ret != AVERROR_EOF)
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
if (s->draining)
|
||||
|
Loading…
Reference in New Issue
Block a user