Shutdown streaming when the input connection breaks

This commit is contained in:
Cameron Gutman 2013-11-11 15:40:16 -05:00
parent 08f8942548
commit 4d80373f25

View File

@ -67,6 +67,8 @@ public class NvConnection {
public void stop() public void stop()
{ {
threadPool.shutdownNow();
videoStream.abort(); videoStream.abort();
audioStream.abort(); audioStream.abort();
@ -111,9 +113,10 @@ public class NvConnection {
} catch (XmlPullParserException e) { } catch (XmlPullParserException e) {
e.printStackTrace(); e.printStackTrace();
displayToast(e.getMessage()); displayToast(e.getMessage());
stop();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace();
displayToast(e.getMessage()); displayToast(e.getMessage());
stop();
} }
} }
}).start(); }).start();
@ -130,8 +133,8 @@ public class NvConnection {
try { try {
inputStream.sendMouseMove(deltaX, deltaY); inputStream.sendMouseMove(deltaX, deltaY);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace();
displayToast(e.getMessage()); displayToast(e.getMessage());
NvConnection.this.stop();
} }
} }
}); });
@ -148,8 +151,8 @@ public class NvConnection {
try { try {
inputStream.sendMouseButtonDown(); inputStream.sendMouseButtonDown();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace();
displayToast(e.getMessage()); displayToast(e.getMessage());
NvConnection.this.stop();
} }
} }
}); });
@ -166,8 +169,8 @@ public class NvConnection {
try { try {
inputStream.sendMouseButtonUp(); inputStream.sendMouseButtonUp();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace();
displayToast(e.getMessage()); displayToast(e.getMessage());
NvConnection.this.stop();
} }
} }
}); });
@ -189,8 +192,8 @@ public class NvConnection {
rightTrigger, leftStickX, leftStickY, rightTrigger, leftStickX, leftStickY,
rightStickX, rightStickY); rightStickX, rightStickY);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace();
displayToast(e.getMessage()); displayToast(e.getMessage());
NvConnection.this.stop();
} }
} }
}); });