Increase the default receive buffers for the RTP sockets to avoid dropping packets while the receive thread is suspended by the OS scheduler. Windows uses particularly small (8KB) receive buffers by default which this should work around.

This commit is contained in:
Cameron Gutman 2013-12-19 14:50:50 -05:00
parent 4701c22b67
commit 48f8a05bae
2 changed files with 5 additions and 0 deletions

View File

@ -18,6 +18,8 @@ public class AudioStream {
public static final int RTP_PORT = 48000;
public static final int RTCP_PORT = 47999;
public static final int RTP_RECV_BUFFER = 64 * 1024;
private LinkedBlockingQueue<RtpPacket> packets = new LinkedBlockingQueue<RtpPacket>(100);
private DatagramSocket rtp;
@ -87,6 +89,7 @@ public class AudioStream {
{
rtp = new DatagramSocket(null);
rtp.setReuseAddress(true);
rtp.setReceiveBufferSize(RTP_RECV_BUFFER);
rtp.bind(new InetSocketAddress(RTP_PORT));
}

View File

@ -24,6 +24,7 @@ public class VideoStream {
public static final int FIRST_FRAME_PORT = 47996;
public static final int FIRST_FRAME_TIMEOUT = 5000;
public static final int RTP_RECV_BUFFER = 128 * 1024;
private LinkedBlockingQueue<RtpPacket> packets = new LinkedBlockingQueue<RtpPacket>(100);
@ -124,6 +125,7 @@ public class VideoStream {
{
rtp = new DatagramSocket(null);
rtp.setReuseAddress(true);
rtp.setReceiveBufferSize(RTP_RECV_BUFFER);
rtp.bind(new InetSocketAddress(RTP_PORT));
}