[mythtv] [PATCH] fwd/rwd playback locking fix
Tomi Orava
tomimo+mythtv-dev at ncircle.nullnet.fi
Mon Dec 18 06:45:43 UTC 2006
Hi,
Here is a diff against SVN-trunk (12283) which fixes (at least in my case)
the occasional playback hangs when fast-forwarding or reversing via remote
controller. It looks like the locking is currently not properly
implemented in all methods where the videoThreadPaused conditional or
pausevideo variable are being used.
Regards,
Tomi Orava
------------------------------------------------------------------------------------------
Index: libs/libmythtv/NuppelVideoPlayer.h
===================================================================
--- libs/libmythtv/NuppelVideoPlayer.h (revision 12283)
+++ libs/libmythtv/NuppelVideoPlayer.h (working copy)
@@ -521,6 +521,8 @@
QWaitCondition decoderThreadPaused;
QWaitCondition videoThreadPaused;
QMutex vidExitLock;
+ QMutex pauseLock;
+ bool pause_signal;
bool eof; ///< At end of file/ringbuffer
bool m_double_framerate;///< Output fps is double Video (input) rate
bool m_can_double; ///< VideoOutput capable of doubling frame
rate
Index: libs/libmythtv/NuppelVideoPlayer.cpp
===================================================================
--- libs/libmythtv/NuppelVideoPlayer.cpp (revision 12283)
+++ libs/libmythtv/NuppelVideoPlayer.cpp (working copy)
@@ -150,6 +150,7 @@
eof(false), m_double_framerate(false),
m_can_double(false), paused(false),
pausevideo(false), actuallypaused(false),
+ pause_signal(false),
video_actually_paused(false), playing(false),
decoder_thread_alive(true), killplayer(false),
killvideo(false), livetv(false),
@@ -451,23 +452,34 @@
void NuppelVideoPlayer::PauseVideo(bool wait)
{
+ pauseLock.lock();
video_actually_paused = false;
pausevideo = true;
if (wait && !video_actually_paused)
{
- while (!videoThreadPaused.wait(1000))
+ while (!pause_signal && !videoThreadPaused.wait(&pauseLock, 1000))
{
if (eof)
+ {
+ pause_signal=false;
+ pauseLock.unlock();
return;
+ }
VERBOSE(VB_IMPORTANT, "Waited too long for video out to pause");
}
}
+ pause_signal=false;
+ pauseLock.unlock();
}
void NuppelVideoPlayer::UnpauseVideo(void)
{
+ pauseLock.lock();
pausevideo = false;
+ pause_signal=true;
+ pauseLock.unlock();
+ videoThreadPaused.wakeAll();
}
void NuppelVideoPlayer::SetPrebuffering(bool prebuffer)
--
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mythplayback.diff
Type: text/x-patch
Size: 2112 bytes
Desc: not available
Url : http://mythtv.org/pipermail/mythtv-dev/attachments/20061218/14b47772/attachment.bin
More information about the mythtv-dev
mailing list