Skip to content

Commit b71875f

Browse files
committed
Account for very, large pre-roll values in AssignGroupInput.
Fixes #13423
1 parent 3be5b08 commit b71875f

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

mythtv/programs/mythbackend/scheduler.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2648,6 +2648,7 @@ bool Scheduler::HandleRecording(
26482648

26492649
QDateTime curtime = MythDate::current();
26502650
QDateTime nextrectime = ri.GetRecordingStartTime();
2651+
int origprerollseconds = prerollseconds;
26512652

26522653
if (ri.GetRecordingStatus() != RecStatus::WillRecord &&
26532654
ri.GetRecordingStatus() != RecStatus::Pending)
@@ -2819,21 +2820,18 @@ bool Scheduler::HandleRecording(
28192820

28202821
if (ri.GetRecordingStatus() != RecStatus::Pending)
28212822
{
2822-
if (m_sinputinfomap[ri.GetInputID()].m_schedgroup)
2823+
if (!AssignGroupInput(tempri, origprerollseconds))
28232824
{
2824-
if (!AssignGroupInput(tempri))
2825-
{
2826-
// We failed to assign an input. Keep asking the main
2827-
// server to add one until we get one.
2828-
MythEvent me(QString("ADD_CHILD_INPUT %1")
2829-
.arg(tempri.GetInputID()));
2830-
gCoreContext->dispatch(me);
2831-
nextWakeTime = min(nextWakeTime, curtime.addSecs(1));
2832-
return m_reclist_changed;
2833-
}
2834-
ri.SetInputID(tempri.GetInputID());
2835-
nexttv = (*m_tvList)[ri.GetInputID()];
2825+
// We failed to assign an input. Keep asking the main
2826+
// server to add one until we get one.
2827+
MythEvent me(QString("ADD_CHILD_INPUT %1")
2828+
.arg(tempri.GetInputID()));
2829+
gCoreContext->dispatch(me);
2830+
nextWakeTime = min(nextWakeTime, curtime.addSecs(1));
2831+
return m_reclist_changed;
28362832
}
2833+
ri.SetInputID(tempri.GetInputID());
2834+
nexttv = (*m_tvList)[ri.GetInputID()];
28372835

28382836
ri.SetRecordingStatus(RecStatus::Pending);
28392837
tempri.SetRecordingStatus(RecStatus::Pending);
@@ -2928,7 +2926,8 @@ void Scheduler::HandleRecordingStatusChange(
29282926
}
29292927
}
29302928

2931-
bool Scheduler::AssignGroupInput(RecordingInfo &ri)
2929+
bool Scheduler::AssignGroupInput(RecordingInfo &ri,
2930+
int prerollseconds)
29322931
{
29332932
if (!m_sinputinfomap[ri.GetInputID()].m_schedgroup)
29342933
return true;
@@ -2956,7 +2955,8 @@ bool Scheduler::AssignGroupInput(RecordingInfo &ri)
29562955
for (RecIter j = m_reclist.begin(); j != m_reclist.end(); ++j)
29572956
{
29582957
RecordingInfo *p = (*j);
2959-
if (now.secsTo(p->GetRecordingStartTime()) > 300)
2958+
if (now.secsTo(p->GetRecordingStartTime()) >
2959+
prerollseconds + 60)
29602960
break;
29612961
if (p->GetInputID() != inputid)
29622962
continue;

mythtv/programs/mythbackend/scheduler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ class Scheduler : public MThread, public MythScheduler
212212
int prerollseconds);
213213
void HandleRecordingStatusChange(
214214
RecordingInfo &ri, RecStatus::Type recStatus, const QString &details);
215-
bool AssignGroupInput(RecordingInfo &ri);
215+
bool AssignGroupInput(RecordingInfo &ri, int prerollseconds);
216216
void HandleIdleShutdown(
217217
bool &blockShutdown, QDateTime &idleSince, int prerollseconds,
218218
int idleTimeoutSecs, int idleWaitForRecordingTime,

0 commit comments

Comments
 (0)