Revert an earlier commit that introduced a bug that caused initialization to crash

This commit is contained in:
Cameron Gutman 2013-11-20 00:59:12 -05:00
parent 34905dd01e
commit f672befaa7
2 changed files with 13 additions and 14 deletions

View File

@ -137,13 +137,12 @@ public class NvConnection {
try { try {
startSteamBigPicture(); startSteamBigPicture();
performHandshake(); performHandshake();
videoStream.setupVideoStream(host, video); videoStream.startVideoStream(host, video);
audioStream.startAudioStream(host); audioStream.startAudioStream(host);
beginControlStream(); beginControlStream();
controlStream.startJitterPackets(); controlStream.startJitterPackets();
startController(); startController();
activity.hideSystemUi(); activity.hideSystemUi();
videoStream.startVideoStream(host);
} catch (XmlPullParserException e) { } catch (XmlPullParserException e) {
e.printStackTrace(); e.printStackTrace();
displayToast(e.getMessage()); displayToast(e.getMessage());

View File

@ -144,18 +144,7 @@ public class NvVideoStream {
decrend.setup(1280, 720, renderTarget); decrend.setup(1280, 720, renderTarget);
} }
public void startVideoStream(final String host) public void startVideoStream(final String host, final Surface surface)
{
// Read the first frame to start the UDP video stream
try {
readFirstFrame(host);
} catch (IOException e2) {
abort();
return;
}
}
public void setupVideoStream(final String host, final Surface surface)
{ {
// This thread becomes the output display thread // This thread becomes the output display thread
Thread t = new Thread() { Thread t = new Thread() {
@ -180,6 +169,17 @@ public class NvVideoStream {
// the reference frame // the reference frame
startUdpPingThread(); startUdpPingThread();
// Read the first frame to start the UDP video stream
// This MUST be called before the normal UDP receive thread
// starts in order to avoid state corruption caused by two
// threads simultaneously adding input data.
try {
readFirstFrame(host);
} catch (IOException e2) {
abort();
return;
}
// Start the receive thread early to avoid missing // Start the receive thread early to avoid missing
// early packets // early packets
startReceiveThread(); startReceiveThread();