Author Topic: Fix for skip times  (Read 3615 times)

Offline davep

  • Full Member
  • ***
  • Posts: 169
    • View Profile
Fix for skip times
« on: September 18, 2012, 07:39:22 »
It seems that the GPU on the Raspberry Pi buffers about six seconds of playback. The calculations for skipping backwards and forwards are based on the frames being fed into the GPU, while the TV is showing video from six seconds earlier. Hence a 10 second forwards skip actually jumps about 16 seconds, while a 10 second backward skip goes back only 4.

This quick-and-dirty patch adjusts the skip timings to allow for GPU buffering.

Code: [Select]
diff --git a/player.cc b/player.cc
index 1650ed4..494d199 100644
--- a/player.cc
+++ b/player.cc
@@ -33,6 +33,7 @@
 #include "osdreceiver.h"

 #define USER_RESPONSE_TIME 500 // Milliseconds
+#define OMX_BUFFER_SECONDS 6.0 // Float seconds

 // ----------------------------------- Called from outside, one offs or info funcs

@@ -418,6 +419,9 @@ void Player::skipForward(int seconds)
   ULONG newFrame = getCurrentFrameNum();
   if (newFrame == 0) { unLock(); return; } // Current pos from demuxer is not valid
   newFrame +=(ULONG) (((double)seconds) * fps);
+#ifdef VOMP_PLATTFORM_RASPBERRY
+  newFrame -=(ULONG) (((double)OMX_BUFFER_SECONDS) * fps);
+#endif
   if (newFrame > lengthFrames) { switchState(S_PLAY); unLock(); }
   else switchState(S_JUMP, newFrame);
 //  unLock(); - let thread unlock this
@@ -430,6 +434,9 @@ void Player::skipBackward(int seconds)
   long newFrame = getCurrentFrameNum();
   if (newFrame == 0) { unLock(); return; } // Current pos from demuxer is not valid
   newFrame -= (ULONG) (((double)seconds) * fps);
+#ifdef VOMP_PLATTFORM_RASPBERRY
+  newFrame -=(ULONG) (((double)OMX_BUFFER_SECONDS) * fps);
+#endif
   if (newFrame < 0) newFrame = 0;
   switchState(S_JUMP, newFrame);
 //  unLock(); - let thread unlock this

Offline MartenR

  • Hero Member
  • *****
  • Posts: 789
    • View Profile
Re: Fix for skip times
« Reply #1 on: September 18, 2012, 13:49:09 »
No, the GPU does not buffer 6 seconds of playback.
It buffer just 3 frames, otherwise you would not have lipsync.

I put it on my list for bugfixes, since my code is buffering the frames.
It is just a quick fix, I already know, what I forgot.

Marten
« Last Edit: September 18, 2012, 17:54:42 by MartenR »

Offline MartenR

  • Hero Member
  • *****
  • Posts: 789
    • View Profile
Re: Fix for skip times
« Reply #2 on: September 19, 2012, 07:01:13 »
Please try current git. Should be fixed.

Offline davep

  • Full Member
  • ***
  • Posts: 169
    • View Profile
Re: Fix for skip times
« Reply #3 on: September 19, 2012, 13:41:52 »
Please try current git. Should be fixed.
Yes that works OK for me. Many thanks.