Skip to content

Commit

Permalink
MythPlayer:: Remove some unnecessary decoder locking.
Browse files Browse the repository at this point in the history
The decoder_change_lock is used by the decoder thread to prevent the
main thread from deleting/recreating the decoder object while it is in
use. It does not need to be used from the main thread.
  • Loading branch information
Mark Kendall committed Mar 15, 2011
1 parent 9ce70ae commit 5ea8d18
Showing 1 changed file with 8 additions and 18 deletions.
26 changes: 8 additions & 18 deletions mythtv/libs/libmythtv/mythplayer.cpp
Expand Up @@ -303,8 +303,6 @@ MythPlayer::~MythPlayer(void)

void MythPlayer::SetWatchingRecording(bool mode)
{
QMutexLocker locker(&decoder_change_lock);

watchingrecording = mode;
if (decoder)
decoder->setWatchingRecording(mode);
Expand Down Expand Up @@ -352,7 +350,6 @@ bool MythPlayer::Pause(void)
PauseBuffer();
allpaused = decoderPaused && videoPaused && bufferPaused;
{
QMutexLocker locker(&decoder_change_lock);
if (using_null_videoout && decoder)
decoder->UpdateFramesPlayed();
else if (videoOutput && !using_null_videoout)
Expand Down Expand Up @@ -1285,7 +1282,6 @@ void MythPlayer::ResetCaptions(void)
}
}

// caller has decoder_changed_lock
void MythPlayer::DisableCaptions(uint mode, bool osd_msg)
{
textDisplayMode &= ~mode;
Expand Down Expand Up @@ -1326,7 +1322,6 @@ void MythPlayer::DisableCaptions(uint mode, bool osd_msg)
}
}

// caller has decoder_changed_lock
void MythPlayer::EnableCaptions(uint mode, bool osd_msg)
{
QMutexLocker locker(&osdLock);
Expand Down Expand Up @@ -1422,7 +1417,6 @@ void MythPlayer::SetCaptionsEnabled(bool enable, bool osd_msg)

QStringList MythPlayer::GetTracks(uint type)
{
QMutexLocker locker(&decoder_change_lock);
if (decoder)
return decoder->GetTracks(type);
return QStringList();
Expand All @@ -1431,7 +1425,6 @@ QStringList MythPlayer::GetTracks(uint type)
int MythPlayer::SetTrack(uint type, int trackNo)
{
int ret = -1;
QMutexLocker locker(&decoder_change_lock);
if (!decoder)
return ret;

Expand Down Expand Up @@ -1487,31 +1480,28 @@ void MythPlayer::EnableSubtitles(bool enable)

int MythPlayer::GetTrack(uint type)
{
QMutexLocker locker(&decoder_change_lock);
if (decoder)
return decoder->GetTrack(type);
return -1;
}

int MythPlayer::ChangeTrack(uint type, int dir)
{
QMutexLocker locker(&decoder_change_lock);
if (decoder)
if (!decoder)
return -1;

int retval = decoder->ChangeTrack(type, dir);
if (retval >= 0)
{
int retval = decoder->ChangeTrack(type, dir);
if (retval >= 0)
{
SetOSDMessage(decoder->GetTrackDesc(type, GetTrack(type)),
kOSDTimeout_Med);
return retval;
}
SetOSDMessage(decoder->GetTrackDesc(type, GetTrack(type)),
kOSDTimeout_Med);
return retval;
}
return -1;
}

void MythPlayer::ChangeCaptionTrack(int dir)
{
QMutexLocker locker(&decoder_change_lock);
if (!decoder || (dir < 0))
return;

Expand Down

0 comments on commit 5ea8d18

Please sign in to comment.