Now making sure that spawned timers with reduced start/stop margins actually record with the full margins

This commit is contained in:
Klaus Schmidinger 2021-04-16 16:26:47 +02:00
parent b2fb654bb3
commit 3d13eb002f
3 changed files with 28 additions and 10 deletions

View File

@ -9641,7 +9641,7 @@ Video Disk Recorder Revision History
- No longer switching devices for pattern timers (thanks to Helmut Binder).
- cTimer::TriggerRespawn() now only acts on local timers.
2021-04-13:
2021-04-16:
- When spawning pattern timers, the new function cTimers::GetTimerForEvent() is now used
to check whether a matching event already has a local spawned timer. Reason: creating a timer
@ -9654,3 +9654,5 @@ Video Disk Recorder Revision History
- Fixed dropping outdated events.
- To avoid problems with very short events, non-VPS pattern timers now spawn timers for all
matching events that would start while the first one is still recording.
- Now making sure that spawned timers with reduced start/stop margins actually record with
the full margins.

3
MANUAL
View File

@ -556,6 +556,9 @@ The following rules apply to pattern timers:
- Recording is done according to the event's begin/end times, either
by adding the start/stop margins (for non-VPS timers) or by using the
event's running status (for VPS timers).
- If the start/stop margins of a spawned timer are reduced because the event
before and/or after that timer's event is shorter than the respective margin,
the actual recording still uses the full margins.
- If the times of the event change, a non-VPS pattern timer automatically adjusts
itself to the new times. This also happens if the start/stop margins are changed
in the setup.

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.12 2021/04/13 13:54:00 kls Exp $
* $Id: timers.c 5.13 2021/04/16 16:26:47 kls Exp $
*/
#include "timers.h"
@ -604,14 +604,27 @@ bool cTimer::Matches(time_t t, bool Directly, int Margin) const
deferred = 0;
if (HasFlags(tfActive)) {
if (HasFlags(tfVps) && event && event->Vps()) {
if (Margin || !Directly) {
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);
return startTime <= t && t < stopTime; // ...otherwise we fall back to normal timer handling
if (event) {
if (HasFlags(tfVps)) {
if (event->Vps()) {
if (Margin || !Directly) {
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);
// ...otherwise we fall back to normal timer handling below (note: Margin == 0!)
}
}
}
}
else if (HasFlags(tfSpawned)) {
if (!Margin && !Directly) { // this is an actual check
// The spawned timer's start-/stopTimes are adjusted to the event's times in AdjustSpawnedTimer().
// However, in order to make sure the timer is set to the correct event, the margins at begin
// end end are limited by the durations of the events before and after this timer's event.
// The recording, though, shall always use the full start/stop margins, hence this calculation:
return event->StartTime() - Setup.MarginStart * 60 <= t && t < event->EndTime() + Setup.MarginStop * 60;
}
}
}