Skip to content

Commit

Permalink
Merge pull request xbmc#6516 from FernetMenta/audiostall
Browse files Browse the repository at this point in the history
dvdplayer: audio sync patches
  • Loading branch information
FernetMenta committed Feb 22, 2015
2 parents 9b55f9b + 8de3b44 commit 1f7566a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion xbmc/cores/dvdplayer/DVDPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1819,6 +1819,7 @@ void CDVDPlayer::HandlePlaySpeed()
{
CLog::Log(LOGDEBUG, "CDVDPlayer::Process - Seeking to catch up");
m_SpeedState.lastseekpts = (int)DVD_TIME_TO_MSEC(m_clock.GetClock());
m_SpeedState.needsync = true;
int iTime = DVD_TIME_TO_MSEC(m_clock.GetClock() + m_State.time_offset + 500000.0 * m_playSpeed / DVD_PLAYSPEED_NORMAL);
m_messenger.Put(new CDVDMsgPlayerSeek(iTime, (GetPlaySpeed() < 0), true, false, false, true, false));
}
Expand Down Expand Up @@ -2474,10 +2475,11 @@ void CDVDPlayer::HandleMessages()
m_OmxPlayerState.av_clock.OMXSetSpeed(speed);
CLog::Log(LOGDEBUG, "%s::%s CDVDMsg::PLAYER_SETSPEED speed : %d (%d)", "CDVDPlayer", __FUNCTION__, speed, m_playSpeed);
}
else if (m_playSpeed < 0 && speed >= 0)
else if ((speed == DVD_PLAYSPEED_NORMAL) && m_SpeedState.needsync)
{
int64_t iTime = (int64_t)DVD_TIME_TO_MSEC(m_clock.GetClock() + m_State.time_offset);
m_messenger.Put(new CDVDMsgPlayerSeek(iTime, true, true, false, false, true));
m_SpeedState.needsync = false;
}

// if playspeed is different then DVD_PLAYSPEED_NORMAL or DVD_PLAYSPEED_PAUSE
Expand Down
1 change: 1 addition & 0 deletions xbmc/cores/dvdplayer/DVDPlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ class CDVDPlayer : public IPlayer, public CThread, public IDVDPlayer
int64_t lasttime;
int lastseekpts;
double lastabstime;
bool needsync;
} m_SpeedState;

int m_errorCount;
Expand Down
5 changes: 3 additions & 2 deletions xbmc/cores/dvdplayer/DVDPlayerAudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -587,8 +587,9 @@ void CDVDPlayerAudio::Process()
// add any packets play
packetadded = OutputPacket(audioframe);

// we are not running until something is cached in output device
if(m_stalled && m_dvdAudio.GetCacheTime() > 0.0)
// we are not running until something is cached in output device and
// we still have a minimum level in the message queue
if(m_stalled && m_dvdAudio.GetCacheTime() > 0.0 && m_messageQueue.GetLevel() > 5)
m_stalled = false;
}

Expand Down

0 comments on commit 1f7566a

Please sign in to comment.