Changeset 1528
- Timestamp:
- 03/29/09 08:09:27 (15 years ago)
- Files:
-
- branches/libffado-2.0/src/libieee1394/cycletimer.h (modified) (1 diff)
- branches/libffado-2.0/src/libieee1394/IsoHandler.cpp (modified) (1 diff)
- branches/libffado-2.0/src/libstreaming/amdtp/AmdtpReceiveStreamProcessor.cpp (modified) (1 diff)
- branches/libffado-2.0/src/libstreaming/generic/StreamProcessor.cpp (modified) (2 diffs)
- branches/libffado-2.0/src/libstreaming/StreamProcessorManager.cpp (modified) (7 diffs)
- branches/libffado-2.0/src/libstreaming/StreamProcessorManager.h (modified) (1 diff)
- branches/libffado-2.0/src/libutil/Configuration.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/libffado-2.0/src/libieee1394/cycletimer.h
r1247 r1528 119 119 if (x < 0) { 120 120 debugWarning("insufficient wrapping: %lld\n",x); 121 122 debugWarning("correcting...\n"); 123 while (x < 0) { 124 x += TICKS_PER_SECOND * 128L; 125 126 if (x < 0) { 127 debugWarning(" insufficient wrapping: %lld\n",x); 128 } 129 } 130 } 131 121 } 132 122 #endif 133 123 branches/libffado-2.0/src/libieee1394/IsoHandler.cpp
r1526 r1528 523 523 #ifdef DEBUG 524 524 if(skipped) { 525 debugOutput(DEBUG_LEVEL_VER BOSE,525 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, 526 526 "(%p) skipped %d cycles, cycle: %d, last_cycle: %d, dropped: %d\n", 527 527 this, skipped, cycle, m_last_cycle, dropped); branches/libffado-2.0/src/libstreaming/amdtp/AmdtpReceiveStreamProcessor.cpp
r1525 r1528 45 45 , m_nb_audio_ports( 0 ) 46 46 , m_nb_midi_ports( 0 ) 47 48 47 {} 49 48 branches/libffado-2.0/src/libstreaming/generic/StreamProcessor.cpp
r1526 r1528 737 737 fs_nom, fs_syt, fs_diff, fs_diff_norm); 738 738 } 739 } 740 741 int ticks_per_packet = (int)(getTicksPerFrame() * getNominalFramesPerPacket()); 742 int diff = diffTicks(m_last_timestamp, m_last_timestamp2); 743 // display message if the difference between two successive tick 744 // values is more than 50 ticks. 1 sample at 48k is 512 ticks 745 // so 50 ticks = 10%, which is a rather large jitter value. 746 if(diff-ticks_per_packet > 50 || diff-ticks_per_packet < -50) { 747 debugOutput(DEBUG_LEVEL_VERBOSE, 748 "cy %04d, rather large TSP difference TS=%011llu => TS=%011llu (%d, nom %d)\n", 749 CYCLE_TIMER_GET_CYCLES(pkt_ctr), m_last_timestamp2, 750 m_last_timestamp, diff, ticks_per_packet); 751 } 752 debugOutputExtreme(DEBUG_LEVEL_VERY_VERBOSE, 753 "%04d %011llu %011llu %d %d\n", 754 CYCLE_TIMER_GET_CYCLES(pkt_ctr), m_last_timestamp2, 755 m_last_timestamp, diff, ticks_per_packet); 739 int ticks_per_packet = (int)(getTicksPerFrame() * getNominalFramesPerPacket()); 740 int diff = diffTicks(m_last_timestamp, m_last_timestamp2); 741 // display message if the difference between two successive tick 742 // values is more than 50 ticks. 1 sample at 48k is 512 ticks 743 // so 50 ticks = 10%, which is a rather large jitter value. 744 if(diff-ticks_per_packet > 50 || diff-ticks_per_packet < -50) { 745 debugOutput(DEBUG_LEVEL_VERBOSE, 746 "cy %04d, rather large TSP difference TS=%011llu => TS=%011llu (%d, nom %d)\n", 747 CYCLE_TIMER_GET_CYCLES(pkt_ctr), m_last_timestamp2, 748 m_last_timestamp, diff, ticks_per_packet); 749 } 750 debugOutputExtreme(DEBUG_LEVEL_VERY_VERBOSE, 751 "%04d %011llu %011llu %d %d\n", 752 CYCLE_TIMER_GET_CYCLES(pkt_ctr), m_last_timestamp2, 753 m_last_timestamp, diff, ticks_per_packet); 754 } 756 755 #endif 757 756 … … 1607 1606 m_local_node_id = m_1394service.getLocalNodeId() & 0x3f; 1608 1607 m_data_buffer->setTransparent(false); 1608 m_last_timestamp2 = 0; // NOTE: no use in checking if we just started running 1609 1609 break; 1610 1610 default: branches/libffado-2.0/src/libstreaming/StreamProcessorManager.cpp
r1452 r1528 41 41 42 42 StreamProcessorManager::StreamProcessorManager(DeviceManager &p) 43 : m_is_slave( false ) 43 : m_time_of_transfer ( 0 ) 44 #ifdef DEBUG 45 , m_time_of_transfer2 ( 0 ) 46 #endif 47 , m_is_slave( false ) 44 48 , m_SyncSource(NULL) 45 49 , m_parent( p ) … … 61 65 StreamProcessorManager::StreamProcessorManager(DeviceManager &p, unsigned int period, 62 66 unsigned int framerate, unsigned int nb_buffers) 63 : m_is_slave( false ) 67 : m_time_of_transfer ( 0 ) 68 #ifdef DEBUG 69 , m_time_of_transfer2 ( 0 ) 70 #endif 71 , m_is_slave( false ) 64 72 , m_SyncSource(NULL) 65 73 , m_parent( p ) … … 533 541 // 1394 time 534 542 543 float syncrate = 0.0; 544 float tpf = m_SyncSource->getTicksPerFrame(); 545 if (tpf > 0.0) { 546 syncrate = 24576000.0/tpf; 547 } else { 548 debugWarning("tpf <= 0? %f\n", tpf); 549 } 550 debugOutput( DEBUG_LEVEL_VERBOSE, " sync source frame rate: %f fps (%f tpf)\n", syncrate, tpf); 551 535 552 // we now should have decent sync info on the sync source 536 553 // determine a point in time where the system should start … … 555 572 (unsigned int)TICKS_TO_OFFSET(time_of_first_sample)); 556 573 574 #ifdef DEBUG 575 // the time at which the previous period would have passed is the 576 // time of the first sample received, minus one frame. 577 //m_time_of_transfer2 = substractTicks(time_of_first_sample, (uint64_t)m_SyncSource->getTicksPerFrame()); 578 m_time_of_transfer2 = time_of_first_sample; 579 #endif 580 557 581 // we should start wet-running the transmit SP's some cycles in advance 558 582 // such that we know it is wet-running when it should output its first sample 559 uint64_t time_to_start_xmit = substractTicks(time_of_first_sample, 583 uint64_t time_to_start_xmit = substractTicks(time_of_first_sample, 560 584 prestart_cycles_for_xmit * TICKS_PER_CYCLE); 561 585 … … 620 644 // note: the SP's are scheduled to start in STREAMPROCESSORMANAGER_CYCLES_FOR_STARTUP cycles, 621 645 // so a 20 times this value should be a good timeout 622 int cnt = cycles_for_startup * 20; // by then it should have started 646 //int cnt = cycles_for_startup * 20; // by then it should have started 647 // or maybe we just have to use 1 second, as this wraps the cycle counter 648 int cnt = 8000; 623 649 while (!m_SyncSource->isRunning() && cnt) { 624 650 SleepRelativeUsec(125); … … 635 661 // and a (still very rough) approximation of the rate 636 662 float rate = m_SyncSource->getTicksPerFrame(); 637 int64_t delay_in_ticks =(int64_t)(((float)((m_nb_buffers-1) * m_period)) * rate);663 int64_t delay_in_ticks = (int64_t)(((float)((m_nb_buffers-1) * m_period)) * rate); 638 664 // also add the sync delay 639 delay_in_ticks += m_SyncSource->getSyncDelay();665 delay_in_ticks = addTicks(delay_in_ticks, m_SyncSource->getSyncDelay()); 640 666 debugOutput( DEBUG_LEVEL_VERBOSE, " initial time of transfer %010lld, rate %f...\n", 641 667 m_time_of_transfer, rate); 668 642 669 643 670 // then use this information to initialize the xmit handlers … … 1090 1117 1091 1118 #ifdef DEBUG 1092 static uint64_t m_time_of_transfer2 = m_time_of_transfer;1119 int ticks_per_period = (int)(m_SyncSource->getTicksPerFrame() * m_period); 1093 1120 1094 int ticks_per_period = (int)(m_SyncSource->getTicksPerFrame() * m_period); 1095 int diff=diffTicks(m_time_of_transfer, m_time_of_transfer2); 1121 int diff = diffTicks(m_time_of_transfer, m_time_of_transfer2); 1096 1122 // display message if the difference between two successive tick 1097 1123 // values is more than 50 ticks. 1 sample at 48k is 512 ticks branches/libffado-2.0/src/libstreaming/StreamProcessorManager.h
r1452 r1528 141 141 // for the transmit SP's 142 142 uint64_t m_time_of_transfer; 143 #ifdef DEBUG 144 uint64_t m_time_of_transfer2; 145 #endif 143 146 144 147 public: branches/libffado-2.0/src/libutil/Configuration.cpp
r1525 r1528 64 64 return false; 65 65 } catch (ParseException& e) { 66 debug Output(DEBUG_LEVEL_VERBOSE,"Could not parse file: %s\n", filename.c_str());66 debugWarning("Could not parse file: %s\n", filename.c_str()); 67 67 delete c; 68 68 return false; 69 69 } catch (...) { 70 debug Output(DEBUG_LEVEL_VERBOSE,"Unknown exception when opening file: %s\n", filename.c_str());70 debugWarning("Unknown exception when opening file: %s\n", filename.c_str()); 71 71 delete c; 72 72 return false;