Ticket #11108: PATCH-backend

File PATCH-backend, 1.5 KB (added by mythwiki@…, 12 years ago)

More complete patch. This should fix the bug and handle all cases. Tested on my setup.

Line 
1diff --git a/mythtv/programs/mythbackend/scheduler.cpp b/mythtv/programs/mythbackend/scheduler.cpp
2index d6676b3..c7b9677 100644
3--- a/mythtv/programs/mythbackend/scheduler.cpp
4+++ b/mythtv/programs/mythbackend/scheduler.cpp
5@@ -1785,7 +1785,7 @@ void Scheduler::run(void)
6 
7     QMutexLocker lockit(&schedLock);
8 
9-    int       prerollseconds  = 0;
10+    int       prerollseconds  = gCoreContext->GetNumSetting("RecordPreRoll", 0);
11     int       wakeThreshold   = 300;
12     int       idleTimeoutSecs = 0;
13     int       idleWaitForRecordingTime = 15; // in minutes
14@@ -1806,7 +1806,10 @@ void Scheduler::run(void)
15 
16         QDateTime curtime = MythDate::current();
17         int secs_to_next = (startIter != reclist.end()) ?
18-            curtime.secsTo((*startIter)->GetRecordingStartTime()) : 60*60;
19+            curtime.secsTo((*startIter)->GetRecordingStartTime()) - prerollseconds : 60*60;
20+
21+        if (secs_to_next < 1)
22+            secs_to_next = 1;
23 
24         // If we're about to start a recording don't do any reschedules...
25         // instead sleep for a bit
26@@ -1975,7 +1978,7 @@ int Scheduler::CalcTimeToNextHandleRecordingEvent(
27         if ((*i)->GetRecordingStatus() == (*i)->oldrecstatus)
28             continue;
29 
30-        int secs_to_next = curtime.secsTo((*i)->GetRecordingStartTime());
31+        int secs_to_next = curtime.secsTo((*i)->GetRecordingStartTime()) - prerollseconds;
32 
33         if ((*i)->GetRecordingStatus() == rsWillRecord &&
34             !recPendingList[(*i)->MakeUniqueSchedulerKey()])