[Live-devel] Demux live MPEGTS multicast stream and feed it to RTSP server

Ross Finlayson finlayson at live555.com
Mon Mar 22 16:33:06 PDT 2021



> On Mar 22, 2021, at 12:00 PM, Thorson, Joshua C <joshua.thorson at gatech.edu> wrote:
> 
> It seems to be an issue with the StreamParser, when it is ensuring valid bytes the number of bytes that are needed is only 1 but the UDP source is reading ~940 bytes. So, the if statement: fCurParserIndex + numBytesNeeded > BANK_SIZE never becomes true, thus never switching the parser banks. I fixed this issue by subclassing the BasicUDPSource and overriding the maxFrameSize function to something > ~940. 

Thank you.  You discovered a deficiency in the “BasicUDPSource” class that prevented it from working properly with “StreamSource” subclasses.  I have just installed a new version (2021.03.22) of the code that fixes this, by having “BasicUDPSource” reimplement the “maxFrameSize()” virtual function.


> With this now working I now need to figure out how to hookup the MPEG2TransportStreamDemux to the H264VideoRTPSink. I believe it should go something like this:
> 
>   MPEGTS Multicast Stream -----> BasicUDPSource -----> MPEG2TransportStreamDemux -----> H264VideoRTPSink
> 
> However, I understand I don't have the ability to specify the sink for the various demuxed elementry streams. Is there any way this could be added or subclassed to allow such a thing?

Unfortunately the current “MPEG2TransportStreamDemux” class doesn’t make it possible to do this - so I’ll need to redesign this class, in some future version of the code.  (Stay tuned.)

In the meantime, you can do the following:
	Modify the “PIDState_STREAM()” constructor in “MPEG2TransportStreamParser_STREAM.cpp” to set the “fileName” to “stdout” (perhaps only if st.dataType == StreamType::VIDEO).

Then, if you want to stream via multicast, edit “testH264VideoStreamer.cpp” (in “testProgs”) to change “inputFileName” to “stdin”, then run
	yourDemuxerApplication | your-modified-testH264VideoStreamer

Alternatively, if you want to stream via unicast, then edit “testOnDemandRTSPServer.cpp” (in “testProgs”) as follows:
	- on line 32, change “reuseFirstSource” from “False” to “True”
	- on line 101, change “inputFileName” to “stdin”
Then run
	yourDemuxerApplication | your-modified-testOnDemandRTSPServer


Ross Finlayson
Live Networks, Inc.
http://www.live555.com/




More information about the live-devel mailing list