(I translated it into C code and I'm trying to reduce it both on the C code and on the command line).

1) There's a hardcoded latency of 700ms in tsdemux.c: "#define TS_LATENCY (700 * GST_MSECOND)". However, the latency that I measured is about 300ms, then, what is the 700ms value? If I set it to a lower value (i.e: 50) and recompile nothing changes.

2) Can I reduce the latency if I manually set the width and the height of the received stream, on the gst-launch-1.0 command? I tried with: "gst-launch-1.0 -v souphttpsrc location=http://127.0.0.1:8080/stream.ts ! tsdemux name=demuxer demuxer. ! h264parse ! "video/x-h264,width=640,height=480" ! avdec_h264 ! autovideosink" but nothing changes.

3) Can I reduce the latency if I manually set the width and the height of the received stream on the C code? If so, which element should I add/modify for doing that?

Re: Tsdemux latency

Hello,

On Mon, 2017-07-10 at 08:53 +0000, paolo perotinus wrote:

1) There's a hardcoded latency of 700ms in tsdemux.c: "#define TS_LATENCY (700 * GST_MSECOND)". However, the latency that I measured is about 300ms, then, what is the 700ms value? If I set it to a lower value (i.e: 50) and recompile nothing changes.

This is from the MPEG-TS specification, it corresponds to the maximum space between two PCR values, it's a relatively unavoidable worse case. You can set a lower latency on your pipeline with gst_pipeline_set_latency(), but this can cause failures (the sink dropping all the frames as late) if your stream is muxed at a higher value.

2) Can I reduce the latency if I manually set the width and the height of the received stream, on the gst-launch-1.0 command? I tried with: "gst-launch-1.0 -v souphttpsrc location=http://127.0.0.1:8080/stream.ts ! tsdemux name=demuxer demuxer. ! h264parse ! "video/x-h264,width=640,height=480" ! avdec_h264 ! autovideosink" but nothing changes.

3) Can I reduce the latency if I manually set the width and the height of the received stream on the C code? If so, which element should I add/modify for doing that?

The resolution changes nothing to that latency, it's entirely due to the MPEG-TS specification.