Permalink
Browse files

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.
(cherry picked from commit e291378)
  • Loading branch information...
1 parent 5e8685f commit ccc89dd1ce3e45a1cd8c5bf32fb95e2618f58ae1 Mark Kendall committed Mar 15, 2011
Showing with 12 additions and 0 deletions.
  1. +12 −0 mythtv/libs/libmythtv/mythplayer.cpp
@@ -2742,8 +2742,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();
@@ -2752,11 +2756,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)
{

0 comments on commit ccc89dd

Please sign in to comment.