pleorasrc: set caps before _create to avoid bad negotiation

Caps must be fixated before _create, otherwise initial caps is
width=1,height=1 which cause some sinks to create incorrect window
sizes.
This commit is contained in:
Joshua M. Doe 2019-10-21 11:58:15 -04:00
parent 88f7a82818
commit 76e67ee5fc
2 changed files with 17 additions and 1 deletions

View File

@ -264,6 +264,8 @@ gst_pleorasrc_init (GstPleoraSrc * src)
src->stop_requested = FALSE; src->stop_requested = FALSE;
src->caps = NULL; src->caps = NULL;
src->pvbuffer = NULL;
gst_pleorasrc_reset (src); 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; return TRUE;
error: error:
@ -1423,7 +1431,14 @@ gst_pleorasrc_create (GstPushSrc * psrc, GstBuffer ** buf)
GST_LOG_OBJECT (src, "create"); GST_LOG_OBJECT (src, "create");
if (src->pvbuffer) {
/* we have a buffer from _start to handle */
pvbuffer = src->pvbuffer;
src->pvbuffer = NULL;
} else {
pvbuffer = gst_pleorasrc_get_pvbuffer (src); pvbuffer = gst_pleorasrc_get_pvbuffer (src);
}
if (!pvbuffer) { if (!pvbuffer) {
/* error already posted */ /* error already posted */
return GST_FLOW_ERROR; return GST_FLOW_ERROR;

View File

@ -45,6 +45,7 @@ struct _GstPleoraSrc
PvPipeline *pipeline; PvPipeline *pipeline;
PvDevice *device; PvDevice *device;
PvStream *stream; PvStream *stream;
PvBuffer *pvbuffer;
/* properties */ /* properties */
gchar *device_id; gchar *device_id;