Show
Ignore:
Timestamp:
01/19/08 12:09:55 (16 years ago)
Author:
ppalmers
Message:

fix xrun recovery and robustify

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libffado/src/libstreaming/generic/StreamProcessor.cpp

    r860 r862  
    16401640bool StreamProcessor::waitForProduce(unsigned int nframes) 
    16411641{ 
    1642     debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "(%p) wait ...\n", this); 
     1642    debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "(%p, %s) wait ...\n", this, getTypeString()); 
    16431643    struct timespec ts; 
    16441644    int result; 
     
    16621662        if (result == -1) { 
    16631663            if (errno == ETIMEDOUT) { 
    1664                 debugOutput(DEBUG_LEVEL_VERBOSE, "(%p) pthread_cond_timedwait() timed out\n", this); 
     1664                debugOutput(DEBUG_LEVEL_VERBOSE, "(%p, %s) pthread_cond_timedwait() timed out\n", this, getTypeString()); 
    16651665                pthread_mutex_unlock(&m_activity_cond_lock); 
    16661666                return false; 
    16671667            } else { 
    1668                 debugError("(%p) pthread_cond_timedwait error\n", this); 
     1668                debugError("(%p, %s) pthread_cond_timedwait error\n", this, getTypeString()); 
    16691669                pthread_mutex_unlock(&m_activity_cond_lock); 
    16701670                return false; 
     
    16861686bool StreamProcessor::waitForConsume(unsigned int nframes) 
    16871687{ 
    1688     debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "(%p) wait ...\n", this); 
     1688    debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "(%p, %s) wait ...\n", this, getTypeString()); 
    16891689    struct timespec ts; 
    16901690    int result; 
     
    17051705    while(!canConsume(nframes)) { 
    17061706        result = pthread_cond_timedwait(&m_activity_cond, &m_activity_cond_lock, &ts); 
    1707      
    17081707        if (result == -1) { 
    17091708            if (errno == ETIMEDOUT) { 
    1710                 debugOutput(DEBUG_LEVEL_VERBOSE, "(%p) pthread_cond_timedwait() timed out\n", this); 
     1709                debugOutput(DEBUG_LEVEL_VERBOSE, "(%p, %s) pthread_cond_timedwait() timed out\n", this, getTypeString()); 
    17111710                pthread_mutex_unlock(&m_activity_cond_lock); 
    17121711                return false; 
    17131712            } else { 
    1714                 debugError("(%p) pthread_cond_timedwait error\n", this); 
     1713                debugError("(%p, %s) pthread_cond_timedwait error\n", this, getTypeString()); 
    17151714                pthread_mutex_unlock(&m_activity_cond_lock); 
    17161715                return false; 
     
    17191718    } 
    17201719    pthread_mutex_unlock(&m_activity_cond_lock); 
     1720    debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "(%p, %s) leave ...\n", this, getTypeString()); 
    17211721    return true; 
    17221722} 
     
    17321732bool StreamProcessor::canProduce(unsigned int nframes) 
    17331733{ 
     1734    if(m_in_xrun) return true; 
    17341735    if(m_state == ePS_Running && m_next_state == ePS_Running) { 
    17351736        // check whether we already fullfil the criterion 
     
    17621763bool StreamProcessor::canConsume(unsigned int nframes) 
    17631764{ 
     1765    if(m_in_xrun) return true; 
    17641766    if(m_state == ePS_Running && m_next_state == ePS_Running) { 
    17651767        // check whether we already fullfil the criterion 
  • trunk/libffado/src/libstreaming/StreamProcessorManager.cpp

    r860 r862  
    711711 
    712712    while(period_not_ready) { 
    713         debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "waiting for period (%d frames in buffer)...\n", m_SyncSource->getBufferFill()); 
     713        debugOutput( DEBUG_LEVEL_VERBOSE, "waiting for period (%d frames in buffer)...\n", m_SyncSource->getBufferFill()); 
    714714        bool result; 
    715715        if(m_SyncSource->getType() == StreamProcessor::ePT_Receive) { 
     
    757757        if(xrun_occurred) break; 
    758758        // FIXME: make sure we also exit this loop when something else happens (e.g. signal, iso error) 
     759    } 
     760 
     761    if(xrun_occurred) { 
     762        debugOutput( DEBUG_LEVEL_VERBOSE, "exit due to xrun...\n"); 
    759763    } 
    760764