mpegtsmux hangs when stream discontinue for a while

Alexander Vasiliev alexvasiljev at gmail.com
Fri Jan 29 05:08:51 PST 2016


Finally, I have found the cause. On the restart of the stream some (two or
three) buffers had zero length. Somehow GstCollectPads halts when it
receives zero length buffers. So I have applied the following patch and now
it works well.
Why GstCollectPads behave this way i don't understand. Gstreamer version
1.6.3.

>From a45c0ab505562959f4e7e91bc5071a7446182006 Mon Sep 17 00:00:00 2001
From: Alexander Vasiliev <a.vasiliev at geoscan.aero>
Date: Fri, 29 Jan 2016 16:00:55 +0300
Subject: [PATCH] reject zero size buffers

---
 libs/gst/base/gstcollectpads.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libs/gst/base/gstcollectpads.c b/libs/gst/base/gstcollectpads.c
index 8edfe41..2b9a47b 100644
--- a/libs/gst/base/gstcollectpads.c
+++ b/libs/gst/base/gstcollectpads.c
@@ -2163,6 +2163,10 @@ gst_collect_pads_chain (GstPad * pad, GstObject *
parent, GstBuffer * buffer)
   GST_OBJECT_UNLOCK (pad);

   pads = data->collect;
+  if (gst_buffer_get_size (buffer) == 0) {
+    gst_buffer_unref (buffer);
+    return GST_FLOW_OK;
+  }

   GST_COLLECT_PADS_STREAM_LOCK (pads);
   /* if not started, bail out */
-- 
2.5.0


2016-01-21 14:34 GMT+03:00 Alexander Vasiliev <alexvasiljev at gmail.com>:

> Hello,
>
> I have a live video source and i want to stream it to udp. I had made a
> working pipeline. But it hangs when a stream stops for a few seconds. I.e.
> a camera can stop streaming for a while, then it continues streaming, but
> pipeline doesn't resume.
> gst-launch-1.0 v4l2src input-src=Camera ! videorate drop-only=true  !
> 'video/x-raw, format=(string)NV12, width=1920, height=1088, framerate=25/1'
> ! ce_h264enc  target-bitrate=6000000 bytestream=1 ! queue ! mpegtsmux
> alignment=7 ! udpsink host=192.168.0.1 port=3000 -v
>
> The following pipeline without mpegtsmux doesn't hangs and keeps working.
> So i am sure that it is mpegtsmux which hangs the pipeline.
> gst-launch-1.0 v4l2src input-src=Camera ! videorate drop-only=true  !
> 'video/x-raw, format=(string)NV12, width=1920, height=1088, framerate=25/1'
> ! ce_h264enc  target-bitrate=6000000 bytestream=1 ! fakesink
>
> Can mpegtsmux be configured not to hang?
>
> gstreamer version 1.6.2
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20160129/d019d6aa/attachment.html>


More information about the gstreamer-devel mailing list