summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Kendall <mkendall@mythtv.org>2010-12-09 15:07:00 (GMT)
committer Mark Kendall <mkendall@mythtv.org>2010-12-09 15:07:00 (GMT)
commit3ff02fd3368c6fee67d04e059fb46b2c30dce9f6 (patch)
tree3c2d049b6e80117d14b15f8e786ab95b0cc2f8d8
parent312ef27cd0d5a8b515cf0ba2587bdc2ba94aac28 (diff)
Remove the state change QWaitCondition from the TV class.
Now that the additional TV thread has been removed, this is no longer necessary and has a large negative impact on playback under certain conditions. In cases where the frame rate closely matches the display's refresh rate, the delay caused by the QWaitCondition is large enough to cause significant 'jitter' and may be responsible for a number of reported problems in the 0.24 release. The while loop in TV::StartTV is now effectively the main loop during media playback and needs to be as simple as possible. If there are no other problems, I will backport in a few days.
-rw-r--r--mythtv/libs/libmythtv/tv_play.cpp29
-rw-r--r--mythtv/libs/libmythtv/tv_play.h5
2 files changed, 6 insertions, 28 deletions
diff --git a/mythtv/libs/libmythtv/tv_play.cpp b/mythtv/libs/libmythtv/tv_play.cpp
index f33ce94..f4e957b 100644
--- a/mythtv/libs/libmythtv/tv_play.cpp
+++ b/mythtv/libs/libmythtv/tv_play.cpp
@@ -363,26 +363,18 @@ bool TV::StartTV(ProgramInfo *tvrec, uint flags)
// Process Events
VERBOSE(VB_PLAYBACK, LOC + "StartTV -- process events begin");
- MythTimer st; st.start();
- bool is_started = false;
+
while (true)
{
qApp->processEvents();
- QMutexLocker locker(&tv->stateChangeCondLock);
- TVState state = tv->GetState(0);
- bool is_err = kState_Error == state;
- bool is_none = kState_None == state;
- is_started = is_started ||
- (st.elapsed() > (int) TV::kEndOfPlaybackFirstCheckTimer) ||
- (!is_none && !is_err && kState_ChangingState != state);
- if (is_err || (is_none && is_started))
+ TVState state = tv->GetState(0);
+ bool is_err = kState_Error == state;
+ bool is_none = kState_None == state;
+ if (is_err || is_none)
break;
-
- // timeout needs to be low enough to process keyboard input
- unsigned long timeout = 20; // milliseconds
- tv->stateChangeCond.wait(&tv->stateChangeCondLock, timeout);
}
+
VERBOSE(VB_PLAYBACK, LOC + "StartTV -- process events end");
if (tv->getJumpToProgram())
@@ -1932,9 +1924,6 @@ void TV::HandleStateChange(PlayerContext *mctx, PlayerContext *ctx)
VERBOSE(VB_IMPORTANT, LOC + "HandleStateChange() Warning, "
"called with no state to change to.");
ctx->UnlockState();
-
- QMutexLocker locker(&stateChangeCondLock);
- stateChangeCond.wakeAll();
return;
}
@@ -1951,9 +1940,6 @@ void TV::HandleStateChange(PlayerContext *mctx, PlayerContext *ctx)
"Attempting to set to an error state!");
SetErrored(ctx);
ctx->UnlockState();
-
- QMutexLocker locker(&stateChangeCondLock);
- stateChangeCond.wakeAll();
return;
}
@@ -2299,9 +2285,6 @@ void TV::HandleStateChange(PlayerContext *mctx, PlayerContext *ctx)
VERBOSE(VB_PLAYBACK, LOC +
QString("HandleStateChange(%1) -- end")
.arg(find_player_index(ctx)));
-
- QMutexLocker locker(&stateChangeCondLock);
- stateChangeCond.wakeAll();
}
#undef TRANSITION
#undef SET_NEXT
diff --git a/mythtv/libs/libmythtv/tv_play.h b/mythtv/libs/libmythtv/tv_play.h
index c048fc7..7c3daed 100644
--- a/mythtv/libs/libmythtv/tv_play.h
+++ b/mythtv/libs/libmythtv/tv_play.h
@@ -78,7 +78,6 @@ typedef void (*EMBEDRETURNVOIDSCHEDIT) (const ProgramInfo *, void *);
// -> recorderPlaybackInfoLock
// -> timerIdLock
// -> mainLoopCondLock
-// -> stateChangeCondLock
// -> channelGroupLock
//
// When holding one of these locks, you may lock any lock of the locks to
@@ -856,10 +855,6 @@ class MPUBLIC TV : public QObject
TimerContextMap signalMonitorTimerId;
TimerContextMap tvchainUpdateTimerId;
- /// Condition to signal State changes
- QWaitCondition stateChangeCond;
- QMutex stateChangeCondLock;
-
public:
// Constants
static const int kInitFFRWSpeed; ///< 1x, default to normal speed