Ticket #10490: 10490-v3.patch

File 10490-v3.patch, 2.5 KB (added by danielk, 12 years ago)

Potential fix for oldfile

  • mythtv/libs/libmythtv/fileringbuffer.cpp

    diff --git a/mythtv/libs/libmythtv/fileringbuffer.cpp b/mythtv/libs/libmythtv/fileringbuffer.cpp
    index 2985f57..4b06caa 100644
    a b bool FileRingBuffer::OpenFile(const QString &lfilename, uint retry_ms) 
    193193
    194194    filename = lfilename;
    195195    safefilename = lfilename;
     196    oldfile = false;
    196197
    197198    if (remotefile)
    198199    {
    bool FileRingBuffer::OpenFile(const QString &lfilename, uint retry_ms) 
    212213
    213214    if (is_local)
    214215    {
     216        QFileInfo fi(filename);
     217        oldfile = fi.lastModified().secsTo(QDateTime::currentDateTime()) > 60;
     218
    215219        char buf[kReadTestSize];
    216220        int lasterror = 0;
    217221
    bool FileRingBuffer::OpenFile(const QString &lfilename, uint retry_ms) 
    267271        }
    268272        while ((uint)openTimer.elapsed() < retry_ms);
    269273
     274        oldfile &= (openAttempts == 1);
     275
    270276        switch (lasterror)
    271277        {
    272278            case 0:
    273279            {
    274                 QFileInfo fi(filename);
    275                 oldfile = fi.lastModified()
    276                     .secsTo(QDateTime::currentDateTime()) > 60;
    277280                QString extension = fi.completeSuffix().toLower();
    278281                if (is_subtitle_possible(extension))
    279282                    subtitlefilename = local_sub_filename(fi);
    int FileRingBuffer::safe_read(int fd, void *data, uint sz) 
    453456            tot += ret;
    454457        }
    455458
    456         if (oldfile)
    457             break;
    458 
    459459        if (ret == 0) // EOF returns 0
    460460        {
     461            if (oldfile)
     462                break;
     463
    461464            if (tot > 0)
    462465                break;
    463466
  • mythtv/libs/libmythtv/ringbuffer.cpp

    diff --git a/mythtv/libs/libmythtv/ringbuffer.cpp b/mythtv/libs/libmythtv/ringbuffer.cpp
    index e3f0a5a..7037643 100644
    a b void RingBuffer::run(void) 
    843843            }
    844844
    845845            if (remotefile && livetvchain && livetvchain->HasNext())
     846            {
     847                LOG(VB_GENERAL, LOG_INFO, LOC +
     848                    "Setting remote ringbuffer's oldfile bool.");
    846849                remotefile->SetTimeout(true);
     850            }
    847851
    848852            LOG(VB_FILE, LOG_DEBUG, LOC +
    849853                QString("safe_read(...@%1, %2) -- begin")
    void RingBuffer::SetWriteBufferMinWriteSize(int newMinSize) 
    15521556void RingBuffer::SetOldFile(bool is_old)
    15531557{
    15541558    rwlock.lockForWrite();
     1559    LOG(VB_GENERAL, LOG_INFO, LOC + QString("SetOldFile(%1)").arg(is_old));
    15551560    oldfile = is_old;
    15561561    rwlock.unlock();
    15571562}