summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Kendall <mkendall@mythtv.org>2011-03-15 06:44:11 (GMT)
committer Mark Kendall <mkendall@mythtv.org>2011-03-15 06:44:11 (GMT)
commite291378e42f4d2b309120f9f68b8ad2800347061 (patch)
tree53fba558df7331371f45be39e9351e3fc4d8ee0f
parent5ea8d18065886e262f0b2507ea7e99a0eb49bcc7 (diff)
MythPlayer: Only lock the eof check when run from the decoder thread.
Again, the decoder_change_lock only needs to be used from the decoder thread. Prepares the way for some locking improvements. I've added a fixme as a reminder to move the eof variable ownership back into the player which removes the need for the lock.
-rw-r--r--mythtv/libs/libmythtv/mythplayer.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/mythtv/libs/libmythtv/mythplayer.cpp b/mythtv/libs/libmythtv/mythplayer.cpp
index ef2224b..5797252 100644
--- a/mythtv/libs/libmythtv/mythplayer.cpp
+++ b/mythtv/libs/libmythtv/mythplayer.cpp
@@ -2779,8 +2779,12 @@ void MythPlayer::DecoderPauseCheck(void)
UnpauseDecoder();
}
+//// FIXME - move the eof ownership back into MythPlayer
bool MythPlayer::GetEof(void)
{
+ if (QThread::currentThread() == (QThread*)playerThread)
+ return decoder ? decoder->GetEof() : true;
+
decoder_change_lock.lock();
bool eof = decoder ? decoder->GetEof() : true;
decoder_change_lock.unlock();
@@ -2789,11 +2793,19 @@ bool MythPlayer::GetEof(void)
void MythPlayer::SetEof(bool eof)
{
+ if (QThread::currentThread() == (QThread*)playerThread)
+ {
+ if (decoder)
+ decoder->SetEof(eof);
+ return;
+ }
+
decoder_change_lock.lock();
if (decoder)
decoder->SetEof(eof);
decoder_change_lock.unlock();
}
+//// FIXME end
void MythPlayer::DecoderLoop(bool pause)
{