Fixed handling timers in case an event is modified and "phased out" while the timer is recording

This commit is contained in:
Klaus Schmidinger
2012-10-16 08:24:10 +02:00
parent 4149053935
commit 38d48afad9
2 changed files with 15 additions and 10 deletions

View File

@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: timers.c 2.13 2012/10/13 14:16:22 kls Exp $
* $Id: timers.c 2.14 2012/10/16 08:22:39 kls Exp $
*/
#include "timers.h"
@@ -465,10 +465,11 @@ bool cTimer::Matches(time_t t, bool Directly, int Margin) const
startTime = event->StartTime();
stopTime = event->EndTime();
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
if (event->Schedule()->PresentSeenWithin(EITPRESENTFOLLOWINGRATE)) { // VPS control can only work with up-to-date events...
if (event->StartTime() > 0) // checks for "phased out" events
return event->IsRunning(true);
}
return startTime <= t && t < stopTime; // ...otherwise we fall back to normal timer handling
}
}
}
@@ -549,10 +550,12 @@ void cTimer::SetEventFromSchedule(const cSchedules *Schedules)
lastSetEvent = now;
const cEvent *Event = NULL;
if (HasFlags(tfVps) && Schedule->Events()->First()->Vps()) {
if (event && Recording())
return; // let the recording end first
if (event && (now <= event->EndTime() || Matches(0, true)))
return; // stay with the old event until the timer has completely expired
if (event && event->StartTime() > 0) { // checks for "phased out" events
if (Recording())
return; // let the recording end first
if (now <= event->EndTime() || Matches(0, true))
return; // stay with the old event until the timer has completely expired
}
// VPS timers only match if their start time exactly matches the event's VPS time:
for (const cEvent *e = Schedule->Events()->First(); e; e = Schedule->Events()->Next(e)) {
if (e->StartTime() && e->RunningStatus() != SI::RunningStatusNotRunning) { // skip outdated events