[Live-devel] Subject: MJPEG streaming server and packet fragmentation

Ross Finlayson finlayson at live555.com
Tue May 2 06:38:21 PDT 2017


> I used the openRTSP program and it does not produce any files

This is strange.  Something - but I’m not sure what - is apparently wrong with the way that your server is generating JPEG frames.

To try to figure this out, take a look at your server’s calls to:
	JPEGVideoRTPSink::doSpecialFrameHandling()	(in “liveMedia/JPEGVideoRTPSink.cpp”, line 49),
and, in particular, the values of the “fragmentationOffset” and “numRemainingBytes” parameters in each call.

- In the case when your JPEG frames are small enough to fit in a single outgoing RTP packet, this function should be getting called just once for each JPEG frame, with the “fragmentationOffset” parameter 0, and the “numRemainingBytes” parameter also 0.

- In the case when your JPEG frames are too large to fit in a single outgoing RTP packet, this function should be called several times for each JPEG frame:
	- The first time, “fragmentationOffset” should be 0, and “numRemainingBytes” should be non-zero
	- The 2nd through N-1st time, “fragmentationOffset” should be non-zero, and “numRemainingBytes” should also be non-zero
	- The last (Nth) time, “fragmentationOffset” should be non-zero, and “numRemainingBytes” should be zero.

Note that it’s the last call to this function (with “numRemainingBytes” == 0) that will cause the RTP ‘M’ bit to get set in the outgoing RTP packet (the last RTP packet for the JPEG frame).  This is what should be causing the receiver (e.g., “openRTSP”) to figure out when it has received a complete frame.

But for some reason, this is not happening properly...


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




More information about the live-devel mailing list