[FFmpeg-cvslog] avcodec/v4l2_context: use EAGAIN to signal when input buffers are unavailable

Aman Gupta git at videolan.org
Tue Sep 3 01:26:48 EEST 2019


ffmpeg | branch: master | Aman Gupta <aman at tmm1.net> | Wed Aug 28 16:42:46 2019 -0700| [c95b1277332a818ab177978a248a1a7133550bcb] | committer: Aman Gupta

avcodec/v4l2_context: use EAGAIN to signal when input buffers are unavailable

ENOMEM indicates an allocation failure, and there are no allocations
happening here. The buffers are pre-allocated and there are simply
none available at this time.

Signed-off-by: Aman Gupta <aman at tmm1.net>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c95b1277332a818ab177978a248a1a7133550bcb
---

 libavcodec/v4l2_context.c | 2 +-
 libavcodec/v4l2_m2m_dec.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c
index c28d46d777..6924760840 100644
--- a/libavcodec/v4l2_context.c
+++ b/libavcodec/v4l2_context.c
@@ -572,7 +572,7 @@ int ff_v4l2_context_enqueue_packet(V4L2Context* ctx, const AVPacket* pkt)
 
     avbuf = v4l2_getfree_v4l2buf(ctx);
     if (!avbuf)
-        return AVERROR(ENOMEM);
+        return AVERROR(EAGAIN);
 
     ret = ff_v4l2_buffer_avpkt_to_buf(pkt, avbuf);
     if (ret)
diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c
index 6f31772f4c..5fb8ddd542 100644
--- a/libavcodec/v4l2_m2m_dec.c
+++ b/libavcodec/v4l2_m2m_dec.c
@@ -142,7 +142,7 @@ static int v4l2_receive_frame(AVCodecContext *avctx, AVFrame *frame)
 
     ret = ff_v4l2_context_enqueue_packet(output, &avpkt);
     if (ret < 0) {
-        if (ret != AVERROR(ENOMEM))
+        if (ret != AVERROR(EAGAIN))
            return ret;
         /* no input buffers available, continue dequeing */
     }



More information about the ffmpeg-cvslog mailing list