How to finish pipeline correctly?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to finish pipeline correctly?

bronstein87
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?


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to finish pipeline correctly?

Vinod Kesti
if (!gst_element_send_event (m_pipeline, gst_event_new_eos()))
{
    return;
}

is  correct way to post EOS on pipeline.

Pipeline will post EOS on Source element on its own. Also you check if you
received EOS from sink element ?



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel