Changeset 776
- Timestamp:
- 12/26/07 07:26:00 (15 years ago)
- Files:
-
- trunk/libffado/src/debugmodule/debugmodule.h (modified) (1 diff)
- trunk/libffado/src/libieee1394/IsoHandler.cpp (modified) (2 diffs)
- trunk/libffado/src/libieee1394/IsoHandlerManager.cpp (modified) (2 diffs)
- trunk/libffado/src/libieee1394/IsoHandlerManager.h (modified) (1 diff)
- trunk/libffado/src/libstreaming/amdtp/AmdtpTransmitStreamProcessor.cpp (modified) (2 diffs)
- trunk/libffado/src/libstreaming/generic/StreamProcessor.cpp (modified) (2 diffs)
- trunk/libffado/src/libstreaming/StreamProcessorManager.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libffado/src/debugmodule/debugmodule.h
r742 r776 53 53 #define MB_BUFFERSIZE DEBUG_MAX_MESSAGE_LENGTH 54 54 55 //#define IMPLEMENT_BACKLOG55 #define IMPLEMENT_BACKLOG 56 56 #ifdef IMPLEMENT_BACKLOG 57 57 // the backlog is a similar buffer as the message buffer 58 58 #define BACKLOG_MB_BUFFERS (256) 59 59 #define BACKLOG_MB_NEXT(index) (((index)+1) & (BACKLOG_MB_BUFFERS-1)) 60 #define BACKLOG_MIN_LEVEL DEBUG_LEVEL_VER BOSE60 #define BACKLOG_MIN_LEVEL DEBUG_LEVEL_VERY_VERBOSE 61 61 #endif 62 62 trunk/libffado/src/libieee1394/IsoHandler.cpp
r759 r776 183 183 } 184 184 185 #ifdef DO_POLL 185 186 uint64_t poll_enter = m_manager.get1394Service().getCurrentTimeAsUsecs(); 186 187 err = poll(&m_poll_fd, 1, m_poll_timeout); … … 215 216 (this->getType()==eHT_Receive?'R':'X'), this, 216 217 poll_exit-poll_enter, iter_exit-iter_enter); 218 #else 219 // iterate itself blocks if nothing is available 220 // so poll'ing is not really necessary 221 bool result = iterate(); 222 usleep(125); 223 return result; 224 #endif 217 225 return true; 218 226 } trunk/libffado/src/libieee1394/IsoHandlerManager.cpp
r767 r776 356 356 if(irq_interval <= 0) irq_interval=1; 357 357 // FIXME: test 358 irq_interval=1;358 // irq_interval=1; 359 359 360 360 #else … … 440 440 debugError("Max packet size too large! (%d)\n", stream->getMaxPacketSize()); 441 441 } 442 irq_interval=2;442 // irq_interval=2; 443 443 #endif 444 444 // the SP specifies how many packets to buffer trunk/libffado/src/libieee1394/IsoHandlerManager.h
r767 r776 34 34 #include <vector> 35 35 36 //#define THREAD_PER_ISOHANDLER36 #define THREAD_PER_ISOHANDLER 37 37 38 38 #define FFADO_MAX_ISO_HANDLERS_PER_PORT 16 trunk/libffado/src/libstreaming/amdtp/AmdtpTransmitStreamProcessor.cpp
r766 r776 162 162 else 163 163 { 164 unsigned int now_cycle = ( unsigned int ) ( TICKS_TO_CYCLES ( m_1394service.getCycleTimerTicks() ) ); 165 164 166 debugOutput ( DEBUG_LEVEL_VERBOSE, 165 "Insufficient frames (NP): N=%02d, CY=%04u, TC=%04u, CUT=%04d\n", 166 fc, cycle, transmit_at_cycle, cycles_until_transmit ); 167 debugWarning( "Insufficient frames (NP): N=%02d, CY=%04u, TC=%04u, CUT=%04d\n", 168 fc, cycle, transmit_at_cycle, cycles_until_transmit ); 167 "Insufficient frames (NP): N=%02d, CY=%04u, TC=%04u, CUT=%04d, NOW=%04d\n", 168 fc, cycle, transmit_at_cycle, cycles_until_transmit, now_cycle ); 169 debugWarning("Insufficient frames (NP): N=%02d, CY=%04u, TC=%04u, CUT=%04d, NOW=%04d\n", 170 fc, cycle, transmit_at_cycle, cycles_until_transmit, now_cycle ); 171 169 172 // there is still time left to send the packet 170 173 // we want the system to give this packet another go at a later time instant … … 213 216 transmit_at_cycle, cycles_until_transmit, 214 217 presentation_time, (unsigned int)TICKS_TO_CYCLES(presentation_time) ); 215 218 debugShowBackLogLines(200); 219 flushDebugOutput(); 216 220 // however, if we can send this sufficiently before the presentation 217 221 // time, it could be harmless. trunk/libffado/src/libstreaming/generic/StreamProcessor.cpp
r775 r776 113 113 // however we have to take into account the fact that there is some sync delay (unknown at this point) 114 114 packets_to_prebuffer -= 16; //FIXME: magic 115 116 // only queue a part (80%) of the theoretical max in order not to have too much 'not ready' cycles 117 packets_to_prebuffer = (packets_to_prebuffer * 8000) / 10000; 115 118 116 119 return packets_to_prebuffer; … … 615 618 } 616 619 } 617 usleep(125); // only when using thread per handler mode! 618 return RAW1394_ISO_AGAIN; 620 // return RAW1394_ISO_AGAIN; 621 generateSilentPacketHeader(data, length, tag, sy, cycle, dropped_cycles, max_length); 622 generateSilentPacketData(data, length, tag, sy, cycle, dropped_cycles, max_length); 623 return RAW1394_ISO_DEFER; 619 624 } else { 620 625 debugError("Invalid return value: %d\n", result); trunk/libffado/src/libstreaming/StreamProcessorManager.cpp
r766 r776 410 410 // wait for the syncsource to start running. 411 411 // that will block the waitForPeriod call until everyone has started (theoretically) 412 int cnt = CYCLES_FOR_STARTUP * 2 ; // by then it should have started412 int cnt = CYCLES_FOR_STARTUP * 20; // by then it should have started 413 413 while (!m_SyncSource->isRunning() && cnt) { 414 414 usleep(125); … … 432 432 StreamProcessorManager::alignReceivedStreams() 433 433 { 434 #define NB_PERIODS_FOR_ALIGN_AVERAGE 20435 #define NB_ALIGN_TRIES 20434 #define ALIGN_AVERAGE_TIME_MSEC 200 435 #define NB_ALIGN_TRIES 40 436 436 debugOutput( DEBUG_LEVEL_VERBOSE, "Aligning received streams...\n"); 437 437 unsigned int nb_sync_runs; … … 442 442 unsigned int i; 443 443 444 unsigned int periods_per_align_try = (ALIGN_AVERAGE_TIME_MSEC * getNominalRate()); 445 periods_per_align_try /= 1000; 446 periods_per_align_try /= getPeriodSize(); 447 debugOutput( DEBUG_LEVEL_VERBOSE, " averaging over %u periods...\n", periods_per_align_try); 448 444 449 bool aligned = false; 445 450 int cnt = NB_ALIGN_TRIES; 446 451 while (!aligned && cnt--) { 447 nb_sync_runs = NB_PERIODS_FOR_ALIGN_AVERAGE;452 nb_sync_runs = periods_per_align_try; 448 453 while(nb_sync_runs) { 449 454 debugOutput( DEBUG_LEVEL_VERY_VERBOSE, " check (%d)...\n", nb_sync_runs); … … 456 461 debugOutput( DEBUG_LEVEL_VERY_VERBOSE, " offset between SyncSP %p and SP %p is %lld ticks...\n", 457 462 m_SyncSource, s, diff); 458 if ( nb_sync_runs == NB_PERIODS_FOR_ALIGN_AVERAGE) {463 if ( nb_sync_runs == periods_per_align_try ) { 459 464 diff_between_streams[i] = diff; 460 465 } else { … … 475 480 StreamProcessor *s = m_ReceiveProcessors.at(i); 476 481 477 diff_between_streams[i] /= NB_PERIODS_FOR_ALIGN_AVERAGE;482 diff_between_streams[i] /= periods_per_align_try; 478 483 diff_between_streams_frames[i] = (int)roundf(diff_between_streams[i] / s->getTicksPerFrame()); 479 484 debugOutput( DEBUG_LEVEL_VERBOSE, " avg offset between SyncSP %p and SP %p is %lld ticks, %d frames...\n",