From: Nicolas Dufresne Date: Tue, 5 Sep 2023 20:51:24 +0000 (-0400) Subject: v4l2: bufferpool: Avoid warnings on empty last buffer X-Git-Tag: 1.22.7~77 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bce30535988d33acff5a9164ccaaf7092f9e24a2;p=platform%2Fupstream%2Fgstreamer.git v4l2: bufferpool: Avoid warnings on empty last buffer Some drivers will push an buffer flagged LAST but empty. In decoder case, this results in an "producing too many buffer" warning, even though the result is entirely correct. Detect this case in order to signal EOS earlier and avoid this warning. Part-of: --- diff --git a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2bufferpool.c b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2bufferpool.c index 68bab75..8c6eba1 100644 --- a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2bufferpool.c +++ b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2bufferpool.c @@ -1275,6 +1275,12 @@ gst_v4l2_buffer_pool_dqbuf (GstV4l2BufferPool * pool, GstBuffer ** buffer, group->buffer.index); } + if (group->buffer.flags & V4L2_BUF_FLAG_LAST && + group->planes[0].bytesused == 0) { + GST_DEBUG_OBJECT (pool, "Empty last buffer, signalling eos."); + goto eos; + } + outbuf = pool->buffers[group->buffer.index]; if (outbuf == NULL) goto no_buffer;