pa1
pa1

Reputation: 868

RTP packet drop issue(?)

I have a client and a server, where server sends the audio data by RTP packets encapsulated inside UDP. Client receives the packets. As UDP has no flow control, client checks for the sequence number of the packet and rearranges them if they come out of order. My question here is, I see client never receives packet with some sequence number, as show below in the wireshark -

wireshark showing packet loss

If this is the case, when i play the audio at client side, it is distorted(obvious). How do i avoid it? What factors effect these? Should i set the socket buffer size to a large value?

Appreciate reply in advance.
EDIT 1: This issue is on QNX platform and not on Linux. I observed the output of "netstat -p udp" to see if that gives any hint about why packets are getting dropped on QNX and not on Linux.

QNX:

SOCK=/dev/d_usb3/ netstat -p udp 
 udp:
 8673 datagrams received
 0 with incomplete header
 60 with bad data length field
 0 with bad checksum
 0 dropped due to no socket
 2 broadcast/multicast datagrams dropped due to no socket
 0 dropped due to full socket buffers
 8611 delivered
 8592 PCB hash misses

On Linux I see netstat shows no packet drops with the same server and same audio!

Any leads? Why this might be? Driver issue? Networking stack?

Upvotes: 1

Views: 2614

Answers (1)

jaybers
jaybers

Reputation: 2211

You need to specify how you are handling lost packets in your client.

If you lose packets, that means you have missing data in your audio stream. So your client has to "do something" where it is missing data. Some options are - play silence (makes a cracking noise due to sharp envelop to 0) - fade to silence - estimate waveform by examining adjacent data - play noise

You play cannot misalign packets or play them with missing packets. For example, suppose you you get packet 1,2,3,4 and 6. You are missing packet 5. You cannot play packet 4 then play packet 6. Something has to happen to fill the space of packet 5.

See this post for more info.

Upvotes: 1

Related Questions