Permalink
Browse files

VideoPlayer: fix a/v sync - if audio and video needs sync, this has prio

  • Loading branch information...
FernetMenta authored and popcornmix committed Jan 18, 2016
1 parent ade4ef2 commit 453d132ac2f419b35edc01a63281bd29889e05f1
Showing with 18 additions and 14 deletions.
  1. +18 −14 xbmc/cores/VideoPlayer/VideoPlayer.cpp
@@ -1975,7 +1975,7 @@ void CVideoPlayer::HandlePlaySpeed()
}
// sync streams to clock
if ((m_CurrentVideo.syncState == IDVDStreamPlayer::SYNC_WAITSYNC) ||
if ((m_CurrentVideo.syncState == IDVDStreamPlayer::SYNC_WAITSYNC) &&
(m_CurrentAudio.syncState == IDVDStreamPlayer::SYNC_WAITSYNC))
{
unsigned int threshold = 20;
@@ -1987,19 +1987,7 @@ void CVideoPlayer::HandlePlaySpeed()
bool audio = m_CurrentAudio.id < 0 || (m_CurrentAudio.syncState == IDVDStreamPlayer::SYNC_WAITSYNC) ||
(m_CurrentAudio.packets == 0 && m_CurrentVideo.packets > threshold);
if (m_CurrentAudio.syncState == IDVDStreamPlayer::SYNC_WAITSYNC &&
m_CurrentAudio.avsync == CCurrentStream::AV_SYNC_CONT)
{
m_CurrentAudio.syncState = IDVDStreamPlayer::SYNC_INSYNC;
m_VideoPlayerAudio->SendMessage(new CDVDMsgDouble(CDVDMsg::GENERAL_RESYNC, m_clock.GetClock()), 1);
}
else if (m_CurrentVideo.syncState == IDVDStreamPlayer::SYNC_WAITSYNC &&
m_CurrentVideo.avsync == CCurrentStream::AV_SYNC_CONT)
{
m_CurrentVideo.syncState = IDVDStreamPlayer::SYNC_INSYNC;
m_VideoPlayerVideo->SendMessage(new CDVDMsgDouble(CDVDMsg::GENERAL_RESYNC, m_clock.GetClock()), 1);
}
else if (video && audio)
if (video && audio)
{
double clock = 0;
if (m_CurrentAudio.syncState == IDVDStreamPlayer::SYNC_WAITSYNC)
@@ -2041,6 +2029,22 @@ void CVideoPlayer::HandlePlaySpeed()
m_syncTimer.Set(3000);
}
}
else if ((m_CurrentVideo.syncState == IDVDStreamPlayer::SYNC_WAITSYNC) ||
(m_CurrentAudio.syncState == IDVDStreamPlayer::SYNC_WAITSYNC))
{
if (m_CurrentAudio.syncState == IDVDStreamPlayer::SYNC_WAITSYNC &&
m_CurrentAudio.avsync == CCurrentStream::AV_SYNC_CONT)
{
m_CurrentAudio.syncState = IDVDStreamPlayer::SYNC_INSYNC;
m_VideoPlayerAudio->SendMessage(new CDVDMsgDouble(CDVDMsg::GENERAL_RESYNC, m_clock.GetClock()), 1);
}
else if (m_CurrentVideo.syncState == IDVDStreamPlayer::SYNC_WAITSYNC &&
m_CurrentVideo.avsync == CCurrentStream::AV_SYNC_CONT)
{
m_CurrentVideo.syncState = IDVDStreamPlayer::SYNC_INSYNC;
m_VideoPlayerVideo->SendMessage(new CDVDMsgDouble(CDVDMsg::GENERAL_RESYNC, m_clock.GetClock()), 1);
}
}
// handle ff/rw
if(m_playSpeed != DVD_PLAYSPEED_NORMAL && m_playSpeed != DVD_PLAYSPEED_PAUSE)

0 comments on commit 453d132

Please sign in to comment.