diff --git a/common/src/main/java/org/red5/server/net/rtmp/RTMPConnection.java b/common/src/main/java/org/red5/server/net/rtmp/RTMPConnection.java index e63c818179db2bc231c93d137e0e15713556d4ee..6a5c171529d861ec1b537bd573208bdc412c461a 100755 --- a/common/src/main/java/org/red5/server/net/rtmp/RTMPConnection.java +++ b/common/src/main/java/org/red5/server/net/rtmp/RTMPConnection.java @@ -295,6 +295,11 @@ public abstract class RTMPConnection extends BaseConnection implements IStreamCa */ protected long maxHandlingTimeout = 500L; + /** + * Maximum time in milliseconds to wait for a message. + */ + private long maxPollTimeout = 10000L; + /** * Bandwidth limit type / enforcement. (0=hard,1=soft,2=dynamic) */ @@ -1513,7 +1518,7 @@ public abstract class RTMPConnection extends BaseConnection implements IStreamCa do { try { // DTS appears to be off only by < 10ms - Packet p = receivedPacketQueue.poll(10000L, TimeUnit.MILLISECONDS); // wait for a packet up to 10 seconds + Packet p = receivedPacketQueue.poll(maxPollTimeout, TimeUnit.MILLISECONDS); // wait for a packet up to 10 seconds if (p != null) { if (isTrace) { log.trace("Handle received packet: {}", p); @@ -1860,6 +1865,14 @@ public abstract class RTMPConnection extends BaseConnection implements IStreamCa this.maxHandlingTimeout = maxHandlingTimeout; } + public long getMaxPollTimeout() { + return maxPollTimeout; + } + + public void setMaxPollTimeout(long maxPollTimeout) { + this.maxPollTimeout = maxPollTimeout; + } + public int getChannelsInitalCapacity() { return channelsInitalCapacity; } diff --git a/server/src/main/server/conf/red5-core.xml b/server/src/main/server/conf/red5-core.xml index a56be7ea1ff6ae90a5c510407249ccda107cce1e..0e178eed1aa886ad741c218ddf4bd89ec0993483 100644 --- a/server/src/main/server/conf/red5-core.xml +++ b/server/src/main/server/conf/red5-core.xml @@ -112,6 +112,8 @@ <property name="maxInactivity" value="${rtmp.max_inactivity}" /> <!-- Max. time in milliseconds to wait for a valid handshake. --> <property name="maxHandshakeTimeout" value="${rtmp.max_handshake_time}" /> + <!-- Max. time in milliseconds to wait for a message while polling --> + <property name="maxPollTimeout" value="${rtmp.max_poll_time}" /> <!-- Default server bandwidth per connection --> <property name="defaultServerBandwidth" value="${rtmp.default_server_bandwidth}" /> <!-- Default client bandwidth per connection --> diff --git a/server/src/main/server/conf/red5.properties b/server/src/main/server/conf/red5.properties index 931abc5a68182f469b871d4899af1c07374d6239..810dd2308e5fb9dda8020f8e70cb16a99eef7393 100644 --- a/server/src/main/server/conf/red5.properties +++ b/server/src/main/server/conf/red5.properties @@ -23,6 +23,8 @@ rtmp.max_read_buffer_size=65536 rtmp.ping_interval=1000 rtmp.max_inactivity=60000 rtmp.max_handshake_time=5000 +# maximum time to wait for a message while polling in milliseconds +rtmp.max_poll_time=10000 rtmp.tcp_nodelay=true rtmp.tcp_keepalive=false rtmp.default_server_bandwidth=10000000