From 6d34a8a7a037e442bf74d061357e47576ea6f6bb Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Mon, 27 Feb 2012 10:21:28 +0100 Subject: Fixed handling overlapping timers in case a VPS timer with higher priority needs to interrupt a timer with lower priority --- HISTORY | 4 +++- timers.c | 12 +++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/HISTORY b/HISTORY index b263879b..22e2837f 100644 --- a/HISTORY +++ b/HISTORY @@ -6889,7 +6889,7 @@ Video Disk Recorder Revision History - Fixed switching into time shift mode when pausing live video (thanks to Reinhard 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 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 controlled recordings with such events! - 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. diff --git a/timers.c b/timers.c index 9163a344..a9880115 100644 --- a/timers.c +++ b/timers.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * 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" @@ -390,6 +390,8 @@ void cTimer::SetFile(const char *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 { startTime = stopTime = 0; @@ -433,8 +435,12 @@ bool cTimer::Matches(time_t t, bool Directly, int Margin) const if (Margin || !Directly) { startTime = event->StartTime(); stopTime = event->EndTime(); - if (!Margin) - return event->IsRunning(true); + if (!Margin) { // this is an actual check + 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 -- cgit v1.2.3