8GQuark flowErrorPostedQuark()
10 static const GQuark quark = g_quark_from_static_string(
"qgc-flow-error-posted");
16GstFlowReturn absorbFlowError(GstPad* pad, GstObject* parent, GstFlowReturn result)
18 if (result >= GST_FLOW_EOS) {
22 if (!g_object_get_qdata(G_OBJECT(pad), flowErrorPostedQuark())) {
23 g_object_set_qdata(G_OBJECT(pad), flowErrorPostedQuark(), GINT_TO_POINTER(TRUE));
24 GST_ELEMENT_FLOW_ERROR(GST_ELEMENT_CAST(parent), result);
29GstFlowReturn guardedChain(GstPad* pad, GstObject* parent, GstBuffer* buffer)
31 return absorbFlowError(pad, parent, gst_proxy_pad_chain_default(pad, parent, buffer));
34GstFlowReturn guardedChainList(GstPad* pad, GstObject* parent, GstBufferList* list)
36 return absorbFlowError(pad, parent, gst_proxy_pad_chain_list_default(pad, parent, list));
45 if (!sink || !GST_IS_GHOST_PAD(sink.get()) || (GST_PAD_CHAINFUNC(sink.get()) != gst_proxy_pad_chain_default) ||
46 (GST_PAD_CHAINLISTFUNC(sink.get()) != gst_proxy_pad_chain_list_default)) {
47 qCWarning(GstVideoReceiverLog) <<
"Unable to keep the flow errors of" << GST_OBJECT_NAME(part)
51 gst_pad_set_chain_function(sink.get(), guardedChain);
52 gst_pad_set_chain_list_function(sink.get(), guardedChainList);
62 qCWarning(GstVideoReceiverLog) <<
"Failed to create the queue and valve of the" << what <<
"branch";
65 g_object_set(
valve.get(),
"drop", TRUE,
nullptr);
71 if (!binQueue || !binValve || !gst_element_link_many(tee, binQueue, binValve,
nullptr)) {
72 qCWarning(GstVideoReceiverLog) <<
"Unable to link the" << what <<
"branch";
82 _overrun.disconnect();
90 (void) _overrun.connect(_queue,
"overrun", callback, data);
99 g_object_set(_valve,
"drop", FALSE,
nullptr);
106 g_object_set(_valve,
"drop", TRUE,
nullptr);
120 return (
object == GST_OBJECT_CAST(_queue)) || (
object == GST_OBJECT_CAST(_valve));
struct _GstElement GstElement
void open()
Lets frames through and asks upstream for a keyframe to start from.
void reset()
Forgets the elements, which the pipeline still owns, and disconnects the overrun handler.
bool contains(GstObject *object) const
Whether object is the queue or the valve.
GstElement * valve() const
void close()
Drops frames again; nothing before build().
bool build(GstElement *pipeline, GstElement *tee, GStreamer::PipelineBranch branch, const char *what)
void requestKeyframe() const
Asks upstream for a keyframe; nothing before build().
GstElement * queue() const
void onOverrun(GCallback callback, gpointer data)
static void absorbFlowErrors(GstElement *part)
GstElementPtr makeElement(const char *factory, const char *name=nullptr)
void markBranch(GstElement *element, PipelineBranch branch)
Marks element and everything inside it as part of branch.
PipelineBranch
The tee branch a pipeline element belongs to, so a bus message can be blamed on the part that failed.
GstElement * addToBin(GstElement *bin, GstElementPtr element, const char *what)
std::unique_ptr< GstElement, GstObjectDeleter > GstElementPtr
std::unique_ptr< GstPad, GstObjectDeleter > GstPadPtr
GstPadPtr adoptPad(GstPad *pad) noexcept
void requestKeyframe(GstPad *sinkPad)