Now making sure a spawned timer only fully overlaps the given event

This commit is contained in:
Klaus Schmidinger 2021-01-19 13:21:51 +01:00
parent 2f6ce68ca7
commit 1b1465a677
3 changed files with 18 additions and 4 deletions

View File

@ -3665,6 +3665,8 @@ J
event has no short text
for reporting a bug in VPS handling when spawning a pattern timer, in case Setup.UseVps
is false
for reporting an endless spawning of pattern timers in case the spawned timer doesn't
use VPS and fully overlaps a second event that is longer than the original one
Stefan Verse <Verse@amotronics.de>
for fixing an occasional black screen when switching channels

View File

@ -9578,7 +9578,7 @@ Video Disk Recorder Revision History
given (reported by Manuel Reimer).
- Fixed handling $(PKG_CONFIG) in newplugin (thanks to Winfried Köhler).
2021-01-18:
2021-01-19:
- Fixed strreplace() to handle NULL strings (reported by Jürgen Schneider).
- Somewhere down the road the 'x' bit of Doxyfile.filter got lost, so the
@ -9601,3 +9601,5 @@ Video Disk Recorder Revision History
(thanks to Peter Bieringer).
- Fixed setting the 'title' of a recording's info to the recording's name if there
is no info file (the change in version 1.7.28 broke the fallback to the old 'summary.vdr').
- Now making sure a spawned timer only fully overlaps the given event (reported by
Jürgen Schneider).

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.4 2021/01/15 13:52:40 kls Exp $
* $Id: timers.c 5.5 2021/01/19 13:21:51 kls Exp $
*/
#include "timers.h"
@ -191,8 +191,18 @@ cTimer::cTimer(const cEvent *Event, const char *FileName, const cTimer *PatternT
time_t tstart = (flags & tfVps) ? Event->Vps() : Event->StartTime();
time_t tstop = tstart + Event->Duration();
if (!(HasFlags(tfVps))) {
tstop += Setup.MarginStop * 60;
tstart -= Setup.MarginStart * 60;
int MarginStart = Setup.MarginStart * 60;
int MarginStop = Setup.MarginStop * 60;
if (PatternTimer) {
// To make sure a spawned timer gets assigned to the correct event, we must
// make sure that this is the only event that overlaps 100%:
if (const cEvent *e = dynamic_cast<const cEvent *>(Event->Prev()))
MarginStart = max(0, min(MarginStart, e->Duration() - 60));
if (const cEvent *e = dynamic_cast<const cEvent *>(Event->Next()))
MarginStop = max(0, min(MarginStop, e->Duration() - 60));
}
tstart -= MarginStart;
tstop += MarginStop;
}
struct tm tm_r;
struct tm *time = localtime_r(&tstart, &tm_r);