From 1b40e46b510be0d4d67d47715709fdf537ef500e Mon Sep 17 00:00:00 2001 From: "E.Smith" <31170571+azlm8t@users.noreply.github.com> Date: Thu, 20 Sep 2018 23:08:06 +0100 Subject: [PATCH] dvr: Ensure non-scheduled dvr_entry is always "best". Previously in dvr_is_better_recording_timeslot we would sanity check that the old channel and broadcast exists before further checks. However, it probably makes sense to ensure that a non-scheduled dvr_entry (such as already recorded) is always the better match even though it might not be linked to any broadcasts. --- src/dvr/dvr_db.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/dvr/dvr_db.c b/src/dvr/dvr_db.c index 7de212fb9..4c91620bc 100644 --- a/src/dvr/dvr_db.c +++ b/src/dvr/dvr_db.c @@ -1702,6 +1702,12 @@ static dvr_entry_t *_dvr_duplicate_event(dvr_entry_t *de) static int dvr_is_better_recording_timeslot(const epg_broadcast_t *new_bcast, const dvr_entry_t *old_de) { + /* If programme is recording (or completed) then it is the "best", + * even if a better schedule is found after recording starts. + */ + if (old_de->de_sched_state != DVR_SCHEDULED) + return 0; + if (!old_de || !old_de->de_bcast) return 1; /* Old broadcast should always exist */ int old_services = 0; int new_services = 0; @@ -1715,12 +1721,6 @@ dvr_is_better_recording_timeslot(const epg_broadcast_t *new_bcast, const dvr_ent if (!new_channel) return 0; if (!old_channel) return 1; - /* If programme is recording then it is the "best", even if a better - * schedule is found after recording starts. - */ - if (old_de->de_sched_state != DVR_SCHEDULED) - return 0; - /* Always prefer a recording that has the correct service profile * (UHD, HD, SD). Someone mentioned (#1846) that some channels can * show a recording earlier in the week in SD then later in the week -- 2.47.3