Ticket #1120: 1120-v1.patch

File 1120-v1.patch, 2.8 KB (added by danielk, 18 years ago)

possible fix

  • libs/libmythtv/tv_rec.cpp

     
    12121212        if (curRecording)
    12131213            curRecording->UpdateInUseMark();
    12141214
     1215        // Check for the end of the current program..
    12151216        if (GetState() == kState_WatchingLiveTV)
    12161217        {
    1217             bool enable_livetv_ui = false;
    1218             if (pseudoLiveTVRecording &&
    1219                 (QDateTime::currentDateTime() > recordEndTime ||
    1220                  HasFlags(kFlagFinishRecording)))
    1221             {
     1218#define LIVETV_END (now >= curRecording->endts)
     1219// use the following instead to test ringbuffer switching
     1220//#define LIVETV_END (now >= curRecording->recstartts.addSecs(60))
     1221
     1222            QDateTime now   = QDateTime::currentDateTime();
     1223            bool has_finish = HasFlags(kFlagFinishRecording);
     1224            bool has_rec    = pseudoLiveTVRecording;
     1225            bool rec_soon   = pendingRecording;
     1226            bool enable_ui  = true;
     1227
     1228            if (has_rec && (has_finish || (now > recordEndTime)))
    12221229                SetPseudoLiveTVRecording(NULL);
    1223                 enable_livetv_ui = true;
    1224             }
    1225             else if (curRecording &&
    1226                      !pseudoLiveTVRecording && !pendingRecording)
     1230            else if (!has_rec && !rec_soon && curRecording && LIVETV_END)
     1231                SwitchLiveTVRingBuffer();
     1232            else
     1233                enable_ui = false;
     1234
     1235            if (enable_ui)
    12271236            {
    1228 //#define TESTING_RING_BUFFER_SWITCHING
    1229 #ifdef TESTING_RING_BUFFER_SWITCHING
    1230                 if ((QDateTime::currentDateTime() >=
    1231                      curRecording->recstartts.addSecs(60)))
    1232 #else
    1233                 if ((QDateTime::currentDateTime() >= curRecording->endts))
    1234 #endif
    1235                 {
    1236                     CheckForRecGroupChange();
    1237                     if (pseudoLiveTVRecording)
    1238                     {
    1239                         // If the last recording was flagged for keeping
    1240                         // in the frontend, then add the recording rule
    1241                         // so that transcode, commfrag, etc can be run.
    1242                         recordEndTime =
    1243                             GetRecordEndTime(pseudoLiveTVRecording);
    1244                         NotifySchedulerOfRecording(curRecording);
    1245                     }
    1246                     else
    1247                     {
    1248                         SwitchLiveTVRingBuffer();
    1249                         enable_livetv_ui = true;
    1250                     }
    1251                 }
    1252             }
    1253             if (enable_livetv_ui)
    1254             {
    12551237                VERBOSE(VB_IMPORTANT, LOC + "Enabling Full LiveTV UI.");
    12561238                QString message = QString("LIVETV_WATCH %1 0").arg(cardid);
    12571239                MythEvent me(message);