How to send RTP-stream-packets in correct intervals?
Posted: 20 Jul 2012 21:53
I am developing an application, in which a RTP-stream streamed by VLC (the data is a mp4 played at regular speed) and recorded with Wireshark is sent from a sender to a receiver. The sender FEC-encodes (using the library OpenFEC) the data and the receiver FEC-decodes the data and sents the RTP-packets to port 5004. In each FEC-unit there is e.g. 250 RTP-packets.
At the receiver-side, when an whole FEC-unit is received, it is FEC-decoded; and all of the RTP-packets in the FEC-unit are put on a playback-queue.
The playback-queue runs in a separate thread and is sending packets in intervals calculated as:
The packets are sent in their correct order to VLC listening at port 5004 (rtp://127.0.0.1:5004).
However, the stream is not playing as smooth as it does when it is sent by VLC to VLC listening at port 5004 (rtp://127.0.0.1:5004).
My guess is that the determinitive factor is in which interval the packets are sent.
Based on the timestamp and other relevant parameters, how do I calculate the interval I should wait between the transmission the packets?
At the receiver-side, when an whole FEC-unit is received, it is FEC-decoded; and all of the RTP-packets in the FEC-unit are put on a playback-queue.
The playback-queue runs in a separate thread and is sending packets in intervals calculated as:
Code: Select all
( timestamp of next packet - timestamp of current packet) * factor
However, the stream is not playing as smooth as it does when it is sent by VLC to VLC listening at port 5004 (rtp://127.0.0.1:5004).
My guess is that the determinitive factor is in which interval the packets are sent.
Based on the timestamp and other relevant parameters, how do I calculate the interval I should wait between the transmission the packets?