简体   繁体   English

RTP数据包丢弃问题(?)

[英]RTP packet drop issue(?)

I have a client and a server, where server sends the audio data by RTP packets encapsulated inside UDP. 我有一个客户端和一个服务器,其中服务器通过封装在UDP中的RTP数据包发送音频数据。 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. 由于UDP没有流控制,因此客户端会检查数据包的序列号,并在数据顺序混乱时重新排列它们。 My question here is, I see client never receives packet with some sequence number, as show below in the wireshark - 我在这里的问题是,我看到客户端永远不会收到具有某个序列号的数据包,如以下在wireshark中所示:

Wireshk显示数据包丢失

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. 编辑1:此问题是在QNX平台而不是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. 我观察了“ netstat -p udp”的输出,以查看是否有任何提示说明为什么数据包在QNX而不是Linux上被丢弃。

QNX: 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! 在Linux上,我看到netstat显示没有相同服务器和相同音频的数据包丢失!

Any leads? 有线索吗? Why this might be? 为什么会这样呢? Driver issue? 驱动程序问题? Networking stack? 网络堆栈?

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 一些选项是-播放静音(由于急剧包络到0会产生开裂的噪音)-淡入静音-通过检查相邻数据估算波形-播放噪音

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. 例如,假设您得到了数据包1,2,3,4和6。您丢失了数据包5。您不能先播放数据包4,然后再播放数据包6。

See this post for more info. 有关更多信息,请参见此帖子。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM