- Timestamp:
- 02/17/07 15:05:37 (17 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/streaming-rework/src/libstreaming/AmdtpStreamProcessor.cpp
r401 r402 36 36 #include <assert.h> 37 37 38 #define RECEIVE_PROCESSING_DELAY (TICKS_PER_CYCLE * 2)39 40 38 // in ticks 41 39 #define TRANSMIT_TRANSFER_DELAY 6000U … … 127 125 int now_cycles = (int)CYCLE_TIMER_GET_CYCLES(ctr); 128 126 129 // the difference between 'now' andthe cycle this130 // packet is intended for 127 // the difference between the cycle this 128 // packet is intended for and 'now' 131 129 int cycle_diff = substractCycles(cycle, now_cycles); 132 130 … … 175 173 176 174 #ifdef DEBUG 177 if ((unsigned int)m_data_buffer->getFrameCounter() != m_ ringbuffer_size_frames) {178 debugWarning("m_data_buffer->getFrameCounter() != m_ ringbuffer_size_frames\n");175 if ((unsigned int)m_data_buffer->getFrameCounter() != m_data_buffer->getBufferSize()) { 176 debugWarning("m_data_buffer->getFrameCounter() != m_data_buffer->getBufferSize()\n"); 179 177 } 180 178 #endif … … 323 321 } else { // there is no more data in the ringbuffer 324 322 325 // TODO: maybe we have to be a little smarter here326 // because we have some slack on the device side (TRANSFER_DELAY)327 // we can allow some skipped packets328 323 debugWarning("Transmit buffer underrun (now %d, queue %d, target %d)\n", 329 324 now_cycles, cycle, TICKS_TO_CYCLES(ts)); … … 471 466 m_ticks_per_frame = (TICKS_PER_SECOND*1.0) / ((float)m_framerate); 472 467 473 // allocate the eventbuffer468 // initialize internal buffer 474 469 m_ringbuffer_size_frames=m_nb_buffers * m_period; 475 470 … … 952 947 } 953 948 949 // check if this is a valid packet 954 950 if((packet->syt != 0xFFFF) 955 951 && (packet->fdf != 0xFF) … … 1062 1058 int AmdtpReceiveStreamProcessor::getMinimalSyncDelay() { 1063 1059 return (int)(m_handler->getWakeupInterval() * m_syt_interval * m_ticks_per_frame); 1064 // return RECEIVE_PROCESSING_DELAY; 1065 } 1066 1067 void AmdtpReceiveStreamProcessor::dumpInfo() 1068 { 1069 1060 } 1061 1062 void AmdtpReceiveStreamProcessor::dumpInfo() { 1070 1063 StreamProcessor::dumpInfo(); 1071 1072 } 1073 1064 } 1074 1065 1075 1066 void AmdtpReceiveStreamProcessor::setVerboseLevel(int l) { 1076 1067 setDebugLevel(l); 1077 ReceiveStreamProcessor::setVerboseLevel(l); 1078 1068 ReceiveStreamProcessor::setVerboseLevel(l); 1079 1069 } 1080 1070 … … 1090 1080 // the result is that we get some extra time before period boundaries 1091 1081 // are signaled. 1092 // The RECEIVE_PROCESSING_DELAY directly introduces some slack 1093 // the other term handles the fact that the linux1394 stack does some 1094 // buffering. This buffering causes the packets to be received at max 1082 // ISO buffering causes the packets to be received at max 1095 1083 // m_handler->getWakeupInterval() later than the time they were received. 1096 1084 // hence their payload is available this amount of time later. However, the … … 1154 1142 debugOutput(DEBUG_LEVEL_VERBOSE,"Initializing remote ticks/frame to %f\n",m_ticks_per_frame); 1155 1143 1156 // allocate the eventbuffer1144 // initialize internal buffer 1157 1145 unsigned int ringbuffer_size_frames=m_nb_buffers * m_period; 1158 1159 // add the processing delay1160 debugOutput(DEBUG_LEVEL_VERBOSE,"Adding %u frames of SYT slack buffering...\n",1161 (uint)(RECEIVE_PROCESSING_DELAY/m_ticks_per_frame));1162 ringbuffer_size_frames+=(uint)(RECEIVE_PROCESSING_DELAY/m_ticks_per_frame);1163 1146 1164 1147 assert(m_data_buffer); … … 1173 1156 m_data_buffer->setWrapValue(128L*TICKS_PER_SECOND); 1174 1157 1175 // offset is in reset()1176 1177 1158 m_data_buffer->prepare(); 1178 1159 … … 1234 1215 break; 1235 1216 } 1236 1237 1217 } 1238 1218