Skip to content

Commit

Permalink
MythPlayer: Only lock the eof check when run from the decoder thread.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Mark Kendall committed Mar 15, 2011
1 parent 5ea8d18 commit e291378
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions mythtv/libs/libmythtv/mythplayer.cpp
Expand Up @@ -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();
Expand All @@ -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)
{
Expand Down

0 comments on commit e291378

Please sign in to comment.