Pause/Resume pipeline error

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

Pause/Resume pipeline error

riteshSTPL
I am using qt-gstreamer 1.2 with gstreamer 1.2.4 on nVidia TX1 running Ubuntu 14.04.

I am having a pipeline with camera preview + recording + Ethernet Streaming + Wifi Streaming and i want to make pipeline dynamic. ex i can add/remove recording/Streaming on running pipeline.

I pause pipeline to add/remove elements and then resume without using pads and its blocking capabilities. This works fine. But pipeline hangs after several add/remove of elements. and it hangs when i paused the pipeline.

I found that its Pause/Resume which hangs pipeline not Linking/Unlinking elements on pause.
If i add less elements in pipeline like only adding elements required for preview and recording then pipeline hangs after long time then with all elements.

All sink element sync and async are false.

    m_pipeline  =   QGst::Pipeline::create();
    m_source    =   QGst::ElementFactory::make("v4l2src", "v4l2src");
    m_filter1   =   QGst::ElementFactory::make("capsfilter", "capsfilter");
    m_convert   =   QGst::ElementFactory::make("nvvidconv", "videoconvert");
    m_filter2   =   QGst::ElementFactory::make("capsfilter", "capsfilter1");
    m_filter3   =   QGst::ElementFactory::make("capsfilter", "capsfilter2");
    m_tee       =   QGst::ElementFactory::make("tee", "tee");
    m_tee1      =   QGst::ElementFactory::make("tee", "tee1");
    m_enc       =   QGst::ElementFactory::make("omxh264enc", "omxh264enc");
    m_enc1      =   QGst::ElementFactory::make("omxh264enc", "omxh264enc1");
    m_parse     =   QGst::ElementFactory::make("h264parse", "h264parse");
    m_parse1    =   QGst::ElementFactory::make("h264parse", "h264parse1");
    m_parse2    =   QGst::ElementFactory::make("h264parse", "h264parse2");
    m_mux       =   QGst::ElementFactory::make("qtmux", "qtmux");
    m_filesink  =   QGst::ElementFactory::make("filesink", "filesink");
    m_queue1    =   QGst::ElementFactory::make("queue", "queue1");
    m_queue2    =   QGst::ElementFactory::make("queue", "queue2");
    m_queue3    =   QGst::ElementFactory::make("queue", "queue3");
    m_queue4    =   QGst::ElementFactory::make("queue", "queue4");
    m_queue5    =   QGst::ElementFactory::make("queue", "queue5");
    m_queue6    =   QGst::ElementFactory::make("queue", "queue6");
    m_queue7    =   QGst::ElementFactory::make("queue", "queue7");
    m_queue8    =   QGst::ElementFactory::make("queue", "queue8");
    m_fakesink  =   QGst::ElementFactory::make("fakesink", "fakesink");
    m_rtppay1   =   QGst::ElementFactory::make("rtph264pay", "rtph264pay");
    m_rtppay2   =   QGst::ElementFactory::make("rtph264pay", "rtph264pay1");
    m_udpsink   =   QGst::ElementFactory::make("udpsink", "udpsink");
    m_udpsink1  =   QGst::ElementFactory::make("udpsink", "udpsink1");
    m_videoSink =   QGst::ElementFactory::make("nvoverlaysink", "sink");
    m_tee2      =   QGst::ElementFactory::make("tee", "tee3");
    m_fakesink1 =   QGst::ElementFactory::make("fakesink", "fakesink1");
    m_mux1       =   QGst::ElementFactory::make("qtmux", "qtmux1");
    m_filesink1 =   QGst::ElementFactory::make("filesink", "filesink1");

    m_filter1->setProperty("caps", QGst::Caps::fromString("video/x-raw, width=1920, height=1080, format=UYVY, framerate=60/1"));
    m_filter2->setProperty("caps", QGst::Caps::fromString("video/x-raw(memory:NVMM), width=1920, height=1080, format=I420, framerate=60/1"));
    m_filter3->setProperty("caps", QGst::Caps::fromString("video/x-h264, stream-format=(string)byte-stream"));

    m_videoSink->setProperty("sync", false);
    m_videoSink->setProperty("async", false);

    m_pipeline->setProperty("video-sink", m_videoSink);

    m_filesink->setProperty("sync", false);
    m_filesink->setProperty("async", false);
    m_enc->setProperty("bitrate", 19000000);
    m_enc->setProperty("low-latency", 1);
    m_enc->setProperty("control-rate", 2);
    m_filesink->setProperty("location", "/home/ubuntu/video.mp4");
    m_rtppay1->setProperty("mtu", 1400);
    m_rtppay2->setProperty("mtu", 1400);

    m_filesink1->setProperty("sync", false);
    m_filesink1->setProperty("async", false);
    m_filesink1->setProperty("location", "/home/ubuntu/video1.mp4");

    m_udpsink->setProperty("port", 5000);
    m_udpsink->setProperty("sync", false);
    m_udpsink->setProperty("async", false);
    m_udpsink->setProperty("host", "127.0.0.1");

    m_udpsink1->setProperty("port", 8554);
    m_udpsink1->setProperty("sync", false);
    m_udpsink1->setProperty("async", false);
    m_udpsink1->setProperty("host", "172.10.10.135");

    m_pipeline->add(m_source, m_filter1, m_tee2, m_queue6, m_fakesink1);
    m_pipeline->add(m_queue7, m_convert, m_filter2, m_tee, m_queue1, m_videoSink);
    m_pipeline->add(m_queue2, m_enc, m_filter3, m_tee1, m_queue8, m_fakesink);
    m_pipeline->add(m_queue3, m_parse, m_mux, m_filesink);
    m_pipeline->add(m_queue4, m_parse1, m_rtppay1, m_udpsink);
    m_pipeline->add(m_queue5, m_parse2, m_rtppay2, m_udpsink1);

    m_pipeline->linkMany(m_source, m_filter1, m_tee2, m_queue6, m_fakesink1);
    m_pipeline->linkMany(m_tee2, m_queue7, m_convert, m_filter2, m_tee, m_queue1, m_videoSink);
    m_pipeline->linkMany(m_tee, m_queue2, m_enc, m_filter3, m_tee1, m_queue8, m_fakesink);
    m_pipeline->linkMany(m_tee1, m_queue3, m_parse, m_mux, m_filesink);
    m_pipeline->linkMany(m_tee1, m_queue4, m_parse1, m_rtppay1, m_udpsink);
    m_pipeline->linkMany(m_tee1, m_queue5, m_parse2, m_rtppay2, m_udpsink1);


for testing i am pause and play pipeline every 1 sec.

        m_pipeline->setState(QGst::StatePaused);
        QThread::msleep(10);
        m_pipeline->setState(QGst::StatePlaying);


The pipeline hangs after several Pause/Resume.
If i remove last 2 lines of linkmany and add the i can pause/resume more times than with all elements added.

So whats the problem here?
How can i pause / play pipeline efficiently?
Reply | Threaded
Open this post in threaded view
|

Re: Pause/Resume pipeline error

Mikl

Hello,


Did you tried to:

1) m_pipeline->setState(QGst::StatePaused);
2) wait on bus for "paused" event

3) m_pipeline->setState(QGst::StatePlaying);


Mikl


From: gstreamer-devel <[hidden email]> on behalf of riteshSTPL <[hidden email]>
Sent: Tuesday, January 31, 2017 11:13:30 AM
To: [hidden email]
Subject: Pause/Resume pipeline error
 
I am using qt-gstreamer 1.2 with gstreamer 1.2.4 on nVidia TX1 running Ubuntu
14.04.

I am having a pipeline with camera preview + recording + Ethernet Streaming
+ Wifi Streaming and i want to make pipeline dynamic. ex i can add/remove
recording/Streaming on running pipeline.

I pause pipeline to add/remove elements and then resume without using pads
and its blocking capabilities. This works fine. But pipeline hangs after
several add/remove of elements. and it hangs when i paused the pipeline.

I found that its Pause/Resume which hangs pipeline not Linking/Unlinking
elements on pause.
If i add less elements in pipeline like only adding elements required for
preview and recording then pipeline hangs after long time then with all
elements.

All sink element sync and async are false.

    m_pipeline  =   QGst::Pipeline::create();
    m_source    =   QGst::ElementFactory::make("v4l2src", "v4l2src");
    m_filter1   =   QGst::ElementFactory::make("capsfilter", "capsfilter");
    m_convert   =   QGst::ElementFactory::make("nvvidconv", "videoconvert");
    m_filter2   =   QGst::ElementFactory::make("capsfilter", "capsfilter1");
    m_filter3   =   QGst::ElementFactory::make("capsfilter", "capsfilter2");
    m_tee       =   QGst::ElementFactory::make("tee", "tee");
    m_tee1      =   QGst::ElementFactory::make("tee", "tee1");
    m_enc       =   QGst::ElementFactory::make("omxh264enc", "omxh264enc");
    m_enc1      =   QGst::ElementFactory::make("omxh264enc", "omxh264enc1");
    m_parse     =   QGst::ElementFactory::make("h264parse", "h264parse");
    m_parse1    =   QGst::ElementFactory::make("h264parse", "h264parse1");
    m_parse2    =   QGst::ElementFactory::make("h264parse", "h264parse2");
    m_mux       =   QGst::ElementFactory::make("qtmux", "qtmux");
    m_filesink  =   QGst::ElementFactory::make("filesink", "filesink");
    m_queue1    =   QGst::ElementFactory::make("queue", "queue1");
    m_queue2    =   QGst::ElementFactory::make("queue", "queue2");
    m_queue3    =   QGst::ElementFactory::make("queue", "queue3");
    m_queue4    =   QGst::ElementFactory::make("queue", "queue4");
    m_queue5    =   QGst::ElementFactory::make("queue", "queue5");
    m_queue6    =   QGst::ElementFactory::make("queue", "queue6");
    m_queue7    =   QGst::ElementFactory::make("queue", "queue7");
    m_queue8    =   QGst::ElementFactory::make("queue", "queue8");
    m_fakesink  =   QGst::ElementFactory::make("fakesink", "fakesink");
    m_rtppay1   =   QGst::ElementFactory::make("rtph264pay", "rtph264pay");
    m_rtppay2   =   QGst::ElementFactory::make("rtph264pay", "rtph264pay1");
    m_udpsink   =   QGst::ElementFactory::make("udpsink", "udpsink");
    m_udpsink1  =   QGst::ElementFactory::make("udpsink", "udpsink1");
    m_videoSink =   QGst::ElementFactory::make("nvoverlaysink", "sink");
    m_tee2      =   QGst::ElementFactory::make("tee", "tee3");
    m_fakesink1 =   QGst::ElementFactory::make("fakesink", "fakesink1");
    m_mux1       =   QGst::ElementFactory::make("qtmux",        "qtmux1");
    m_filesink1 =   QGst::ElementFactory::make("filesink", "filesink1");

    m_filter1->setProperty("caps", QGst::Caps::fromString("video/x-raw,
width=1920, height=1080, format=UYVY, framerate=60/1"));
    m_filter2->setProperty("caps",
QGst::Caps::fromString("video/x-raw(memory:NVMM), width=1920, height=1080,
format=I420, framerate=60/1"));
    m_filter3->setProperty("caps", QGst::Caps::fromString("video/x-h264,
stream-format=(string)byte-stream"));

    m_videoSink->setProperty("sync", false);
    m_videoSink->setProperty("async", false);

    m_pipeline->setProperty("video-sink", m_videoSink);

    m_filesink->setProperty("sync", false);
    m_filesink->setProperty("async", false);
    m_enc->setProperty("bitrate", 19000000);
    m_enc->setProperty("low-latency", 1);
    m_enc->setProperty("control-rate", 2);
    m_filesink->setProperty("location", "/home/ubuntu/video.mp4");
    m_rtppay1->setProperty("mtu", 1400);
    m_rtppay2->setProperty("mtu", 1400);

    m_filesink1->setProperty("sync", false);
    m_filesink1->setProperty("async", false);
    m_filesink1->setProperty("location", "/home/ubuntu/video1.mp4");

    m_udpsink->setProperty("port", 5000);
    m_udpsink->setProperty("sync", false);
    m_udpsink->setProperty("async", false);
    m_udpsink->setProperty("host", "127.0.0.1");

    m_udpsink1->setProperty("port", 8554);
    m_udpsink1->setProperty("sync", false);
    m_udpsink1->setProperty("async", false);
    m_udpsink1->setProperty("host", "172.10.10.135");

    m_pipeline->add(m_source, m_filter1, m_tee2, m_queue6, m_fakesink1);
    m_pipeline->add(m_queue7, m_convert, m_filter2, m_tee, m_queue1,
m_videoSink);
    m_pipeline->add(m_queue2, m_enc, m_filter3, m_tee1, m_queue8,
m_fakesink);
    m_pipeline->add(m_queue3, m_parse, m_mux, m_filesink);
    m_pipeline->add(m_queue4, m_parse1, m_rtppay1, m_udpsink);
    m_pipeline->add(m_queue5, m_parse2, m_rtppay2, m_udpsink1);

    m_pipeline->linkMany(m_source, m_filter1, m_tee2, m_queue6,
m_fakesink1);
    m_pipeline->linkMany(m_tee2, m_queue7, m_convert, m_filter2, m_tee,
m_queue1, m_videoSink);
    m_pipeline->linkMany(m_tee, m_queue2, m_enc, m_filter3, m_tee1,
m_queue8, m_fakesink);
    m_pipeline->linkMany(m_tee1, m_queue3, m_parse, m_mux, m_filesink);
    m_pipeline->linkMany(m_tee1, m_queue4, m_parse1, m_rtppay1, m_udpsink);
    m_pipeline->linkMany(m_tee1, m_queue5, m_parse2, m_rtppay2, m_udpsink1);


for testing i am pause and play pipeline every *1 sec*.
        m_pipeline->setState(QGst::StatePaused);
        QThread::msleep(10);
        m_pipeline->setState(QGst::StatePlaying);


The pipeline hangs after several Pause/Resume.
If i remove last 2 lines of linkmany and add the i can pause/resume more
times than with all elements added.

So whats the problem here?
How can i pause / play pipeline efficiently?



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Pause-Resume-pipeline-error-tp4681663.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel