Fixed expiring of one-time VPS timers in case there is more than one event with the same VPS time

This commit is contained in:
Klaus Schmidinger 2024-10-11 13:58:11 +02:00
parent 2bcd8ba8f3
commit 5a626fef9f
3 changed files with 37 additions and 4 deletions

View File

@ -2587,6 +2587,8 @@ Markus Ehrnsperger <markus.ehrnsperger@googlemail.com>
at the same time get a new event ID
for reporting a bug in handling negative values in cSource::Position() on
systems where 'int' is 64 bit
for suggesting a fix for expiring of one-time VPS timers in case there is more than
one event with the same VPS time
Werner Färber <w.faerber@gmx.de>
for reporting a bug in handling the cPluginManager::Active() result when pressing

View File

@ -10021,10 +10021,12 @@ Video Disk Recorder Revision History
- Fixed a problem with duplicate events if they are moved to a lower table ID and at the
same time get a new event ID (reported by Markus Ehrnsperger).
2024-10-09:
2024-10-11:
- Removed defining DEPRECATED_* macros with value 0, because this is the preprocessor's
default (suggested by Winfried Köhler).
- Fixed error checking in case of large PTS discontinuities (reported by Matthias Senzel).
- Fixed handling negative values in cSource::Position() on systems where 'int' is 64 bit
(reported by Markus Ehrnsperger, fix suggested by Winfried Köhler).
- Fixed expiring of one-time VPS timers in case there is more than one event with the
same VPS time (suggested by Markus Ehrnsperger).

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 5.20 2024/03/06 14:37:15 kls Exp $
* $Id: timers.c 5.21 2024/10/11 13:58:11 kls Exp $
*/
#include "timers.h"
@ -726,10 +726,39 @@ eTimerMatch cTimer::Matches(const cEvent *Event, int *Overlap) const
bool cTimer::Expired(void) const
{
if (IsSingleEvent() && !Recording()) {
time_t Now = time(NULL);
time_t ExpireTime = StopTimeEvent();
if (HasFlags(tfVps))
if (HasFlags(tfVps)) {
ExpireTime += EXPIRELATENCY;
return ExpireTime <= time(NULL);
if (ExpireTime <= Now) {
LOCK_SCHEDULES_READ;
const cSchedule *Schedule = event ? event->Schedule() : NULL;
const cEvent *FirstEvent = event;
if (Schedule)
FirstEvent = Schedule->Events()->Next(FirstEvent);
else if ((Schedule = Schedules->GetSchedule(Channel())) != NULL) {
FirstEvent = Schedule->Events()->First();
if (FirstEvent)
dsyslog("timer %s had no event, got %s from channel/schedule", *ToDescr(), *FirstEvent->ToDescr());
}
if (FirstEvent) {
if (Schedule) {
for (const cEvent *e = FirstEvent; e; e = Schedule->Events()->Next(e)) {
if (e->Vps() == startTime) {
ExpireTime = e->EndTime() + EXPIRELATENCY;
dsyslog("timer %s is waiting for next VPS event %s", *ToDescr(), *e->ToDescr());
// no break here - let's play it safe and look at *all* events
}
}
}
}
else {
dsyslog("timer %s has no event, setting expiration to +24h", *ToDescr());
ExpireTime += 3600 * 24;
}
}
}
return ExpireTime <= Now;
}
return false;
}