Fix the renderer thread causing NvConnection.stop() to block forever. Remove the hack to workaround this bug.

This commit is contained in:
Cameron Gutman
2013-12-12 17:45:03 -05:00
parent e9a4b82267
commit 31cac7f6a2
2 changed files with 9 additions and 7 deletions
@@ -72,13 +72,16 @@ public class SwingCpuDecoderRenderer implements VideoDecoderRenderer {
{ {
long diff = nextFrameTime - System.currentTimeMillis(); long diff = nextFrameTime - System.currentTimeMillis();
if (diff > WAIT_CEILING_MS) { if (diff < WAIT_CEILING_MS) {
// We must call Thread.sleep in order to be interruptable
diff = 0;
}
try { try {
Thread.sleep(diff); Thread.sleep(diff);
} catch (InterruptedException e) { } catch (InterruptedException e) {
return; return;
} }
}
nextFrameTime = computePresentationTimeMs(targetFps); nextFrameTime = computePresentationTimeMs(targetFps);
if (AvcDecoder.getRgbFrameInt(imageBuffer, imageBuffer.length)) { if (AvcDecoder.getRgbFrameInt(imageBuffer, imageBuffer.length)) {
@@ -40,7 +40,6 @@ public class KeyboardHandler implements KeyListener {
event.getKeyCode() == KeyEvent.VK_Q) { event.getKeyCode() == KeyEvent.VK_Q) {
System.out.println("quitting"); System.out.println("quitting");
parent.close(); parent.close();
System.exit(0);
} }
translator.sendKeyDown(keyMap, modifier); translator.sendKeyDown(keyMap, modifier);