Skip to content
This repository
Browse code

Merge pull request #3038 from popcornmix/improve_ffrew

[rbp/omxplayer] Fixes for trickplay
  • Loading branch information...
commit b31526b35fed418e0a5bfb46084ab289539f3a4d 2 parents 58e2984 + 68ae436
Martijn Kaijser authored August 07, 2013

Showing 1 changed file with 29 additions and 21 deletions. Show diff stats Hide diff stats

  1. 50  xbmc/cores/omxplayer/OMXPlayer.cpp
50  xbmc/cores/omxplayer/OMXPlayer.cpp
@@ -1173,17 +1173,14 @@ void COMXPlayer::Process()
1173 1173
     {
1174 1174
       if (m_CurrentVideo.started)
1175 1175
       {
1176  
-        static double last = 0;
1177  
-        double now = m_clock.GetAbsoluteClock();
1178  
-        //if (m_av_clock.OMXIsPaused())
1179  
-        //  m_av_clock.OMXResume();
1180  
-        if (m_clock.GetAbsoluteClock() - last > 1e6/25)
  1176
+        if (m_av_clock.OMXMediaTime() == 0.0)
1181 1177
         {
1182  
-          // trickplay modes progress by stepping
1183  
-          //m_av_clock.OMXMediaTime(m_clock.GetClock());
  1178
+          /* trickplay modes progress by stepping */
  1179
+          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);
1184 1180
           m_av_clock.OMXStep();
1185  
-          last = now;
1186 1181
         }
  1182
+        else
  1183
+          m_av_clock.OMXMediaTime(0.0);
1187 1184
       }
1188 1185
     }
1189 1186
     else if (not_accepts_data && (audio_fifo_low || video_fifo_low))
@@ -1207,7 +1204,7 @@ void COMXPlayer::Process()
1207 1204
     }
1208 1205
     else if (m_Pause || audio_fifo_low || video_fifo_low)
1209 1206
     {
1210  
-      if (!m_av_clock.OMXIsPaused())
  1207
+      if (!m_av_clock.OMXIsPaused() && !TPA(m_playSpeed))
1211 1208
       {
1212 1209
         if (!m_Pause)
1213 1210
           m_threshold = std::min(2.0f*m_threshold, 16.0f);
@@ -1775,7 +1772,8 @@ void COMXPlayer::HandlePlaySpeed()
1775 1772
     else if (m_CurrentVideo.id >= 0
1776 1773
           &&  m_CurrentVideo.inited == true
1777 1774
           &&  m_SpeedState.lastpts  != m_omxPlayerVideo.GetCurrentPts()
1778  
-          &&  m_SpeedState.lasttime != GetTime())
  1775
+          &&  m_SpeedState.lasttime != GetTime()
  1776
+          &&  m_av_clock.OMXMediaTime() != 0.0)
1779 1777
     {
1780 1778
       m_SpeedState.lastpts  = m_omxPlayerVideo.GetCurrentPts();
1781 1779
       m_SpeedState.lasttime = GetTime();
@@ -1946,7 +1944,8 @@ void COMXPlayer::UpdateTimestamps(COMXCurrentStream& current, DemuxPacket* pPack
1946 1944
   || abs(current.dts - current.dts_state) > DVD_MSEC_TO_TIME(200))
1947 1945
   {
1948 1946
     current.dts_state = current.dts;
1949  
-    if (current.inited)
  1947
+    /* don't use the DISPLAYTIME via player, it is not needed and makes reported time jittery during trickplay */
  1948
+    if (0 && current.inited)
1950 1949
     {
1951 1950
       // make sure we send no outdated state to a/v players
1952 1951
       UpdatePlayState(0);
@@ -1955,6 +1954,13 @@ void COMXPlayer::UpdateTimestamps(COMXCurrentStream& current, DemuxPacket* pPack
1955 1954
     else
1956 1955
     {
1957 1956
       CSingleLock lock(m_StateSection);
  1957
+
  1958
+      if(m_StateInput.time_src == COMXPlayer::ETIMESOURCE_CLOCK)
  1959
+        m_StateInput.time      = TP(m_playSpeed) ? DVD_TIME_TO_MSEC(m_av_clock.GetClock(m_StateInput.timestamp) + m_StateInput.time_offset) : \
  1960
+                                                   DVD_TIME_TO_MSEC(m_av_clock.OMXMediaTime());
  1961
+      else
  1962
+        m_StateInput.timestamp = m_av_clock.GetAbsoluteClock();
  1963
+
1958 1964
       m_State = m_StateInput;
1959 1965
     }
1960 1966
   }
@@ -2076,7 +2082,7 @@ void COMXPlayer::CheckAutoSceneSkip()
2076 2082
     /*
2077 2083
      * Seeking is NOT flushed so any content up to the demux point is retained when playing forwards.
2078 2084
      */
2079  
-    m_messenger.Put(new CDVDMsgPlayerSeek((int)seek, true, false, true, false, true));
  2085
+    m_messenger.Put(new CDVDMsgPlayerSeek((int)seek, true, true, true, false, true));
2080 2086
     /*
2081 2087
      * Seek doesn't always work reliably. Last physical seek time is recorded to prevent looping
2082 2088
      * if there was an error with seeking and it landed somewhere unexpected, perhaps back in the
@@ -2094,7 +2100,7 @@ void COMXPlayer::CheckAutoSceneSkip()
2094 2100
     /*
2095 2101
      * Seeking is NOT flushed so any content up to the demux point is retained when playing forwards.
2096 2102
      */
2097  
-    m_messenger.Put(new CDVDMsgPlayerSeek(cut.end + 1, true, false, true, false, true));
  2103
+    m_messenger.Put(new CDVDMsgPlayerSeek(cut.end + 1, true, true, true, false, true));
2098 2104
     /*
2099 2105
      * Each commercial break is only skipped once so poorly detected commercial breaks can be
2100 2106
      * manually re-entered. Start and end are recorded to prevent looping and to allow seeking back
@@ -2261,9 +2267,9 @@ void COMXPlayer::HandleMessages()
2261 2267
         if(!msg.GetTrickPlay())
2262 2268
         {
2263 2269
           g_infoManager.SetDisplayAfterSeek(100000);
2264  
-          if(msg.GetFlush())
2265  
-            SetCaching(CACHESTATE_FLUSH);
2266 2270
         }
  2271
+        if(msg.GetFlush())
  2272
+          SetCaching(CACHESTATE_FLUSH);
2267 2273
 
2268 2274
         double start = DVD_NOPTS_VALUE;
2269 2275
 
@@ -2290,7 +2296,9 @@ void COMXPlayer::HandleMessages()
2290 2296
 
2291 2297
           FlushBuffers(!msg.GetFlush(), start, msg.GetAccurate());
2292 2298
           // let clock know the new time so progress bar updates immediately
2293  
-          if(m_StateInput.dts != DVD_NOPTS_VALUE)
  2299
+          if(TP(m_playSpeed))
  2300
+            m_av_clock.OMXMediaTime(0.0);
  2301
+          else if(m_StateInput.dts != DVD_NOPTS_VALUE)
2294 2302
             m_av_clock.OMXMediaTime(m_StateInput.dts);
2295 2303
         }
2296 2304
         else
@@ -2458,8 +2466,9 @@ void COMXPlayer::HandleMessages()
2458 2466
 
2459 2467
         // when switching from trickplay to normal, we may not have a full set of reference frames
2460 2468
         // in decoder and we may get corrupt frames out. Seeking to current time will avoid this.
2461  
-        if ( (speed == DVD_PLAYSPEED_PAUSE || speed == DVD_PLAYSPEED_NORMAL) &&
2462  
-             (m_playSpeed != DVD_PLAYSPEED_PAUSE && m_playSpeed != DVD_PLAYSPEED_NORMAL) )
  2469
+        if ( TP(speed) || TP(m_playSpeed) ||
  2470
+           ( (speed == DVD_PLAYSPEED_PAUSE || speed == DVD_PLAYSPEED_NORMAL) &&
  2471
+             (m_playSpeed != DVD_PLAYSPEED_PAUSE && m_playSpeed != DVD_PLAYSPEED_NORMAL) ) )
2463 2472
           m_messenger.Put(new CDVDMsgPlayerSeek(DVD_TIME_TO_MSEC(m_clock.GetClock()), (speed < 0), true, false, false, true));
2464 2473
 
2465 2474
         m_playSpeed = speed;
@@ -3046,8 +3055,6 @@ int64_t COMXPlayer::GetTime()
3046 3055
     if(offset < -limit) offset = -limit;
3047 3056
   }
3048 3057
   //{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)));}
3049  
-  if (TP(m_playSpeed))
3050  
-    return DVD_TIME_TO_MSEC(m_clock.GetClock());
3051 3058
   return llrint(m_State.time + DVD_TIME_TO_MSEC(offset));
3052 3059
 }
3053 3060
 
@@ -3444,7 +3451,8 @@ void COMXPlayer::FlushBuffers(bool queued, double pts, bool accurate)
3444 3451
     m_av_clock.OMXStop();
3445 3452
   m_av_clock.OMXPause();
3446 3453
 
3447  
-  if(accurate)
  3454
+  /* for now, ignore accurate flag as it discards keyframes and causes corrupt frames */
  3455
+  if(0 && accurate)
3448 3456
     startpts = pts;
3449 3457
   else
3450 3458
     startpts = DVD_NOPTS_VALUE;

0 notes on commit b31526b

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