Changeset 1529

Show
Ignore:
Timestamp:
03/29/09 09:39:37 (14 years ago)
Author:
ppalmers
Message:

- don't use DEFER when we have sufficient frames. This is a huge performance killer. This might result in worse latency performance though...
- Also update the Timestampedbuffer DLL when dry-running such that we have a decent estimate of the samplerate. Use a large bandwidth for

this estimation to ensure that it tracks fast enough. Switch to a lower bandwidth once we start the actual streaming.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/libffado-2.0/config.h.in

    r1525 r1529  
    206206#define STREAMPROCESSORMANAGER_DYNAMIC_SYNC_DELAY           0 
    207207 
    208 // the default bandwidth of the stream processor timestamp DLL 
     208// the default bandwidth of the stream processor timestamp DLL when synchronizing (should be fast) 
     209#define STREAMPROCESSOR_DLL_FAST_BW_HZ                      5.0 
     210// the default bandwidth of the stream processor timestamp DLL when streaming 
    209211#define STREAMPROCESSOR_DLL_BW_HZ                           0.1 
    210212 
  • branches/libffado-2.0/src/libstreaming/generic/StreamProcessor.cpp

    r1528 r1529  
    529529            return RAW1394_ISO_DEFER; 
    530530        } else if(result2 == eCRV_OK) { 
    531             // no problem here 
    532             // FIXME: cache the period size? 
    533             unsigned int periodsize = m_StreamProcessorManager.getPeriodSize(); 
    534             unsigned int bufferfill = m_data_buffer->getBufferFill(); 
    535             if(bufferfill >= periodsize) { 
    536                 debugOutputExtreme(DEBUG_LEVEL_VERBOSE, "signal activity, %d>%d\n",  
    537                                                         bufferfill, periodsize); 
    538                 //SIGNAL_ACTIVITY_SPM; 
    539                 return RAW1394_ISO_DEFER; // FIXME: might not be needed 
    540             } 
    541531            return RAW1394_ISO_OK; 
    542532        } else { 
     
    14081398            result &= m_data_buffer->setNominalRate(ticks_per_frame); 
    14091399            result &= m_data_buffer->setWrapValue(128L*TICKS_PER_SECOND); 
    1410             result &= m_data_buffer->setBandwidth(m_dll_bandwidth_hz / (double)TICKS_PER_SECOND); 
     1400            result &= m_data_buffer->setBandwidth(STREAMPROCESSOR_DLL_FAST_BW_HZ / (double)TICKS_PER_SECOND); 
    14111401            result &= m_data_buffer->prepare(); // FIXME: the name 
    14121402 
     
    16051595            m_in_xrun = false; 
    16061596            m_local_node_id = m_1394service.getLocalNodeId() & 0x3f; 
     1597            // reduce the DLL bandwidth to what we require 
     1598            result &= m_data_buffer->setBandwidth(m_dll_bandwidth_hz / (double)TICKS_PER_SECOND); 
     1599            // enable the data buffer 
    16071600            m_data_buffer->setTransparent(false); 
    16081601            m_last_timestamp2 = 0; // NOTE: no use in checking if we just started running 
  • branches/libffado-2.0/src/libutil/TimestampedBuffer.cpp

    r1525 r1529  
    101101    double bw_rel = bw * tupdate; 
    102102    if(bw_rel >= 0.5) { 
    103         debugError("Requested bandwidth out of range: %f > %f\n", bw, 0.5*tupdate); 
     103        debugError("Requested bandwidth out of range: %f > %f\n", bw, 0.5 / tupdate); 
    104104        return false; 
    105105    } 
     106    ENTER_CRITICAL_SECTION; 
    106107    m_dll_b = bw_rel * (DLL_SQRT2 * DLL_2PI); 
    107108    m_dll_c = bw_rel * bw_rel * DLL_2PI * DLL_2PI; 
     109    EXIT_CRITICAL_SECTION; 
    108110    return true; 
    109111} 
     
    460462        // while disabled, we don't update the DLL, nor do we write frames 
    461463        // we just set the correct timestamp for the frames 
     464        incrementFrameCounter(nframes, ts); 
     465        decrementFrameCounter(nframes); 
    462466        setBufferTailTimestamp(ts); 
    463467    } else { 
     
    793797 
    794798    // add the offsets 
    795     ffado_timestamp_t ts=new_timestamp; 
     799    ffado_timestamp_t ts = new_timestamp; 
    796800 
    797801    if (ts >= m_wrap_at) { 
     
    814818    m_buffer_tail_timestamp = ts; 
    815819 
    816     m_dll_e2=m_update_period * (double)m_nominal_rate; 
     820    m_dll_e2 = m_update_period * (double)m_current_rate; 
    817821    m_buffer_next_tail_timestamp = (ffado_timestamp_t)((double)m_buffer_tail_timestamp + m_dll_e2); 
    818822 
     
    11011105    debugOutputShort( DEBUG_LEVEL_NORMAL, "    Head - Tail         : "TIMESTAMP_FORMAT_SPEC"\n", diff); 
    11021106    debugOutputShort( DEBUG_LEVEL_NORMAL, "   DLL Rate             : %f (%f)\n", m_dll_e2, m_dll_e2/m_update_period); 
     1107    debugOutputShort( DEBUG_LEVEL_NORMAL, "   DLL Bandwidth        : %10e 1/ticks (%f Hz)\n", getBandwidth(), getBandwidth() * TICKS_PER_SECOND); 
    11031108} 
    11041109