Skip to content

Commit

Permalink
Make sure a ringbuffer switch is checked at least every 10 seconds.
Browse files Browse the repository at this point in the history
Otherwise, this check is only performed on keyframes, and if there is a
problem with the input we may never see one again, resulting in a wedged
recording.
  • Loading branch information
jpoet committed Feb 13, 2017
1 parent e9daa4e commit 34ad18e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions mythtv/libs/libmythtv/recorders/recorderbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,8 @@ void RecorderBase::CheckForRingBufferSwitch(void)

if (recq && tvrec)
tvrec->RingBufferChanged(ringBuffer, curRecording, recq);

ringBufferCheckTimer.restart();
}

void RecorderBase::SetRecordingStatus(RecStatus::Type status,
Expand Down Expand Up @@ -636,6 +638,18 @@ void RecorderBase::SavePositionMap(bool force, bool finished)
{
positionMapLock.unlock();
}

// Make sure a ringbuffer switch is checked at least every 10
// seconds. Otherwise, this check is only performed on keyframes,
// and if there is a problem with the input we may never see one
// again, resulting in a wedged recording.
if (ringBufferCheckTimer.isRunning() &&
ringBufferCheckTimer.elapsed() > 10000)
{
LOG(VB_RECORD, LOG_WARNING, LOC + "It is has been over 10 seconds "
"since we've checked for a ringbuffer switch.");
CheckForRingBufferSwitch();
}
}

void RecorderBase::TryWriteProgStartMark(const frm_pos_map_t &durationDeltaCopy)
Expand Down
1 change: 1 addition & 0 deletions mythtv/libs/libmythtv/recorders/recorderbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ class MTV_PUBLIC RecorderBase : public QRunnable
QMutex nextRingBufferLock;
RingBuffer *nextRingBuffer;
RecordingInfo *nextRecording;
MythTimer ringBufferCheckTimer;

// Seektable support
MarkTypes positionMapType;
Expand Down

0 comments on commit 34ad18e

Please sign in to comment.