Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #2189 from FernetMenta/pvrseek

dvdplayer: set dts after successful seek, correct time offsets
  • Loading branch information...
commit 5ee6a7ab27e7bfdaae29b9da3f2d32fa1d2c6895 2 parents 7b9ab8a + f05ffc6
@FernetMenta FernetMenta authored
View
19 xbmc/cores/dvdplayer/DVDPlayer.cpp
@@ -2041,6 +2041,9 @@ void CDVDPlayer::HandleMessages()
if(!m_pSubtitleDemuxer->SeekTime(time, msg.GetBackward()))
CLog::Log(LOGDEBUG, "failed to seek subtitle demuxer: %d, success", time);
}
+ // dts after successful seek
+ m_StateInput.dts = start;
+
FlushBuffers(!msg.GetFlush(), start, msg.GetAccurate());
}
else
@@ -3228,6 +3231,11 @@ void CDVDPlayer::FlushBuffers(bool queued, double pts, bool accurate)
if(pts != DVD_NOPTS_VALUE)
m_clock.Discontinuity(pts);
UpdatePlayState(0);
+
+ // update state, buffers are flushed and it may take some time until
+ // we get an update from players
+ CSingleLock lock(m_StateSection);
+ m_State = m_StateInput;
}
}
@@ -3851,8 +3859,10 @@ int CDVDPlayer::AddSubtitleFile(const std::string& filename, const std::string&
void CDVDPlayer::UpdatePlayState(double timeout)
{
- if(m_StateInput.timestamp != 0
- && m_StateInput.timestamp + DVD_MSEC_TO_TIME(timeout) > CDVDClock::GetAbsoluteClock())
+ if((m_StateInput.timestamp != 0)
+ && (m_StateInput.timestamp + DVD_MSEC_TO_TIME(timeout) > CDVDClock::GetAbsoluteClock())
+ && (m_StateInput.dts != DVD_NOPTS_VALUE)
+ && (abs(m_StateInput.dts - m_StateInput.dts_state) < DVD_MSEC_TO_TIME(timeout)))
return;
SPlayerState state(m_StateInput);
@@ -3861,8 +3871,6 @@ void CDVDPlayer::UpdatePlayState(double timeout)
state.dts = m_CurrentVideo.dts;
else if(m_CurrentAudio.dts != DVD_NOPTS_VALUE)
state.dts = m_CurrentAudio.dts;
- else
- state.dts = DVD_NOPTS_VALUE;
if(m_pDemuxer)
{
@@ -3934,7 +3942,7 @@ void CDVDPlayer::UpdatePlayState(double timeout)
if (state.time_src == ETIMESOURCE_CLOCK)
state.time_offset = m_offset_pts;
- else
+ else if (state.dts != DVD_NOPTS_VALUE)
state.time_offset = DVD_MSEC_TO_TIME(state.time) - state.dts;
if (m_CurrentAudio.id >= 0 && m_pDemuxer)
@@ -3980,6 +3988,7 @@ void CDVDPlayer::UpdatePlayState(double timeout)
state.cache_bytes = 0;
state.timestamp = CDVDClock::GetAbsoluteClock();
+ state.dts_state = state.dts;
CSingleLock lock(m_StateSection);
m_StateInput = state;
View
2  xbmc/cores/dvdplayer/DVDPlayer.h
@@ -424,6 +424,7 @@ class CDVDPlayer : public IPlayer, public CThread, public IDVDPlayer
time_offset = 0;
time_src = ETIMESOURCE_CLOCK;
dts = DVD_NOPTS_VALUE;
+ dts_state = DVD_NOPTS_VALUE;
player_state = "";
chapter = 0;
chapter_name = "";
@@ -449,6 +450,7 @@ class CDVDPlayer : public IPlayer, public CThread, public IDVDPlayer
double time_total; // total playback time
ETimeSource time_src; // current time source
double dts; // last known dts
+ double dts_state; // dts of last update
std::string player_state; // full player state

0 comments on commit 5ee6a7a

Please sign in to comment.
Something went wrong with that request. Please try again.