]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
dvr: Ensure non-scheduled dvr_entry is always "best".
authorE.Smith <31170571+azlm8t@users.noreply.github.com>
Thu, 20 Sep 2018 22:08:06 +0000 (23:08 +0100)
committerperexg <perex@perex.cz>
Wed, 26 Sep 2018 15:30:47 +0000 (17:30 +0200)
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

index 7de212fb9af3d51e5f00329d7ec90b378c664540..4c91620bce7c47004f3ff31137303dd1aba6c7cf 100644 (file)
@@ -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