Fixed handling overlapping timers in case a VPS timer with higher priority needs to interrupt a timer with lower priority

This commit is contained in:
Klaus Schmidinger 2012-02-27 10:21:28 +01:00
parent cd0f403bbc
commit 6d34a8a7a0
2 changed files with 12 additions and 4 deletions

View File

@ -6889,7 +6889,7 @@ Video Disk Recorder Revision History
- Fixed switching into time shift mode when pausing live video (thanks to Reinhard - Fixed switching into time shift mode when pausing live video (thanks to Reinhard
Nissl for helping to debug this one). Nissl for helping to debug this one).
2012-02-26: Version 1.7.25 2012-02-27: Version 1.7.25
- The fps value for channels where it differs from the default is now set correctly - The fps value for channels where it differs from the default is now set correctly
when pausing live video. when pausing live video.
@ -6923,3 +6923,5 @@ Video Disk Recorder Revision History
that from the DVB data stream. Note, though, that this means VDR can not do VPS that from the DVB data stream. Note, though, that this means VDR can not do VPS
controlled recordings with such events! controlled recordings with such events!
- Added some typecasts to silence gcc compiler warnings (thanks to Rolf Ahrenberg). - Added some typecasts to silence gcc compiler warnings (thanks to Rolf Ahrenberg).
- Fixed handling overlapping timers in case a VPS timer with higher priority needs
to interrupt a timer with lower priority.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: timers.c 2.7 2012/02/20 15:51:55 kls Exp $ * $Id: timers.c 2.8 2012/02/27 09:38:41 kls Exp $
*/ */
#include "timers.h" #include "timers.h"
@ -390,6 +390,8 @@ void cTimer::SetFile(const char *File)
Utf8Strn0Cpy(file, File, sizeof(file)); Utf8Strn0Cpy(file, File, sizeof(file));
} }
#define EITPRESENTFOLLOWINGRATE 10 // max. seconds between two occurrences of the "EIT present/following table for the actual multiplex" (2s by the standard, using some more for safety)
bool cTimer::Matches(time_t t, bool Directly, int Margin) const bool cTimer::Matches(time_t t, bool Directly, int Margin) const
{ {
startTime = stopTime = 0; startTime = stopTime = 0;
@ -433,8 +435,12 @@ bool cTimer::Matches(time_t t, bool Directly, int Margin) const
if (Margin || !Directly) { if (Margin || !Directly) {
startTime = event->StartTime(); startTime = event->StartTime();
stopTime = event->EndTime(); stopTime = event->EndTime();
if (!Margin) if (!Margin) { // this is an actual check
return event->IsRunning(true); if (event->Schedule()->PresentSeenWithin(EITPRESENTFOLLOWINGRATE)) // VPS control can only work with up-to-date events...
return event->IsRunning(true);
else
return startTime <= t && t < stopTime; // ...otherwise we fall back to normal timer handling
}
} }
} }
return startTime <= t + Margin && t < stopTime; // must stop *before* stopTime to allow adjacent timers return startTime <= t + Margin && t < stopTime; // must stop *before* stopTime to allow adjacent timers