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 {
startSteamBigPicture();
performHandshake();
videoStream.setupVideoStream(host, video);
videoStream.startVideoStream(host, video);
audioStream.startAudioStream(host);
beginControlStream();
controlStream.startJitterPackets();
startController();
activity.hideSystemUi();
videoStream.startVideoStream(host);
} catch (XmlPullParserException e) {
e.printStackTrace();
displayToast(e.getMessage());

View File

@ -144,18 +144,7 @@ public class NvVideoStream {
decrend.setup(1280, 720, renderTarget);
}
public void startVideoStream(final String host)
{
// 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)
public void startVideoStream(final String host, final Surface surface)
{
// This thread becomes the output display thread
Thread t = new Thread() {
@ -180,6 +169,17 @@ public class NvVideoStream {
// the reference frame
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
// early packets
startReceiveThread();