Mailing List archive

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

[vdr] Re: Fast forward stops in timeshift mode



Oliver Endriss wrote:
> 
> On Monday 08 September 2003 22:59, Klaus Schmidinger wrote:
> > Thanks for these detailed tests.
> > With this in mind I looked over dvbplayer.c and recording.c and
> > I think there actually is a chance that CatchUp() gets called from
> > the player thread _and_ the foreground program, which might result
> > in 'last' being changed unexpectedly.
> >
> > During your tests, do you use the progress display, or any fast forward/rewind
> > function? AFAICS 'last' should only be messed with when those are used.
> 
> Sounds promising. Progress display is on and I'm using fast forward
> mode (multi-speed mode, speed '3').
> 
> > Could you please add a counter to CatchUp(), which you increment at the
> > entry point and decrement when leaving the function, and make a debug
> > printout should the counter ever become larger than 1? If you can cause
> > such a situation, we'll need a mutex for CatchUp().
> 
> Ok, added the counter and it really happens:
> 
>   xcnt 2
>   ERROR:  last 17032  newlast 17031
>   ERROR:  last 17032  newlast 17031
>   Sep  8 23:46:10 orion vdr[18190]: ERROR: can't read from index - file 26  read -1  delta -8  last 17032  newLast 17031  size 136256  offs 136264
> 
> Adding a mutex will probably solve this problem.

Please try this patch:

--- recording.h 2003/08/17 09:03:46     1.26
+++ recording.h 2003/09/09 16:00:56
@@ -12,6 +12,7 @@

 #include <time.h>
 #include "config.h"
+#include "thread.h"
 #include "timers.h"
 #include "tools.h"

@@ -130,6 +131,7 @@
   int size, last;
   tIndex *index;
   cResumeFile resumeFile;
+  cMutex mutex;
   bool CatchUp(int Index = -1);
 public:
   cIndexFile(const char *FileName, bool Record);
--- recording.c 2003/08/17 09:10:46     1.82
+++ recording.c 2003/09/09 16:02:55
@@ -859,6 +859,7 @@
 {
   // returns true unless something really goes wrong, so that 'index' becomes NULL
   if (index && f >= 0) {
+     cMutexLock MutexLock(&mutex);
      for (int i = 0; i <= MAXINDEXCATCHUP && (Index < 0 || Index >= last); i++) {
          struct stat buf;
          if (fstat(f, &buf) == 0) {


Klaus


-- 
Info:
To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe vdr" as subject.



Home | Main Index | Thread Index