From 31cac7f6a27b24af03b62df90148c4dc45570524 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Thu, 12 Dec 2013 17:45:03 -0500 Subject: [PATCH] Fix the renderer thread causing NvConnection.stop() to block forever. Remove the hack to workaround this bug. --- .../binding/video/SwingCpuDecoderRenderer.java | 15 +++++++++------ .../src/com/limelight/input/KeyboardHandler.java | 1 - 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/limelight-pc/src/com/limelight/binding/video/SwingCpuDecoderRenderer.java b/limelight-pc/src/com/limelight/binding/video/SwingCpuDecoderRenderer.java index c8a8423..8498c72 100644 --- a/limelight-pc/src/com/limelight/binding/video/SwingCpuDecoderRenderer.java +++ b/limelight-pc/src/com/limelight/binding/video/SwingCpuDecoderRenderer.java @@ -72,12 +72,15 @@ public class SwingCpuDecoderRenderer implements VideoDecoderRenderer { { long diff = nextFrameTime - System.currentTimeMillis(); - if (diff > WAIT_CEILING_MS) { - try { - Thread.sleep(diff); - } catch (InterruptedException e) { - return; - } + if (diff < WAIT_CEILING_MS) { + // We must call Thread.sleep in order to be interruptable + diff = 0; + } + + try { + Thread.sleep(diff); + } catch (InterruptedException e) { + return; } nextFrameTime = computePresentationTimeMs(targetFps); diff --git a/limelight-pc/src/com/limelight/input/KeyboardHandler.java b/limelight-pc/src/com/limelight/input/KeyboardHandler.java index 97da017..e5c9cab 100644 --- a/limelight-pc/src/com/limelight/input/KeyboardHandler.java +++ b/limelight-pc/src/com/limelight/input/KeyboardHandler.java @@ -40,7 +40,6 @@ public class KeyboardHandler implements KeyListener { event.getKeyCode() == KeyEvent.VK_Q) { System.out.println("quitting"); parent.close(); - System.exit(0); } translator.sendKeyDown(keyMap, modifier);