Hi all !
First of all, thanks for your great job !
I'm using FMJ's RTP Session Manager inside Sun's JMF framework.
I place FMJ.jar in my classpath, and I do something like this:
Then I have some troubles sending/receiving a Video stream: the buffer in RTPSendStream.transferData() is sometimes erased by other data, and wrong RTP packets are sent.
I looked up what was happening: Sun's JMF uses several buffers in their RawBufferMux (sort of double buffering). When read method is called, RawBufferMux swaps its internal buffer with the one we pass in parameters.
FMJ also does something like this:
if (recvBuffer.getData() != buffer)
System.arraycopy(recvBuffer.getData(), recvBuffer.getOffset(), buffer, RTPHeader.SIZE, recvBuffer.getLength());
As a result, we share the same buffer between Sun's JMF and FMJ ! And, then, buffer is sometimes erased by JMF !
I found a second bug about timestamp, still in RTPSendStream. In transferData, timestamp is directly taken from Buffer. But buffer's timestamp is in nanoseconds, and clockRate is not taken into account. Timestamp field in RTP is only 4 bytes... and time in nanoseconds may be greater than 4 bytes !
As a result, player receives packets with a random timestamp...
Here is a patch that resolves these bugs. It works for my application.
Thank you again for your work !