From 84bc8008769f25e256f04270c5535421e26cb40a Mon Sep 17 00:00:00 2001 From: Daniel Thor Kristjansson Date: Fri, 30 Mar 2012 09:13:24 -0400 Subject: [PATCH] Refs #10490. At least a partial LiveTV startup fix. When we call FinishedRecording() early it appears to cause an extra empty file to be generated at least some of the time. I'm not exactly sure how this happens, but calling FinishedRecording before the recording is finished is actually a bug itself. This fixes this in the case where I was able to reproduce the problem Peter Townsend experienced. I also tried some other LiveTV actions without seeing duplicate FinishedRecordings calls, but I may have missed some code paths. --- mythtv/libs/libmythtv/tv_rec.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/mythtv/libs/libmythtv/tv_rec.cpp b/mythtv/libs/libmythtv/tv_rec.cpp index 60badaf551c..bf15151f89f 100644 --- a/mythtv/libs/libmythtv/tv_rec.cpp +++ b/mythtv/libs/libmythtv/tv_rec.cpp @@ -4437,14 +4437,7 @@ bool TVRec::SwitchLiveTVRingBuffer(const QString & channum, return false; } - ProgramInfo *pi = tvchain->GetProgramAt(-1); - if (pi) - { - RecordingInfo *oldinfo = new RecordingInfo(*pi); - delete pi; - FinishedRecording(oldinfo, NULL); - delete oldinfo; - } + QString oldcardtype = tvchain->GetCardType(-1); pginfo->MarkAsInUse(true, kRecorderInUseID); pginfo->SaveAutoExpire(kLiveTVAutoExpire); @@ -4462,8 +4455,11 @@ bool TVRec::SwitchLiveTVRingBuffer(const QString & channum, } else if (!set_rec) { - if (curRecording) + // dummy recordings are finished before this + // is called and other recordings must be finished.. + if (curRecording && oldcardtype != "DUMMY") { + FinishedRecording(curRecording, NULL); curRecording->MarkAsInUse(false, kRecorderInUseID); delete curRecording; }