How to finish pipeline correctly?

Борис bumatov at gmail.com
Thu Feb 20 13:27:46 UTC 2020


Hi. I'm new in gstreamer and i have a question about finishing some type of
pipelines.
When i using pipeline like that:

appsrc ! videoconvert ! omxh264enc ! h264parse ! qtmux ! filesink
location=test.mov

In the end, before delete pipeline i send EOS message like that (where
source is appsrc):

if (gst_app_src_end_of_stream(GST_APP_SRC(source)) != GST_FLOW_OK)

{

    return;

}


GstBus* bus = gst_element_get_bus(pipeline);

GstMessage *msg = gst_bus_timed_pop_filtered(bus, GST_CLOCK_TIME_NONE,
(GstMessageType)(GST_MESSAGE_ERROR | GST_MESSAGE_EOS));

if (!msg || GST_MESSAGE_TYPE(msg) == GST_MESSAGE_ERROR)

{

    if(msg != NULL)

    {

        gst_message_unref(msg);

        g_object_unref(G_OBJECT(bus));

    }

    return;

}


But what if i have pipeline like this and there is no appsrc:

"rtspsrc location=rtsp://localhost:57575/vd latency=0 tcp-timeout=2000000
connection-speed=100000 protocols=GST_RTSP_LOWER_TRANS_TCP !
application/x-rtp,encoding-name=H265,payload=96 ! rtph265depay ! h265parse
 ! matroskamux ! filesink location=test_10bit.mkv"

As i can understand, solution in this case is to replace
gst_app_src_end_of_stream(GST_APP_SRC(source)  with  gst_element_send_event

if (!gst_element_send_event (m_pipeline, gst_event_new_eos()))

{

    return;

}


GstBus* bus = gst_element_get_bus(pipeline);

GstMessage *msg = gst_bus_timed_pop_filtered(bus, GST_CLOCK_TIME_NONE,
(GstMessageType)(GST_MESSAGE_ERROR | GST_MESSAGE_EOS));

if (!msg || GST_MESSAGE_TYPE(msg) == GST_MESSAGE_ERROR)

{

    if(msg != NULL)

    {

        gst_message_unref(msg);

        g_object_unref(G_OBJECT(bus));

    }

    return;

}

Is it correct solution?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20200220/9edd3238/attachment.htm>


More information about the gstreamer-devel mailing list