Fix order of initialization of streams.

This commit is contained in:
Cameron Gutman 2013-11-10 02:53:19 -05:00
parent 0a445b9add
commit c631649867
4 changed files with 20 additions and 15 deletions

View File

@ -87,9 +87,9 @@ public class NvAudioStream {
startDepacketizerThread(); startDepacketizerThread();
startUdpPingThread();
startDecoderThread(); startDecoderThread();
startUdpPingThread();
} }
}).start(); }).start();

View File

@ -76,6 +76,7 @@ public class NvConnection {
if (inputStream != null) { if (inputStream != null) {
inputStream.close(); inputStream.close();
inputStream = null;
} }
} }

View File

@ -16,6 +16,7 @@ import com.limelight.nvstream.av.AvByteBufferPool;
import com.limelight.nvstream.av.AvDecodeUnit; import com.limelight.nvstream.av.AvDecodeUnit;
import com.limelight.nvstream.av.AvRtpPacket; import com.limelight.nvstream.av.AvRtpPacket;
import com.limelight.nvstream.av.video.AvVideoDepacketizer; import com.limelight.nvstream.av.video.AvVideoDepacketizer;
import com.limelight.nvstream.av.video.AvVideoPacket;
import jlibrtp.Participant; import jlibrtp.Participant;
import jlibrtp.RTPSession; import jlibrtp.RTPSession;
@ -153,19 +154,6 @@ public class NvVideoStream {
return; 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 // Read the first frame to start the UDP video stream
try { try {
readFirstFrame(host); readFirstFrame(host);
@ -175,6 +163,19 @@ public class NvVideoStream {
return; 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 // Render the frames that are coming out of the decoder
outputDisplayLoop(this); outputDisplayLoop(this);
} }

View File

@ -52,6 +52,9 @@ public class AvAudioDepacketizer {
// Put it on the decoded queue // Put it on the decoded queue
decodedUnits.add(new AvShortBufferDescriptor(pcmData, 0, decodeLen)); decodedUnits.add(new AvShortBufferDescriptor(pcmData, 0, decodeLen));
} }
else {
pool.free(pcmData);
}
} }
public void releaseBuffer(AvShortBufferDescriptor decodedData) public void releaseBuffer(AvShortBufferDescriptor decodedData)