Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rbp] Set mediatime on GPU after a seek. #2537

Merged
merged 1 commit into from Apr 3, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions xbmc/cores/omxplayer/OMXPlayer.cpp
Expand Up @@ -3296,6 +3296,9 @@ void COMXPlayer::FlushBuffers(bool queued, double pts, bool accurate)
CSingleLock lock(m_StateSection);
m_State = m_StateInput;
}
// let clock know the new time so progress bar updates immediately
if(startpts != DVD_NOPTS_VALUE)
m_av_clock.OMXMediaTime(startpts);
}

// since we call ffmpeg functions to decode, this is being called in the same thread as ::Process() is
Expand Down
46 changes: 46 additions & 0 deletions xbmc/linux/OMXClock.cpp
Expand Up @@ -745,6 +745,52 @@ double OMXClock::OMXMediaTime(bool fixPreroll /* true */ , bool lock /* = true *
return pts;
}

// Set the media time, so calls to get media time use the updated value,
// useful after a seek so mediatime is updated immediately (rather than waiting for first decoded packet)
bool OMXClock::OMXMediaTime(double pts, bool fixPreroll /* = true*/, bool lock /* = true*/)
{
if(m_omx_clock.GetComponent() == NULL)
return false;

if(lock)
Lock();

OMX_ERRORTYPE omx_err = OMX_ErrorNone;
OMX_INDEXTYPE index;
OMX_TIME_CONFIG_TIMESTAMPTYPE timeStamp;
OMX_INIT_STRUCTURE(timeStamp);
timeStamp.nPortIndex = m_omx_clock.GetInputPort();

if(g_guiSettings.GetBool("videoplayer.usedisplayasclock") && m_has_video)
index = OMX_IndexConfigTimeCurrentVideoReference;
else if(m_has_audio)
index = OMX_IndexConfigTimeCurrentAudioReference;
else
index = OMX_IndexConfigTimeCurrentVideoReference;

if(fixPreroll)
pts -= (OMX_PRE_ROLL * 1000);
timeStamp.nTimestamp = ToOMXTime(pts);

omx_err = m_omx_clock.SetConfig(index, &timeStamp);
if(omx_err != OMX_ErrorNone)
{
CLog::Log(LOGERROR, "OMXClock::OMXMediaTime error setting %s", index == OMX_IndexConfigTimeCurrentAudioReference ?
"OMX_IndexConfigTimeCurrentAudioReference":"OMX_IndexConfigTimeCurrentVideoReference");
if(lock)
UnLock();
return false;
}

CLog::Log(LOGDEBUG, "OMXClock::OMXMediaTime set config %s = %.2f", index == OMX_IndexConfigTimeCurrentAudioReference ?
"OMX_IndexConfigTimeCurrentAudioReference":"OMX_IndexConfigTimeCurrentVideoReference", pts);

if(lock)
UnLock();

return true;
}

bool OMXClock::OMXPause(bool lock /* = true */)
{
if(m_omx_clock.GetComponent() == NULL)
Expand Down
1 change: 1 addition & 0 deletions xbmc/linux/OMXClock.h
Expand Up @@ -116,6 +116,7 @@ class OMXClock
bool OMXReset(bool lock = true);
double OMXWallTime(bool lock = true);
double OMXMediaTime(bool fixPreroll = true, bool lock = true);
bool OMXMediaTime(double pts, bool fixPreroll = true, bool lock = true);
bool OMXPause(bool lock = true);
bool OMXResume(bool lock = true);
bool OMXUpdateClock(double pts, bool lock = true);
Expand Down