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-12 14:04:08 (GMT)
commitcfd7b7877b5dc8b25dd27a49c0c22ae07c1764ce (patch)
treecd284639c20b1adc4c1e792789183d18e1f692e1
parent3e29dab42c128642f133a529c6a11ff9efeea169 (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 484d704..5f57074 100644
--- a/mythtv/libs/libmythtv/tv_play.cpp
+++ b/mythtv/libs/libmythtv/tv_play.cpp
@@ -362,26 +362,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())
@@ -1928,9 +1920,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;
}
@@ -1947,9 +1936,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;
}
@@ -2292,9 +2278,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 c5c3b2d..1a370b8 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
@@ -858,10 +857,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