Ticket #10490: 10490-debug.patch

File 10490-debug.patch, 3.6 KB (added by danielk, 12 years ago)

Debug + fix

  • mythtv/libs/libmythtv/tv_rec.cpp

    diff --git a/mythtv/libs/libmythtv/tv_rec.cpp b/mythtv/libs/libmythtv/tv_rec.cpp
    index c575c5a..7048818 100644
    a b void TVRec::run(void) 
    13001300                pendingRecordings.find(cardid) != pendingRecordings.end();
    13011301            pendingRecLock.unlock();
    13021302
     1303            const int time_out = 30;
     1304            bool debug_start_new = false;
     1305            if (!debugNextRecTime.isValid())
     1306                debugNextRecTime = now.addSecs(time_out+90);
     1307            if (now >= debugNextRecTime)
     1308            {
     1309                debug_start_new = true;
     1310                debugNextRecTime = now.addSecs(time_out);
     1311            }
     1312
    13031313            if (has_rec && (has_finish || (now > recordEndTime)))
    13041314            {
    13051315                SetPseudoLiveTVRecording(NULL);
    13061316            }
    13071317            else if (!has_rec && !rec_soon && curRecording &&
    1308                      (now >= curRecording->GetScheduledEndTime()))
     1318                     (now >= curRecording->GetScheduledEndTime() ||
     1319                      debug_start_new))
    13091320            {
    13101321                if (!switchingBuffer)
    13111322                {
    void TVRec::TuningNewRecorder(MPEGStreamData *streamData) 
    39133924{
    39143925    LOG(VB_RECORD, LOG_INFO, LOC + "Starting Recorder");
    39153926
    3916     bool had_dummyrec = false;
    3917     if (HasFlags(kFlagDummyRecorderRunning))
    3918     {
    3919         FinishedRecording(curRecording, NULL);
    3920         ClearFlags(kFlagDummyRecorderRunning);
    3921         curRecording->MarkAsInUse(false, kRecorderInUseID);
    3922         had_dummyrec = true;
    3923     }
     3927    bool had_dummyrec = HasFlags(kFlagDummyRecorderRunning);
    39243928
    39253929    RecordingInfo *rec = lastTuningRequest.program;
    39263930
    void TVRec::TuningNewRecorder(MPEGStreamData *streamData) 
    39323936        bool ok;
    39333937        if (!ringBuffer)
    39343938        {
     3939            if (had_dummyrec)
     3940            {
     3941                FinishedRecording(curRecording, NULL);
     3942                curRecording->MarkAsInUse(false, kRecorderInUseID);
     3943            }
    39353944            ok = CreateLiveTVRingBuffer(channel->GetCurrentName());
    39363945            SetFlags(kFlagRingBufferReady);
    39373946        }
    39383947        else
     3948        {
    39393949            ok = SwitchLiveTVRingBuffer(channel->GetCurrentName(),
    39403950                                        true, !had_dummyrec && recorder);
     3951        }
     3952        ClearFlags(kFlagDummyRecorderRunning);
    39413953        if (!ok)
    39423954        {
    39433955            LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to create RingBuffer 2");
    void TVRec::TuningNewRecorder(MPEGStreamData *streamData) 
    39453957        }
    39463958        rec = curRecording;  // new'd in Create/SwitchLiveTVRingBuffer()
    39473959    }
     3960    else if (had_dummyrec)
     3961    {
     3962        FinishedRecording(curRecording, NULL);
     3963        ClearFlags(kFlagDummyRecorderRunning);
     3964        curRecording->MarkAsInUse(false, kRecorderInUseID);
     3965    }
    39483966
    39493967    if (lastTuningRequest.flags & kFlagRecording)
    39503968    {
    bool TVRec::SwitchLiveTVRingBuffer(const QString & channum, 
    44394457        RecordingInfo *oldinfo = new RecordingInfo(*pi);
    44404458        delete pi;
    44414459        FinishedRecording(oldinfo, NULL);
     4460        oldinfo->MarkAsInUse(false, kRecorderInUseID);
    44424461        delete oldinfo;
    44434462    }
    44444463
  • mythtv/libs/libmythtv/tv_rec.h

    diff --git a/mythtv/libs/libmythtv/tv_rec.h b/mythtv/libs/libmythtv/tv_rec.h
    index ce54bff..018fcf4 100644
    a b class MTV_PUBLIC TVRec : public SignalMonitorListener, public QRunnable 
    387387
    388388    // LiveTV file chain
    389389    LiveTVChain *tvchain;
     390    QDateTime debugNextRecTime;
    390391
    391392    // RingBuffer info
    392393    RingBuffer  *ringBuffer;