diff --git a/src/com/limelight/nvstream/NvAudioStream.java b/src/com/limelight/nvstream/NvAudioStream.java index 3d653f30..de33c0f7 100644 --- a/src/com/limelight/nvstream/NvAudioStream.java +++ b/src/com/limelight/nvstream/NvAudioStream.java @@ -87,9 +87,9 @@ public class NvAudioStream { startDepacketizerThread(); - startUdpPingThread(); - startDecoderThread(); + + startUdpPingThread(); } }).start(); diff --git a/src/com/limelight/nvstream/NvConnection.java b/src/com/limelight/nvstream/NvConnection.java index 23beb487..6ac1edf8 100644 --- a/src/com/limelight/nvstream/NvConnection.java +++ b/src/com/limelight/nvstream/NvConnection.java @@ -76,6 +76,7 @@ public class NvConnection { if (inputStream != null) { inputStream.close(); + inputStream = null; } } diff --git a/src/com/limelight/nvstream/NvVideoStream.java b/src/com/limelight/nvstream/NvVideoStream.java index 9c5b018d..8c5ba264 100644 --- a/src/com/limelight/nvstream/NvVideoStream.java +++ b/src/com/limelight/nvstream/NvVideoStream.java @@ -16,6 +16,7 @@ import com.limelight.nvstream.av.AvByteBufferPool; import com.limelight.nvstream.av.AvDecodeUnit; import com.limelight.nvstream.av.AvRtpPacket; import com.limelight.nvstream.av.video.AvVideoDepacketizer; +import com.limelight.nvstream.av.video.AvVideoPacket; import jlibrtp.Participant; import jlibrtp.RTPSession; @@ -153,19 +154,6 @@ public class NvVideoStream { return; } - // Start the receive thread early to avoid missing - // early packets - startReceiveThread(); - - // Start the keepalive ping to keep the stream going - startUdpPingThread(); - - // Start the depacketizer thread to deal with the RTP data - startDepacketizerThread(); - - // Start decoding the data we're receiving - startDecoderThread(); - // Read the first frame to start the UDP video stream try { readFirstFrame(host); @@ -175,6 +163,19 @@ public class NvVideoStream { return; } + // Start the receive thread early to avoid missing + // early packets + startReceiveThread(); + + // Start the depacketizer thread to deal with the RTP data + startDepacketizerThread(); + + // Start decoding the data we're receiving + startDecoderThread(); + + // Start the keepalive ping to keep the stream going + startUdpPingThread(); + // Render the frames that are coming out of the decoder outputDisplayLoop(this); } diff --git a/src/com/limelight/nvstream/av/audio/AvAudioDepacketizer.java b/src/com/limelight/nvstream/av/audio/AvAudioDepacketizer.java index f70eb1a7..73cd0fe5 100644 --- a/src/com/limelight/nvstream/av/audio/AvAudioDepacketizer.java +++ b/src/com/limelight/nvstream/av/audio/AvAudioDepacketizer.java @@ -52,6 +52,9 @@ public class AvAudioDepacketizer { // Put it on the decoded queue decodedUnits.add(new AvShortBufferDescriptor(pcmData, 0, decodeLen)); } + else { + pool.free(pcmData); + } } public void releaseBuffer(AvShortBufferDescriptor decodedData)