From 285809b2eb69552d5867982fa656f32a7480a742 Mon Sep 17 00:00:00 2001 From: Constantin Kaplinsky Date: Tue, 17 Jun 2008 10:31:41 +0000 Subject: Code refactoring in preparation to more efficient seeking. Now we handle initial time offset in RfbProto constructor and its newSession() method. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2587 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- java/src/com/tightvnc/rfbplayer/RfbPlayer.java | 6 ++---- java/src/com/tightvnc/rfbplayer/RfbProto.java | 11 ++++++++--- 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'java/src/com/tightvnc/rfbplayer') diff --git a/java/src/com/tightvnc/rfbplayer/RfbPlayer.java b/java/src/com/tightvnc/rfbplayer/RfbPlayer.java index 4b1f4fad..98b15055 100644 --- a/java/src/com/tightvnc/rfbplayer/RfbPlayer.java +++ b/java/src/com/tightvnc/rfbplayer/RfbPlayer.java @@ -134,7 +134,7 @@ public class RfbPlayer extends java.applet.Applet } else { url = new URL(sessionURL); } - rfb = new RfbProto(url); + rfb = new RfbProto(url, initialTimeOffset); vc = new VncCanvas(this); gbc.weightx = 1.0; @@ -179,8 +179,6 @@ public class RfbPlayer extends java.applet.Applet try { setPaused(!autoPlay); rfb.fbs.setSpeed(playbackSpeed); - if (initialTimeOffset > rfb.fbs.getTimeOffset()) - setPos(initialTimeOffset); // don't seek backwards here vc.processNormalProtocol(); } catch (EOFException e) { if (e.getMessage() != null && e.getMessage().equals("[REWIND]")) { @@ -192,7 +190,7 @@ public class RfbPlayer extends java.applet.Applet initialTimeOffset = 0; autoPlay = false; } - rfb.newSession(url); + rfb.newSession(url, initialTimeOffset); vc.updateFramebufferSize(); } catch (NullPointerException e) { // catching this causes a hang with 1.4.1 JVM's under Win32 IE diff --git a/java/src/com/tightvnc/rfbplayer/RfbProto.java b/java/src/com/tightvnc/rfbplayer/RfbProto.java index a37cd612..080dfad8 100644 --- a/java/src/com/tightvnc/rfbplayer/RfbProto.java +++ b/java/src/com/tightvnc/rfbplayer/RfbProto.java @@ -73,9 +73,9 @@ class RfbProto { // // Constructor. // - RfbProto(URL url) throws Exception { + RfbProto(URL url, long timeOffset) throws Exception { fbs = null; - newSession(url); + newSession(url, timeOffset); } // Force processing to quit @@ -91,7 +91,7 @@ class RfbProto { // // Open new session URL. // - public void newSession(URL url) throws Exception { + public void newSession(URL url, long timeOffset) throws Exception { if (fbs != null) fbs.close(); @@ -107,6 +107,11 @@ class RfbProto { throw new Exception("Wrong authentication type in the session file"); } readServerInit(); + + // Go to initial position but make sure not to seek backwards. + if (timeOffset > fbs.getTimeOffset()) { + fbs.setTimeOffset(timeOffset); + } } // -- cgit v1.2.3