Changeset 791

Show
Ignore:
Timestamp:
12/31/07 06:41:19 (13 years ago)
Author:
ppalmers
Message:

try and get some better low-latency performance

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/SConstruct

    r781 r791  
    319319 
    320320env['PACKAGE'] = "libffado" 
    321 env['VERSION'] = "1.999.10
     321env['VERSION'] = "1.999.11
    322322env['LIBVERSION'] = "1.0.0" 
    323323 
  • trunk/libffado/src/ffado.cpp

    r750 r791  
    245245        return dev->options.period_size; 
    246246    } else { 
     247        debugWarning("XRUN"); 
    247248        xruns++; 
    248249        return -1; 
  • trunk/libffado/src/libieee1394/IsoHandler.cpp

    r790 r791  
    214214    } 
    215215    debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "(%c %p) poll took %lldus, iterate took %lldus\n",  
    216                 (this->getType()==eHT_Receive?'R':'X'), this,  
     216                (getType()==eHT_Receive?'R':'X'), this,  
    217217                poll_exit-poll_enter, iter_exit-iter_enter); 
    218218#else 
     
    220220    // so poll'ing is not really necessary 
    221221    bool result = iterate(); 
    222     usleep(125); 
     222    //usleep(125); 
    223223    return result; 
    224224#endif 
     
    228228bool 
    229229IsoHandler::iterate() { 
     230    flush(); 
    230231    if(raw1394_loop_iterate(m_handle)) { 
    231232        debugOutput( DEBUG_LEVEL_VERBOSE, 
  • trunk/libffado/src/libieee1394/IsoHandlerManager.cpp

    r784 r791  
    368368        } 
    369369 
    370         unsigned int irq_interval = packets_per_period / MINIMUM_INTERRUPTS_PER_PERIOD; 
    371         if(irq_interval <= 0) irq_interval=1; 
    372  
     370        //unsigned int irq_interval = packets_per_period / MINIMUM_INTERRUPTS_PER_PERIOD; 
     371        //if(irq_interval <= 0) irq_interval=1; 
     372        unsigned int irq_interval=2; // this is not the HW IRQ interval 
     373         
    373374        // the receive buffer size doesn't matter for the latency, 
    374375        // but it has a minimal value in order for libraw to operate correctly (300) 
     
    423424        } 
    424425 
    425         unsigned int irq_interval = packets_per_period / MINIMUM_INTERRUPTS_PER_PERIOD; 
    426         if(irq_interval <= 0) irq_interval=1; 
     426        // unsigned int irq_interval = packets_per_period / MINIMUM_INTERRUPTS_PER_PERIOD; 
     427        // if(irq_interval <= 0) irq_interval=1; 
     428        unsigned int irq_interval=2; // this is not the HW IRQ interval 
    427429 
    428430        // the SP specifies how many packets to ISO-buffer 
  • trunk/libffado/src/libstreaming/generic/StreamProcessor.cpp

    r783 r791  
    117117     
    118118    // only queue a part (80%) of the theoretical max in order not to have too much 'not ready' cycles 
    119     packets_to_prebuffer = (packets_to_prebuffer * 8000) / 10000; 
     119    packets_to_prebuffer = (packets_to_prebuffer * 7000) / 10000; 
    120120     
    121121    return packets_to_prebuffer; 
     
    620620                } 
    621621            } 
    622 //             return RAW1394_ISO_AGAIN; 
    623             generateSilentPacketHeader(data, length, tag, sy, cycle, dropped_cycles, max_length); 
    624             generateSilentPacketData(data, length, tag, sy, cycle, dropped_cycles, max_length); 
    625             return RAW1394_ISO_DEFER; 
     622            usleep(125); // only when using thread-per-handler 
     623            return RAW1394_ISO_AGAIN; 
     624//             generateSilentPacketHeader(data, length, tag, sy, cycle, dropped_cycles, max_length); 
     625//             generateSilentPacketData(data, length, tag, sy, cycle, dropped_cycles, max_length); 
     626//             return RAW1394_ISO_DEFER; 
    626627        } else { 
    627628            debugError("Invalid return value: %d\n", result); 
     
    12841285            } 
    12851286            break; 
     1287        case ePS_WaitingForStreamEnable: // when xrunning at startup 
     1288            result &= m_data_buffer->clearBuffer(); 
     1289            m_data_buffer->setTransparent(true); 
     1290            break; 
    12861291        case ePS_WaitingForStreamDisable: 
    1287             result &= m_data_buffer->clearBuffer(); // FIXME: don't like the reset() name 
     1292            result &= m_data_buffer->clearBuffer(); 
    12881293            m_data_buffer->setTransparent(true); 
    12891294            break; 
  • trunk/libffado/src/libstreaming/StreamProcessorManager.cpp

    r790 r791  
    465465        while(nb_sync_runs) { 
    466466            debugOutput( DEBUG_LEVEL_VERY_VERBOSE, " check (%d)...\n", nb_sync_runs); 
    467             waitForPeriod(); 
     467            if(!waitForPeriod()) { 
     468                debugWarning("xrun while aligning streams...\n"); 
     469                return false; 
     470            }; 
    468471 
    469472            i = 0; 
     
    541544          it != m_ReceiveProcessors.end(); 
    542545          ++it ) { 
    543         if(!(*it)->scheduleStopRunning(-1)) { 
    544             debugError("%p->scheduleStopRunning(-1) failed\n", *it); 
    545             return false; 
     546        if((*it)->isRunning()) { 
     547            if(!(*it)->scheduleStopRunning(-1)) { 
     548                debugError("%p->scheduleStopRunning(-1) failed\n", *it); 
     549                return false; 
     550            } 
    546551        } 
    547552    } 
     
    549554          it != m_TransmitProcessors.end(); 
    550555          ++it ) { 
    551         if(!(*it)->scheduleStopRunning(-1)) { 
    552             debugError("%p->scheduleStopRunning(-1) failed\n", *it); 
    553             return false; 
     556        if((*it)->isRunning()) { 
     557            if(!(*it)->scheduleStopRunning(-1)) { 
     558                debugError("%p->scheduleStopRunning(-1) failed\n", *it); 
     559                return false; 
     560            } 
    554561        } 
    555562    } 
     
    754761            m_SyncSource->setSyncDelay(d); 
    755762            d = m_SyncSource->getSyncDelay(); 
    756             debugOutput(DEBUG_LEVEL_VERBOSE, "Increased the Sync delay to: %d\n", d); 
     763            debugOutput(DEBUG_LEVEL_VERBOSE, "Increased the Sync delay to: %d ticks (%f frames, %f cy)\n",  
     764                                             d, ((float)d)/m_SyncSource->getTicksPerFrame(),  
     765                                             ((float)d)/((float)TICKS_PER_CYCLE)); 
    757766 
    758767            #ifdef DEBUG