To begin, I assume that you have already read http://live555.com/liveMedia/faq.html#jpeg-streaming which explains why streaming MJPEG over RTP is usually a bad idea.
> http://imgur.com/a/ApaBy > > In this particular case I was trying to stream a JPEG with approximately 40kB > of payload. If I understand correctly, it looks like > only the first network packet containing this JPEG frame is being taken into > account, and the rest is just discarded, so that's > why the image is distorted this way. > > The question is - what I'm doing wrong? I’m not sure. In this case network packet loss is *not* the problem, because (as I explain in the link above) if a network packet were lost, then *none* of the JPEG image would have been reconstructed at the receiving end. Therefore, I think that the problem is VLC; for some reason, it does not seem to be rendering the entire JPEG image correctly, even though it will have received it all. I would start by making sure that you’re using an up-to-date version of VLC; see http://www.videolan.org/vlc Another thing that I’d do is try using our command-line RTSP client “openRTSP” (see <http://www.live555.com/openRTSP/>) rather than VLC as the receiving client. If you run “openRTSP” with the “-m” option, it should output a series of files, one for each video frame. If you rename each of these files to have a “.jpg” filename suffix, then you should be able to view each file (using normal image viewer software). One more thing. Instead of doing this: > memcpy(fTo, SPACE_JPG + offset, SPACE_JPG_len - offset); > > fFrameSize = SPACE_JPG_len - offset; You should check to make sure that you have enough space available to do the copy (although, in your case, it appears that you do). Instead, to be safer, do this: fFrameSize = SPACE_JPG_len - offset; if (fFrameSize > fMaxSize) { fNumTruncatedBytes = fFrameSize - fMaxSize; fFrameSize = fMaxSize; } memcpy(fTo, SPACE_JPG + offset, fFrameSize); Ross Finlayson Live Networks, Inc. http://www.live555.com/ _______________________________________________ live-devel mailing list live-devel@lists.live555.com http://lists.live555.com/mailman/listinfo/live-devel