Changeset 831
- Timestamp:
- 01/10/08 13:15:38 (13 years ago)
- Files:
-
- branches/api-cleanup/config.h.in (modified) (1 diff)
- branches/api-cleanup/src/libieee1394/IsoHandler.cpp (modified) (3 diffs)
- branches/api-cleanup/src/libieee1394/IsoHandlerManager.cpp (modified) (2 diffs)
- branches/api-cleanup/src/libstreaming/amdtp/AmdtpTransmitStreamProcessor.cpp (modified) (2 diffs)
- branches/api-cleanup/src/libstreaming/generic/StreamProcessor.cpp (modified) (7 diffs)
- branches/api-cleanup/src/libstreaming/generic/StreamProcessor.h (modified) (1 diff)
- branches/api-cleanup/src/libstreaming/StreamProcessorManager.cpp (modified) (3 diffs)
- branches/api-cleanup/src/libutil/TimestampedBuffer.cpp (modified) (1 diff)
- branches/api-cleanup/tests/streaming/teststreaming3.cpp (modified) (1 diff)
- branches/api-cleanup/tests/test-ieee1394service.cpp (modified) (1 diff)
- branches/api-cleanup/tests/test-streamdump.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/api-cleanup/config.h.in
r821 r831 68 68 #define STREAMPROCESSORMANAGER_PRESTART_CYCLES_FOR_RECV 0 69 69 #define STREAMPROCESSORMANAGER_SYNCSTART_TRIES 10 70 #define STREAMPROCESSORMANAGER_SYNC_WAIT_TIME_MSEC 200 70 71 #define STREAMPROCESSORMANAGER_ALIGN_AVERAGE_TIME_MSEC 200 71 72 #define STREAMPROCESSORMANAGER_NB_ALIGN_TRIES 40 branches/api-cleanup/src/libieee1394/IsoHandler.cpp
r821 r831 202 202 IsoHandler::Execute() 203 203 { 204 //debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "%p: Execute thread...\n", this);204 debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "%p: Execute thread...\n", this); 205 205 206 206 // bypass if not running … … 273 273 IsoHandler::iterate() { 274 274 // if(m_type==eHT_Receive) { 275 // debugOutput(DEBUG_LEVEL_VER Y_VERBOSE, "(%p, %s) Iterating ISO handler\n",275 // debugOutput(DEBUG_LEVEL_VERBOSE, "(%p, %s) Iterating ISO handler\n", 276 276 // this, (m_type==eHT_Receive?"Receive":"Transmit")); 277 277 // } … … 281 281 #endif 282 282 if(raw1394_loop_iterate(m_handle)) { 283 debugOutput( DEBUG_LEVEL_VERBOSE, 284 "IsoHandler (%p): Failed to iterate handler: %s\n", 283 debugError( "IsoHandler (%p): Failed to iterate handler: %s\n", 285 284 this, strerror(errno)); 286 285 return false; 287 286 } 287 // debugOutput(DEBUG_LEVEL_VERBOSE, "(%p, %s) done iterating ISO handler\n", 288 // this, (m_type==eHT_Receive?"Receive":"Transmit")); 288 289 return true; 289 290 } else { branches/api-cleanup/src/libieee1394/IsoHandlerManager.cpp
r807 r831 378 378 } 379 379 380 max_packet_size = page_size;380 //max_packet_size = page_size; // HACK 381 381 unsigned int irq_interval = packets_per_period / MINIMUM_INTERRUPTS_PER_PERIOD; 382 382 if(irq_interval <= 0) irq_interval=1; … … 395 395 return false; 396 396 } 397 397 398 } else { 398 399 debugFatal("Bad stream type\n"); branches/api-cleanup/src/libstreaming/amdtp/AmdtpTransmitStreamProcessor.cpp
r829 r831 676 676 { 677 677 AmdtpPortInfo *pinfo=dynamic_cast<AmdtpPortInfo *>(*it); 678 debugOutput(DEBUG_LEVEL_VER BOSE, "idx %u: looking at port %s at position %u\n",678 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "idx %u: looking at port %s at position %u\n", 679 679 idx, (*it)->getName().c_str(), pinfo->getPosition()); 680 680 if(pinfo->getPosition() == idx) { … … 707 707 { 708 708 AmdtpPortInfo *pinfo=dynamic_cast<AmdtpPortInfo *>(*it); 709 debugOutput(DEBUG_LEVEL_VER BOSE, "idx %u: looking at port %s at position %u, location %u\n",709 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "idx %u: looking at port %s at position %u, location %u\n", 710 710 idx, (*it)->getName().c_str(), pinfo->getPosition(), pinfo->getLocation()); 711 711 if ((*it)->getPortType() == Port::E_Midi) { branches/api-cleanup/src/libstreaming/generic/StreamProcessor.cpp
r829 r831 68 68 , m_local_node_id ( 0 ) // local cache 69 69 , m_channel( -1 ) 70 , m_dropped(0) 71 , m_last_timestamp(0) 72 , m_last_timestamp2(0) 70 , m_dropped( 0 ) 71 , m_last_timestamp( 0 ) 72 , m_last_timestamp2( 0 ) 73 , m_correct_last_timestamp( false ) 73 74 , m_scratch_buffer( NULL ) 74 75 , m_scratch_buffer_size_bytes( 0 ) … … 133 134 // the waitForClient in IsoHandler will take care of the fact that the frames are 134 135 // not present in time 135 unsigned int packets_to_prebuffer = (getPacketsPerPeriod() * (m_StreamProcessorManager.getNbBuffers())) ;136 unsigned int packets_to_prebuffer = (getPacketsPerPeriod() * (m_StreamProcessorManager.getNbBuffers())) + 10; 136 137 debugOutput(DEBUG_LEVEL_VERBOSE, "Nominal prebuffer: %u\n", packets_to_prebuffer); 137 138 return packets_to_prebuffer; … … 367 368 // check the packet header 368 369 enum eChildReturnValue result = processPacketHeader(data, length, channel, tag, sy, cycle, dropped_cycles); 370 371 // handle dropped cycles 372 if(dropped_cycles) { 373 // make sure the last_timestamp is corrected 374 m_correct_last_timestamp = true; 375 if (m_state == ePS_Running) { 376 // this is an xrun situation 377 m_in_xrun = true; 378 debugWarning("Should update state to WaitingForStreamDisable due to dropped packet xrun\n"); 379 m_cycle_to_switch_state = cycle + 1; // switch in the next cycle 380 m_next_state = ePS_WaitingForStreamDisable; 381 // execute the requested change 382 if (!updateState()) { // we are allowed to change the state directly 383 debugError("Could not update state!\n"); 384 POST_SEMAPHORE; 385 return RAW1394_ISO_ERROR; 386 } 387 } 388 } 389 369 390 if (result == eCRV_OK) { 370 391 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "RECV: CY=%04u TS=%011llu\n", … … 374 395 m_last_dropped = dropped_cycles; 375 396 376 // handle dropped cycles 377 if(dropped_cycles) { 397 if(m_correct_last_timestamp) { 378 398 // they represent a discontinuity in the timestamps, and hence are 379 399 // to be dealt with 380 400 debugWarning("(%p) Correcting timestamp for dropped cycles, discarding packet...\n", this); 381 m_data_buffer->setBufferTailTimestamp(m_last_timestamp); 382 if (m_state == ePS_Running) { 383 // this is an xrun situation 384 m_in_xrun = true; 385 debugWarning("Should update state to WaitingForStreamDisable due to dropped packet xrun\n"); 386 m_cycle_to_switch_state = cycle + 1; // switch in the next cycle 387 m_next_state = ePS_WaitingForStreamDisable; 388 // execute the requested change 389 if (!updateState()) { // we are allowed to change the state directly 390 debugError("Could not update state!\n"); 391 POST_SEMAPHORE; 392 return RAW1394_ISO_ERROR; 393 } 394 } 401 m_data_buffer->setBufferTailTimestamp(substractTicks(m_last_timestamp, getNominalFramesPerPacket() * getTicksPerFrame())); 402 m_correct_last_timestamp = false; 395 403 } 396 404 … … 749 757 } 750 758 751 debugOutput(DEBUG_LEVEL_ ULTRA_VERBOSE, "XMIT EMPTY: CY=%04u\n", cycle);759 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "XMIT EMPTY: CY=%04u\n", cycle); 752 760 generateSilentPacketHeader(data, length, tag, sy, cycle, dropped_cycles, max_length); 753 761 generateSilentPacketData(data, length, tag, sy, cycle, dropped_cycles, max_length); … … 902 910 StreamProcessor::waitForSignal() 903 911 { 912 debugOutput(DEBUG_LEVEL_VERBOSE, "(%p, %s) wait ...\n", this, getTypeString()); 904 913 int result; 905 914 if(m_state == ePS_Running && m_next_state == ePS_Running) { … … 1326 1335 m_ticks_per_frame = ticks_per_frame; 1327 1336 m_local_node_id= m_1394service.getLocalNodeId() & 0x3f; 1337 m_correct_last_timestamp = false; 1328 1338 1329 1339 debugOutput(DEBUG_LEVEL_VERBOSE,"Initializing remote ticks/frame to %f\n", ticks_per_frame); branches/api-cleanup/src/libstreaming/generic/StreamProcessor.h
r829 r831 326 326 uint64_t m_last_timestamp; /// last timestamp (in ticks) 327 327 uint64_t m_last_timestamp2; /// last timestamp (in ticks) 328 uint64_t m_last_timestamp_at_period_ticks; 328 bool m_correct_last_timestamp; 329 uint64_t m_last_timestamp_at_period_ticks; // FIXME: still used? 329 330 330 331 //--- data buffering and accounting branches/api-cleanup/src/libstreaming/StreamProcessorManager.cpp
r821 r831 222 222 debugOutput( DEBUG_LEVEL_VERBOSE, "Putting StreamProcessor streams into dry-running state...\n"); 223 223 debugOutput( DEBUG_LEVEL_VERBOSE, " Schedule start dry-running...\n"); 224 for ( StreamProcessorVectorIterator it = m_ ReceiveProcessors.begin();225 it != m_ ReceiveProcessors.end();224 for ( StreamProcessorVectorIterator it = m_TransmitProcessors.begin(); 225 it != m_TransmitProcessors.end(); 226 226 ++it ) { 227 227 if (!(*it)->isDryRunning()) { … … 234 234 } 235 235 } 236 for ( StreamProcessorVectorIterator it = m_ TransmitProcessors.begin();237 it != m_ TransmitProcessors.end();236 for ( StreamProcessorVectorIterator it = m_ReceiveProcessors.begin(); 237 it != m_ReceiveProcessors.end(); 238 238 ++it ) { 239 239 if (!(*it)->isDryRunning()) { … … 326 326 // DLL to have a decent sync (FIXME: does the DLL get updated when dry-running)? 327 327 debugOutput( DEBUG_LEVEL_VERBOSE, "Waiting for sync...\n"); 328 int nb_sync_runs=20; 328 329 unsigned int nb_sync_runs = (STREAMPROCESSORMANAGER_SYNC_WAIT_TIME_MSEC * getNominalRate()); 330 nb_sync_runs /= 1000; 331 nb_sync_runs /= getPeriodSize(); 332 329 333 int64_t time_till_next_period; 330 334 while(nb_sync_runs--) { // or while not sync-ed? branches/api-cleanup/src/libutil/TimestampedBuffer.cpp
r829 r831 1174 1174 1175 1175 if (diff > max_abs_diff) { 1176 debugShowBackLogLines(100);1176 // debugShowBackLogLines(100); 1177 1177 debugWarning("(%p) difference rather large (+): diff="TIMESTAMP_FORMAT_SPEC", max="TIMESTAMP_FORMAT_SPEC", "TIMESTAMP_FORMAT_SPEC", "TIMESTAMP_FORMAT_SPEC"\n", 1178 1178 this, diff, max_abs_diff, ts, pred_buffer_next_tail_timestamp); 1179 1179 } else if (diff < -max_abs_diff) { 1180 debugShowBackLogLines(100);1180 // debugShowBackLogLines(100); 1181 1181 debugWarning("(%p) difference rather large (-): diff="TIMESTAMP_FORMAT_SPEC", max="TIMESTAMP_FORMAT_SPEC", "TIMESTAMP_FORMAT_SPEC", "TIMESTAMP_FORMAT_SPEC"\n", 1182 1182 this, diff, -max_abs_diff, ts, pred_buffer_next_tail_timestamp); branches/api-cleanup/tests/streaming/teststreaming3.cpp
r821 r831 236 236 { 237 237 run = 0; 238 set_realtime_priority(0);239 238 } 240 239 branches/api-cleanup/tests/test-ieee1394service.cpp
r789 r831 56 56 DECLARE_GLOBAL_DEBUG_MODULE; 57 57 58 #define DIFF_CONSIDERED_LARGE 10000058 #define DIFF_CONSIDERED_LARGE 3072 59 59 int PORT_TO_USE = 0; 60 60 branches/api-cleanup/tests/test-streamdump.cpp
r742 r831 191 191 192 192 if ( pCons->m_iIsoChannel != -1 ) { 193 printf( "disconnect\n"); 193 194 iec61883_cmp_disconnect( pHandle, 194 195 pCons->m_output,