From 76e67ee5fc399ceb8ea31e26a2d88c6c1132f4a0 Mon Sep 17 00:00:00 2001 From: "Joshua M. Doe" Date: Mon, 21 Oct 2019 11:58:15 -0400 Subject: [PATCH] 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. --- sys/pleora/gstpleorasrc.cpp | 17 ++++++++++++++++- sys/pleora/gstpleorasrc.h | 1 + 2 files changed, 17 insertions(+), 1 deletion(-) 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;