{
GstBuffer *tmp;
- if (buf->pool == bpool)
- /* nothing, data was inside the buffer when we did _acquire() */
- goto done;
+ if (buf->pool == bpool) {
+ if (gst_buffer_get_size (buf) == 0)
+ goto eos;
+ else
+ /* nothing, data was inside the buffer when we did _acquire() */
+ goto done;
+ }
/* buffer not from our pool, grab a frame and copy it into the target */
if ((ret = gst_v4l2_buffer_pool_dqbuf (pool, &tmp)) != GST_FLOW_OK)
goto done;
+ /* An empty buffer on capture indicates the end of stream */
+ if (gst_buffer_get_size (tmp) == 0) {
+ gst_buffer_unref (tmp);
+ goto eos;
+ }
+
if (!gst_v4l2_object_copy (obj, buf, tmp))
goto copy_failed;
GST_ERROR_OBJECT (obj->element, "failed to start streaming");
return GST_FLOW_ERROR;
}
+eos:
+ {
+ GST_DEBUG_OBJECT (obj->element, "end of stream reached");
+ return GST_FLOW_EOS;
+ }
}
if (ret != GST_FLOW_OK)
goto beach;
- /* Check if buffer isn't the last one */
- if (gst_buffer_get_size (buffer) == 0)
- goto beach;
-
GST_LOG_OBJECT (decoder, "Process output buffer");
ret =
gst_v4l2_buffer_pool_process (GST_V4L2_BUFFER_POOL (self->