Skip to content

Commit

Permalink
Try to fix corner cases when stopping in-progress recordings.
Browse files Browse the repository at this point in the history
The backend uses EncoderLink::MatchesRecording(), which in turn uses
ProgramInfo::IsSameRecording(), to determine which recorder to stop.
Unfortunately the logic used is too strict in some respects and too
loose in others.  It is too strict in that it requires an exact match
on ProgramInfo::recstartts when there are many places in the code
where the exact recstartts used by the recorder is not known.  The
result is the stop recording request is ignored in those cases.  It is
too loose in that it doesn't only uses chanid and recstartts.  The
result is that it can stop the wrong recording in some cases.

This change attempts to resolve at least some of the issues.  Changed
PI:IsSameRecording() to also check the program title.  Changed
EL::MatchesProgram() to check PI::IsSameProgramWeakCheck() and the
inputids instead of PI::IsSameRecording() when the inputid is known.
This handles the cases where the exact recstartts isn't known.
Finally, removed a work-around for this problem in ScheduleCommon that
didn't always work.

(cherry picked from commit 8116fde)
  • Loading branch information
gigem committed Jun 3, 2014
1 parent 00c0814 commit a1b5067
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 3 additions & 1 deletion mythtv/libs/libmyth/programinfo.h
Expand Up @@ -303,7 +303,9 @@ class MPUBLIC ProgramInfo
// Used for extending scheduled recordings
bool IsSameProgramWeakCheck(const ProgramInfo &other) const;
bool IsSameRecording(const ProgramInfo &other) const
{ return chanid == other.chanid && recstartts == other.recstartts; }
{ return title == other.title &&
chanid == other.chanid &&
recstartts == other.recstartts; }

// Quick gets
/// Creates a unique string that can be used to identify an
Expand Down
6 changes: 5 additions & 1 deletion mythtv/programs/mythbackend/encoderlink.cpp
Expand Up @@ -274,7 +274,11 @@ bool EncoderLink::MatchesRecording(const ProgramInfo *rec)

if (tvrec)
{
retval = tvrec->IsSameRecording(*rec);
retval = (rec->GetInputID() == 0 &&
tvrec->IsSameRecording(*rec)) ||
(rec->GetInputID() == tvrec->GetInputID() &&
tvrec->IsSameProgramWeakCheck(*rec))
;
delete tvrec;
}
}
Expand Down
5 changes: 1 addition & 4 deletions mythtv/programs/mythfrontend/schedulecommon.cpp
Expand Up @@ -453,10 +453,7 @@ void ScheduleCommon::customEvent(QEvent *event)
}
else if (resulttext == tr("Stop this recording"))
{
ProgramInfo pginfo(
recInfo.GetChanID(), recInfo.GetRecordingStartTime());
if (pginfo.GetChanID())
RemoteStopRecording(&pginfo);
RemoteStopRecording(&recInfo);
}
else if (resulttext == tr("Modify recording options") ||
resulttext == tr("Add override rule"))
Expand Down

0 comments on commit a1b5067

Please sign in to comment.