From: george82 Date: Thu, 3 Mar 2005 15:47:55 +0000 (+0000) Subject: Blank session frame when the session stopped. X-Git-Tag: v0.0.90~384^2~602 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0d2e19d6ef7f615aca333f3c5c259542f7963003;p=tigervnc.git Blank session frame when the session stopped. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@233 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- diff --git a/rfbplayer/rfbplayer.cxx b/rfbplayer/rfbplayer.cxx index e96cd39e..a8c4e380 100644 --- a/rfbplayer/rfbplayer.cxx +++ b/rfbplayer/rfbplayer.cxx @@ -226,7 +226,8 @@ RfbPlayer::RfbPlayer(char *_fileName, int _depth = DEPTH_AUTO, seekMode(false), fileName(_fileName), lastPos(0), timeStatic(0), speedEdit(0), posTrackBar(0), speedUpDown(0), acceptBell(_acceptBell), rfbReader(0), sessionTimeMs(0), sliderDraging(false), sliderStepMs(0), - loopPlayback(false), imageDataStartTime(0), rewindFlag(false) { + loopPlayback(false), imageDataStartTime(0), rewindFlag(false), + stopped(false) { CTRL_BAR_HEIGHT = 28; @@ -806,6 +807,10 @@ void RfbPlayer::rewind() { } void RfbPlayer::processMsg() { + // Perform return if waitWhilePaused processed because + // rfbReader thread could receive the signal to close + if (waitWhilePaused()) return; + static long update_time = GetTickCount(); try { if ((!isSeeking()) && ((GetTickCount() - update_time) > 250) @@ -829,7 +834,8 @@ void RfbPlayer::processMsg() { rewindFlag = true; long seekOffset = max(getSeekOffset(), imageDataStartTime); rewind(); - setPos(seekOffset); + if (!stopped) setPos(seekOffset); + else stopped = false; updatePos(seekOffset); rewindFlag = false; } else { @@ -948,6 +954,15 @@ bool RfbPlayer::invalidateBufferRect(const Rect& crect) { return true; } +bool RfbPlayer::waitWhilePaused() { + bool result = false; + while(isPaused() && !isSeeking()) { + Sleep(20); + result = true; + } + return result; +} + long RfbPlayer::calculateSessionTime(char *filename) { FbsInputStream sessionFile(filename); sessionFile.setTimeOffset(100000000); @@ -1054,8 +1069,9 @@ void RfbPlayer::setPaused(bool paused) { } void RfbPlayer::stopPlayback() { - setPos(0); + stopped = true; if (is) is->pausePlayback(); + setPos(0); tb.checkButton(ID_STOP, true); tb.checkButton(ID_PLAY, false); tb.checkButton(ID_PAUSE, false); diff --git a/rfbplayer/rfbplayer.h b/rfbplayer/rfbplayer.h index 5c82bc32..2379dbda 100644 --- a/rfbplayer/rfbplayer.h +++ b/rfbplayer/rfbplayer.h @@ -135,8 +135,9 @@ class RfbPlayer : public RfbProto { char *fileName; - private: + protected: bool seekMode; + bool stopped; long lastPos; bool sliderDraging; long sliderStepMs; @@ -145,17 +146,18 @@ class RfbPlayer : public RfbProto { int time_pos_s; int CTRL_BAR_HEIGHT; - protected: // rfbReader is a class which used to reading the rfb data from the file rfbSessionReader *rfbReader; // Returns true if part of the supplied rect is visible, false otherwise bool invalidateBufferRect(const Rect& crect); + bool waitWhilePaused(); + // rewindFlag is a flag wich disable the update of the frame buffer window // while the rewind is performing. bool rewindFlag; - + // Local window state HWND mainHwnd; HWND frameHwnd;