Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #3038 from popcornmix/improve_ffrew

[rbp/omxplayer] Fixes for trickplay
  • Loading branch information...
commit b31526b35fed418e0a5bfb46084ab289539f3a4d 2 parents 58e2984 + 68ae436
Martijn Kaijser MartijnKaijser authored
Showing with 29 additions and 21 deletions.
  1. +29 −21 xbmc/cores/omxplayer/OMXPlayer.cpp
50 xbmc/cores/omxplayer/OMXPlayer.cpp
View
@@ -1173,17 +1173,14 @@ void COMXPlayer::Process()
{
if (m_CurrentVideo.started)
{
- static double last = 0;
- double now = m_clock.GetAbsoluteClock();
- //if (m_av_clock.OMXIsPaused())
- // m_av_clock.OMXResume();
- if (m_clock.GetAbsoluteClock() - last > 1e6/25)
+ if (m_av_clock.OMXMediaTime() == 0.0)
{
- // trickplay modes progress by stepping
- //m_av_clock.OMXMediaTime(m_clock.GetClock());
+ /* trickplay modes progress by stepping */
+ CLog::Log(LOGDEBUG, "COMXPlayer::Process - Seeking step speed:%.2f last:%.2f v:%.2f", (double)m_playSpeed / DVD_PLAYSPEED_NORMAL, m_SpeedState.lastpts*1e-6, video_pts*1e-6);
m_av_clock.OMXStep();
- last = now;
}
+ else
+ m_av_clock.OMXMediaTime(0.0);
}
}
else if (not_accepts_data && (audio_fifo_low || video_fifo_low))
@@ -1207,7 +1204,7 @@ void COMXPlayer::Process()
}
else if (m_Pause || audio_fifo_low || video_fifo_low)
{
- if (!m_av_clock.OMXIsPaused())
+ if (!m_av_clock.OMXIsPaused() && !TPA(m_playSpeed))
{
if (!m_Pause)
m_threshold = std::min(2.0f*m_threshold, 16.0f);
@@ -1775,7 +1772,8 @@ void COMXPlayer::HandlePlaySpeed()
else if (m_CurrentVideo.id >= 0
&& m_CurrentVideo.inited == true
&& m_SpeedState.lastpts != m_omxPlayerVideo.GetCurrentPts()
- && m_SpeedState.lasttime != GetTime())
+ && m_SpeedState.lasttime != GetTime()
+ && m_av_clock.OMXMediaTime() != 0.0)
{
m_SpeedState.lastpts = m_omxPlayerVideo.GetCurrentPts();
m_SpeedState.lasttime = GetTime();
@@ -1946,7 +1944,8 @@ void COMXPlayer::UpdateTimestamps(COMXCurrentStream& current, DemuxPacket* pPack
|| abs(current.dts - current.dts_state) > DVD_MSEC_TO_TIME(200))
{
current.dts_state = current.dts;
- if (current.inited)
+ /* don't use the DISPLAYTIME via player, it is not needed and makes reported time jittery during trickplay */
+ if (0 && current.inited)
{
// make sure we send no outdated state to a/v players
UpdatePlayState(0);
@@ -1955,6 +1954,13 @@ void COMXPlayer::UpdateTimestamps(COMXCurrentStream& current, DemuxPacket* pPack
else
{
CSingleLock lock(m_StateSection);
+
+ if(m_StateInput.time_src == COMXPlayer::ETIMESOURCE_CLOCK)
+ m_StateInput.time = TP(m_playSpeed) ? DVD_TIME_TO_MSEC(m_av_clock.GetClock(m_StateInput.timestamp) + m_StateInput.time_offset) : \
+ DVD_TIME_TO_MSEC(m_av_clock.OMXMediaTime());
+ else
+ m_StateInput.timestamp = m_av_clock.GetAbsoluteClock();
+
m_State = m_StateInput;
}
}
@@ -2076,7 +2082,7 @@ void COMXPlayer::CheckAutoSceneSkip()
/*
* Seeking is NOT flushed so any content up to the demux point is retained when playing forwards.
*/
- m_messenger.Put(new CDVDMsgPlayerSeek((int)seek, true, false, true, false, true));
+ m_messenger.Put(new CDVDMsgPlayerSeek((int)seek, true, true, true, false, true));
/*
* Seek doesn't always work reliably. Last physical seek time is recorded to prevent looping
* if there was an error with seeking and it landed somewhere unexpected, perhaps back in the
@@ -2094,7 +2100,7 @@ void COMXPlayer::CheckAutoSceneSkip()
/*
* Seeking is NOT flushed so any content up to the demux point is retained when playing forwards.
*/
- m_messenger.Put(new CDVDMsgPlayerSeek(cut.end + 1, true, false, true, false, true));
+ m_messenger.Put(new CDVDMsgPlayerSeek(cut.end + 1, true, true, true, false, true));
/*
* Each commercial break is only skipped once so poorly detected commercial breaks can be
* manually re-entered. Start and end are recorded to prevent looping and to allow seeking back
@@ -2261,9 +2267,9 @@ void COMXPlayer::HandleMessages()
if(!msg.GetTrickPlay())
{
g_infoManager.SetDisplayAfterSeek(100000);
- if(msg.GetFlush())
- SetCaching(CACHESTATE_FLUSH);
}
+ if(msg.GetFlush())
+ SetCaching(CACHESTATE_FLUSH);
double start = DVD_NOPTS_VALUE;
@@ -2290,7 +2296,9 @@ void COMXPlayer::HandleMessages()
FlushBuffers(!msg.GetFlush(), start, msg.GetAccurate());
// let clock know the new time so progress bar updates immediately
- if(m_StateInput.dts != DVD_NOPTS_VALUE)
+ if(TP(m_playSpeed))
+ m_av_clock.OMXMediaTime(0.0);
+ else if(m_StateInput.dts != DVD_NOPTS_VALUE)
m_av_clock.OMXMediaTime(m_StateInput.dts);
}
else
@@ -2458,8 +2466,9 @@ void COMXPlayer::HandleMessages()
// when switching from trickplay to normal, we may not have a full set of reference frames
// in decoder and we may get corrupt frames out. Seeking to current time will avoid this.
- if ( (speed == DVD_PLAYSPEED_PAUSE || speed == DVD_PLAYSPEED_NORMAL) &&
- (m_playSpeed != DVD_PLAYSPEED_PAUSE && m_playSpeed != DVD_PLAYSPEED_NORMAL) )
+ if ( TP(speed) || TP(m_playSpeed) ||
+ ( (speed == DVD_PLAYSPEED_PAUSE || speed == DVD_PLAYSPEED_NORMAL) &&
+ (m_playSpeed != DVD_PLAYSPEED_PAUSE && m_playSpeed != DVD_PLAYSPEED_NORMAL) ) )
m_messenger.Put(new CDVDMsgPlayerSeek(DVD_TIME_TO_MSEC(m_clock.GetClock()), (speed < 0), true, false, false, true));
m_playSpeed = speed;
@@ -3046,8 +3055,6 @@ int64_t COMXPlayer::GetTime()
if(offset < -limit) offset = -limit;
}
//{CLog::Log(LOGINFO, "%s: time:%.2f stamp:%.2f dts:%d m:%d (p:%d,c:%d) =%llu", __func__, (double)m_State.time, (double)m_State.timestamp, (int)DVD_TIME_TO_MSEC(m_State.dts + m_offset_pts), (int)DVD_TIME_TO_MSEC(m_av_clock.OMXMediaTime()), (int)m_playSpeed, (int)m_caching, llrint(m_State.time + DVD_TIME_TO_MSEC(offset)));}
- if (TP(m_playSpeed))
- return DVD_TIME_TO_MSEC(m_clock.GetClock());
return llrint(m_State.time + DVD_TIME_TO_MSEC(offset));
}
@@ -3444,7 +3451,8 @@ void COMXPlayer::FlushBuffers(bool queued, double pts, bool accurate)
m_av_clock.OMXStop();
m_av_clock.OMXPause();
- if(accurate)
+ /* for now, ignore accurate flag as it discards keyframes and causes corrupt frames */
+ if(0 && accurate)
startpts = pts;
else
startpts = DVD_NOPTS_VALUE;
Please sign in to comment.
Something went wrong with that request. Please try again.