- Timestamp:
- 01/13/08 09:17:58 (16 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libffado/src/libstreaming/generic/StreamProcessor.cpp
r839 r841 207 207 208 208 void 209 StreamProcessor::setSyncDelay(int d) { 210 debugOutput(DEBUG_LEVEL_ULTRA_VERBOSE, "Setting SP %p SyncDelay to %d ticks\n", this, d); 211 m_sync_delay = d; 209 StreamProcessor::setSyncDelay(unsigned int d) { 210 unsigned int frames = d / getTicksPerFrame(); 211 debugOutput(DEBUG_LEVEL_VERBOSE, "Setting SP %p SyncDelay to %u ticks, %u frames\n", this, d, frames); 212 m_sync_delay = d; // FIXME: sync delay not necessary anymore 212 213 } 213 214 … … 273 274 #ifdef DEBUG 274 275 if (!can_transfer) { 275 debug Warning("(%p, %s) cannot transfer since fc == %u, nbframes == %u\n",276 debugOutput(DEBUG_LEVEL_VERBOSE, "(%p, %s) cannot transfer since fc == %u, nbframes == %u\n", 276 277 this, ePTToString(getType()), fc, nbframes); 277 278 } … … 913 914 int result; 914 915 if(m_state == ePS_Running && m_next_state == ePS_Running) { 916 // check whether we already fullfil the criterion 917 unsigned int bufferfill = m_data_buffer->getBufferFill(); 918 if(bufferfill >= m_signal_period + m_signal_offset) { 919 return true; 920 } 921 915 922 result = sem_wait(&m_signal_semaphore); 916 923 #ifdef DEBUG … … 931 938 StreamProcessor::tryWaitForSignal() 932 939 { 933 if(m_state == ePS_Running) { 934 return sem_trywait(&m_signal_semaphore) == 0; 940 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "(%p, %s) trywait ...\n", this, getTypeString()); 941 int result; 942 if(m_state == ePS_Running && m_next_state == ePS_Running) { 943 // check whether we already fullfil the criterion 944 unsigned int bufferfill = m_data_buffer->getBufferFill(); 945 if(bufferfill >= m_signal_period + m_signal_offset) { 946 return true; 947 } 948 949 result = sem_trywait(&m_signal_semaphore); 950 #ifdef DEBUG 951 int tmp; 952 sem_getvalue(&m_signal_semaphore, &tmp); 953 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, " sem_wait returns: %d, sem_value: %d\n", result, tmp); 954 #endif 955 return result == 0; 935 956 } else { 936 957 // when we're not running, we can always provide frames 937 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "Not running...\n"); 958 // when we're in a state transition, keep iterating too 959 debugOutput(DEBUG_LEVEL_VERBOSE, "Not running...\n"); 938 960 return true; 939 961 }