diff --git a/sys/pleora/gstpleorasrc.cpp b/sys/pleora/gstpleorasrc.cpp index 6d2b5f2..37e0384 100644 --- a/sys/pleora/gstpleorasrc.cpp +++ b/sys/pleora/gstpleorasrc.cpp @@ -264,6 +264,8 @@ gst_pleorasrc_init (GstPleoraSrc * src) src->stop_requested = FALSE; src->caps = NULL; + src->pvbuffer = NULL; + gst_pleorasrc_reset (src); } @@ -1144,6 +1146,12 @@ gst_pleorasrc_start (GstBaseSrc * bsrc) } } + /* grab first buffer so we can set caps before _create */ + src->pvbuffer = gst_pleorasrc_get_pvbuffer (src); + if (!src->pvbuffer) { + goto error; + } + return TRUE; error: @@ -1423,7 +1431,14 @@ gst_pleorasrc_create (GstPushSrc * psrc, GstBuffer ** buf) GST_LOG_OBJECT (src, "create"); - pvbuffer = gst_pleorasrc_get_pvbuffer (src); + if (src->pvbuffer) { + /* we have a buffer from _start to handle */ + pvbuffer = src->pvbuffer; + src->pvbuffer = NULL; + } else { + pvbuffer = gst_pleorasrc_get_pvbuffer (src); + } + if (!pvbuffer) { /* error already posted */ return GST_FLOW_ERROR; diff --git a/sys/pleora/gstpleorasrc.h b/sys/pleora/gstpleorasrc.h index 8decdd2..177e0ce 100644 --- a/sys/pleora/gstpleorasrc.h +++ b/sys/pleora/gstpleorasrc.h @@ -45,6 +45,7 @@ struct _GstPleoraSrc PvPipeline *pipeline; PvDevice *device; PvStream *stream; + PvBuffer *pvbuffer; /* properties */ gchar *device_id;