Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: Fix: Timeshifting pb with vdr 1.1.32 / vdr-1.1.33



Juri Haberland wrote:
> 
> Klaus Schmidinger wrote:
> > Stephan Schreiber wrote:
> 
> >> When the mentioned error "hits", the conditions of the where loop in
> >> cDvbPlayer::Action are not met, thus the playback stops:
> >> NextFile() is false, readIndex < 0 and ringBuffer->Available() is false,
> >> too.
> >>
> >> With "normally" recorded files, this is never the case, so I tried
> >> increasing the value of the sleep() call in menu.c @ 3131 (a few lines above
> >> your suggested patch) from 2 to 4, and voila!
> >> It works. Always (10 times in a row). I tried 3, but that is still not
> >> enough on my system. 4 seems to be a safe guess.
> >>
> >> @Juri: can you confirm this?
> 
> Confirmed.
> 
> >> Should I still investigate the recordings.c from 1.1.31?
> >
> > Yes, please do so, because adding delays will only make the whole
> > thing more sluggish. Please revert the delay changes (also the sleep(3)
> > I suggested after the pause, in case you have that in) and just use
> > recording.c from 1.1.31. In 1.1.32 I modified this in order to no longer
> > have a short picture freeze at the end of a replay, but apparantly that
> > broke instant pause mode. If you can verify that the 1.1.31 version of that
> > file works together with the rest of the 1.1.33 source, I'll probably know
> > how to fix this.
> 
> Yes, this works also, though if one immidiatly presses play, the video
> seems to be a bit jerky. This might be because there's not enough
> buffered video yet, and just pressing pause, wait a second or two and
> play again lets the video play alright. So your initial idea with a two
> seonds pause in menu.c might be also needed.

Please try the attached patch against recording.c.
Take a fresh installation of the original VDR 1.1.33 to do this,
so that the sleep(3) patch in menu.c is _not_ used.

At least here on my system this seems to fix the problem with pressing
"Play" immediately after pausing live video. There my be a short halt
when starting replay, that's caused by the index file having to catch up
far enough to ensure correct replay.

Please let me know whether this works for you.

Klaus
-- 
_______________________________________________________________

Klaus Schmidinger                       Phone: +49-8635-6989-10
CadSoft Computer GmbH                   Fax:   +49-8635-6989-40
Hofmark 2                               Email:   kls@cadsoft.de
D-84568 Pleiskirchen, Germany           URL:     www.cadsoft.de
_______________________________________________________________
--- recording.c	2003/05/24 11:22:34	1.79
+++ recording.c	2003/05/30 09:54:36
@@ -769,6 +769,12 @@
 
 #define INDEXFILESUFFIX     "/index.vdr"
 
+// The number of frames to stay off the end in case of time shift:
+#define INDEXSAFETYLIMIT 100 // frames
+
+// The maximum time to wait before giving up while catching up on an index file:
+#define MAXINDEXCATCHUP   4 // seconds
+
 // The minimum age of an index file for considering it no longer to be written:
 #define MININDEXAGE    3600 // seconds
 
@@ -852,14 +858,14 @@
 {
   // returns true unless something really goes wrong, so that 'index' becomes NULL
   if (index && f >= 0) {
-     if (Index < 0 || Index >= last) {
+     for (int i = 0; i <= MAXINDEXCATCHUP && (Index < 0 || Index >= last); i++) {
         struct stat buf;
         if (fstat(f, &buf) == 0) {
            if (time(NULL) - buf.st_mtime > MININDEXAGE) {
               // apparently the index file is not being written any more
               close(f);
               f = -1;
-              return true;
+               break;
               }
            int newLast = buf.st_size / sizeof(tIndex) - 1;
            if (newLast > last) {
@@ -879,7 +885,7 @@
                        index = NULL;
                        close(f);
                        f = -1;
-                       return true;
+                        break;
                        }
                     last = newLast;
                     }
@@ -892,6 +898,9 @@
            }
         else
            LOG_ERROR_STR(fileName);
+         if (Index < last - (i ? INDEXSAFETYLIMIT : 0) || Index > 3 * INDEXSAFETYLIMIT) // keep off the end in case of "Pause live video"
+            break;
+         sleep(1);
         }
      }
   return index != NULL;
@@ -940,7 +949,7 @@
      int d = Forward ? 1 : -1;
      for (;;) {
          Index += d;
-         if (Index >= 0 && Index < last - ((Forward && StayOffEnd) ? 100 : 0)) {
+         if (Index >= 0 && Index < last - ((Forward && StayOffEnd) ? INDEXSAFETYLIMIT : 0)) {
             if (index[Index].type == I_FRAME) {
                if (FileNumber)
                   *FileNumber = index[Index].number;

Home | Main Index | Thread Index