[Live-devel] RTP MJPEG: incorrect framerate

Brilliantov Kirill Vladimirovich brilliantov at byterg.ru
Thu Nov 28 04:06:02 PST 2013


Hello!
I use live555 2013.10.25 on my FreeScale iMX53 board.
Now I add MJPEG RTP stream, for this I write class based on
JPEGVideoSource with doGetNextFrame, afterGettingFrame and
afterGettingFrame1 functions.

void JPEG::doGetNextFrame()
{
	fFrameSize = 0;
	//_src is a class based on FramedSource
	_src->getNextFrame(fTo, fMaxSize, afterGettingFrame, this,
FramedSource::handleClosure, this);
}

void JPEG::afterGettingFrame(void* clientData, unsigned frameSize,
unsigned numTruncatedBytes, struct timeval presentationTime, unsigned
durationInMicroseconds)
{
	JPEG *source = static_cast<JPEG *>(clientData);
	source->afterGettingFrame1(frameSize, numTruncatedBytes,
presentationTime, durationInMicroseconds);
}

void JPEG::afterGettingFrame1(unsigned frameSize, unsigned
numTruncatedBytes, struct timeval presentationTime, unsigned
durationInMicroseconds)
{
	size_t header_len = 0;

	fFrameSize = frameSize;

	if (jpeg_param_from_header(fTo, fFrameSize, &header_len)) {
		fFrameSize -= header_len;
		memmove(fTo, &fTo[header_len], fFrameSize);
		fNumTruncatedBytes = numTruncatedBytes;
		fPresentationTime.tv_sec = presentationTime.tv_sec;
		fPresentationTime.tv_usec = presentationTime.tv_usec;
		fDurationInMicroseconds = durationInMicroseconds;
		*_env << "duration " << fDurationInMicroseconds << "\n";

	}

	FramedSource::afterGetting(this);
}

Follow programm output:
.....
duration 119947
duration 80010
duration 79983
.....

For view RTP stream I use follow GStreamer pipeline:
gst-launch -v udpsrc multicast-group=224.1.4.6 port=5000
caps="application/x-rtp, media=(string)video, clock-rate=(int)90000,
payload=(int)96, encoding-name=(string)JPEG" ! rtpjpegdepay !
ffdec_mjpeg ! xvimagesink

Unfortunally programm exit with message "Internal data flow error".
GStreamer output:
..........
/GstPipeline:pipeline0/GstRtpJPEGDepay:rtpjpegdepay0.GstPad:sink: caps =
application/x-rtp, media=(string)video, clock-rate=(int)90000,
payload=(int)96, encoding-name=(string)JPEG
/GstPipeline:pipeline0/GstRtpJPEGDepay:rtpjpegdepay0.GstPad:src: caps =
image/jpeg, framerate=(fraction)0/1, width=(int)1280, height=(int)720

** (gst-launch-0.10:10622): WARNING **: offset=12 should be less then
plen=12

** (gst-launch-0.10:10622): CRITICAL **: gst_adapter_push: assertion
`GST_IS_BUFFER (buf)' failed
/GstPipeline:pipeline0/ffdec_mjpeg:ffdec_mjpeg0.GstPad:sink: caps =
image/jpeg, framerate=(fraction)0/1, width=(int)1280, height=(int)720
/GstPipeline:pipeline0/ffdec_mjpeg:ffdec_mjpeg0.GstPad:src: caps =
video/x-raw-yuv, width=(int)1280, height=(int)720,
framerate=(fraction)0/1, format=(fourcc)Y42B, interlaced=(boolean)false

I see correct resolution 1280x720, but framerate not correct.
Why and how can I solve this proble?

Thank you and excuse me for my bad english.

-- 
Best regards,
Brilliantov Kirill Vladimirovich



More information about the live-devel mailing list