- Timestamp:
- 01/01/08 11:31:39 (16 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libffado/src/libstreaming/generic/StreamProcessor.cpp
r795 r796 21 21 * 22 22 */ 23 24 #include "config.h" 23 25 24 26 #include "StreamProcessor.h" … … 112 114 // in the transmit buffer (the others are still to be put into the xmit frame buffer) 113 115 unsigned int packets_to_prebuffer = (getPacketsPerPeriod() * (m_StreamProcessorManager.getNbBuffers()-1)); 116 debugOutput(DEBUG_LEVEL_VERBOSE, "Nominal prebuffer: %u\n", packets_to_prebuffer); 114 117 115 // however we have to take into account the fact that there is some sync delay (unknown at this point) 116 packets_to_prebuffer -= 16; //FIXME: magic 118 // however we have to take into account the fact that there is some sync delay 119 // we assume that the SPM has indicated 120 // HACK: this counts on the fact that the latency for this stream will be the same as the 121 // latency for the receive sync source 122 unsigned int est_sync_delay = getPacketsPerPeriod() / MINIMUM_INTERRUPTS_PER_PERIOD; 123 est_sync_delay += STREAMPROCESSORMANAGER_SIGNAL_DELAY_TICKS / TICKS_PER_CYCLE; 124 packets_to_prebuffer -= est_sync_delay; 125 debugOutput(DEBUG_LEVEL_VERBOSE, " correct for sync delay (%d): %u\n", 126 est_sync_delay, 127 packets_to_prebuffer); 117 128 118 // 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 * 7000) / 10000; 129 // only queue a part (70%) of the theoretical max in order not to have too much 'not ready' cycles 130 packets_to_prebuffer = (packets_to_prebuffer * MAX_ISO_XMIT_BUFFER_FILL_PCT * 1000) / 100000; 131 debugOutput(DEBUG_LEVEL_VERBOSE, " reduce to %d%%: %u\n", 132 MAX_ISO_XMIT_BUFFER_FILL_PCT, packets_to_prebuffer); 120 133 121 134 return packets_to_prebuffer;