Changeset 396
- Timestamp:
- 02/16/07 03:34:07 (16 years ago)
- Files:
-
- branches/streaming-rework/src/bebob/bebob_avdevice.cpp (modified) (1 diff)
- branches/streaming-rework/src/libstreaming/AmdtpStreamProcessor.cpp (modified) (4 diffs)
- branches/streaming-rework/src/libstreaming/AmdtpStreamProcessor.h (modified) (1 diff)
- branches/streaming-rework/src/libstreaming/StreamProcessor.cpp (modified) (3 diffs)
- branches/streaming-rework/src/libstreaming/StreamProcessor.h (modified) (2 diffs)
- branches/streaming-rework/src/libstreaming/StreamProcessorManager.cpp (modified) (5 diffs)
- branches/streaming-rework/src/libstreaming/StreamProcessorManager.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/streaming-rework/src/bebob/bebob_avdevice.cpp
r395 r396 1084 1084 return true; 1085 1085 } 1086 1087 // #define TEST_XMIT_ONLY 1086 1088 1087 1089 #ifdef TEST_XMIT_ONLY branches/streaming-rework/src/libstreaming/AmdtpStreamProcessor.cpp
r395 r396 179 179 } 180 180 #endif 181 debugOutput(DEBUG_LEVEL_VERBOSE,"XMIT TS SET: TS=%10lld, FC=%4d\n",182 ts_head, m_data_buffer->getFrameCounter());181 debugOutput(DEBUG_LEVEL_VERBOSE,"XMIT TS SET: TS=%10lld, LAG=%03d, FC=%4d\n", 182 ts_head, sync_lag_cycles, m_data_buffer->getFrameCounter()); 183 183 } else { 184 184 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, … … 237 237 #endif 238 238 239 #ifdef DEBUG 239 #ifdef DEBUG_OFF 240 240 if((cycle % 1000) == 0) { 241 241 uint32_t timestamp_u=timestamp; … … 628 628 } 629 629 630 bool AmdtpTransmitStreamProcessor::prepareForEnable( ) {630 bool AmdtpTransmitStreamProcessor::prepareForEnable(uint64_t time_to_enable_at) { 631 631 632 632 debugOutput(DEBUG_LEVEL_VERBOSE,"Preparing to enable...\n"); 633 633 634 if (!StreamProcessor::prepareForEnable()) { 634 // for the transmit SP, we have to initialize the 635 // buffer timestamp to something sane, because this timestamp 636 // is used when it is SyncSource 637 638 // the time we initialize to will determine the time at which 639 // the first sample in the buffer will be sent, so we should 640 // make it at least 'time_to_enable_at' 641 642 uint64_t now=m_handler->getCycleTimer(); 643 unsigned int now_secs=CYCLE_TIMER_GET_SECS(now); 644 645 // check if a wraparound on the secs will happen between 646 // now and the time we start 647 if (CYCLE_TIMER_GET_CYCLES(now)>time_to_enable_at) { 648 // the start will happen in the next second 649 now_secs++; 650 if (now_secs>=128) now_secs=0; 651 } 652 653 uint64_t ts_head= now_secs*TICKS_PER_SECOND; 654 ts_head+=time_to_enable_at*TICKS_PER_CYCLE; 655 656 // we also add the nb of cycles we transmit in advance 657 ts_head=addTicks(ts_head, TRANSMIT_ADVANCE_CYCLES*TICKS_PER_CYCLE); 658 659 m_data_buffer->setBufferTailTimestamp(ts_head); 660 661 662 if (!StreamProcessor::prepareForEnable(time_to_enable_at)) { 635 663 debugError("StreamProcessor::prepareForEnable failed\n"); 636 664 return false; … … 1011 1039 } 1012 1040 1013 #ifdef DEBUG 1041 #ifdef DEBUG_OFF 1014 1042 if((cycle % 1000) == 0) { 1015 1043 uint32_t syt = (uint32_t)ntohs(packet->syt); branches/streaming-rework/src/libstreaming/AmdtpStreamProcessor.h
r391 r396 93 93 bool prepareForStart(); 94 94 95 bool prepareForEnable( );95 bool prepareForEnable(uint64_t time_to_enable_at); 96 96 97 97 bool canClientTransferFrames(unsigned int nbframes); branches/streaming-rework/src/libstreaming/StreamProcessor.cpp
r395 r396 129 129 130 130 } 131 132 bool StreamProcessor::prepareForEnable( ) {131 132 bool StreamProcessor::prepareForEnable(uint64_t time_to_enable_at) { 133 133 debugOutput(DEBUG_LEVEL_VERBOSE," StreamProcessor::prepareForEnable for (%p)\n",this); 134 debugOutput(DEBUG_LEVEL_VERBOSE," Now : %011u\n",m_handler->getCycleTimerTicks()); 134 debugOutput(DEBUG_LEVEL_VERBOSE," Now : %011u\n",m_handler->getCycleTimerTicks()); 135 debugOutput(DEBUG_LEVEL_VERBOSE," Enable at : %011u\n",time_to_enable_at); 135 136 m_data_buffer->dumpInfo(); 136 137 return true; … … 139 140 bool StreamProcessor::prepareForDisable() { 140 141 debugOutput(DEBUG_LEVEL_VERBOSE," StreamProcessor::prepareForDisable for (%p)\n",this); 141 debugOutput(DEBUG_LEVEL_VERBOSE," Now : %011u\n",m_handler->getCycleTimerTicks());142 debugOutput(DEBUG_LEVEL_VERBOSE," Now : %011u\n",m_handler->getCycleTimerTicks()); 142 143 m_data_buffer->dumpInfo(); 143 144 return true; … … 235 236 236 237 if (diff<0) { 237 debugWarning("Request to enable streamprocessor %d cycles ago.\n",diff); 238 debugWarning("Request to enable streamprocessor %d cycles ago (now=%llu, cy=%llu).\n", 239 diff,now_cycles,time_to_enable_at); 238 240 } 239 241 #endif branches/streaming-rework/src/libstreaming/StreamProcessor.h
r394 r396 84 84 85 85 bool isRunning(); ///< returns true if there is some stream data processed 86 87 virtual bool prepareForEnable(uint64_t time_to_enable_at); 88 virtual bool prepareForDisable(); 89 86 90 bool enable(uint64_t time_to_enable_at); ///< enable the stream processing 87 91 bool disable(); ///< disable the stream processing … … 103 107 virtual bool prepareForStop() {return true;}; 104 108 virtual bool prepareForStart() {return true;}; 105 106 virtual bool prepareForEnable(); 107 virtual bool prepareForDisable(); 109 108 110 109 111 public: branches/streaming-rework/src/libstreaming/StreamProcessorManager.cpp
r395 r396 395 395 if (enable_at > 8000) enable_at -= 8000; 396 396 397 debugOutput( DEBUG_LEVEL_VERBOSE, " Sync Source StreamProcessor...\n");398 if (!m_SyncSource->prepareForEnable()) {399 debugFatal("Could not prepare Sync Source StreamProcessor for enable()...\n");400 return false;401 }402 403 m_SyncSource->enable(enable_at);404 405 debugOutput( DEBUG_LEVEL_VERBOSE, " All StreamProcessors...\n");406 397 if (!enableStreamProcessors(enable_at)) { 407 398 debugFatal("Could not enable StreamProcessors...\n"); … … 556 547 * @return true if successful, false otherwise 557 548 */ 558 bool StreamProcessorManager::enableStreamProcessors(unsigned int time_to_enable_at) { 549 bool StreamProcessorManager::enableStreamProcessors(uint64_t time_to_enable_at) { 550 debugOutput( DEBUG_LEVEL_VERBOSE, "Enabling StreamProcessors at %llu...\n", time_to_enable_at); 551 552 debugOutput( DEBUG_LEVEL_VERBOSE, " Sync Source StreamProcessor (%p)...\n",m_SyncSource); 553 debugOutput( DEBUG_LEVEL_VERBOSE, " Prepare...\n"); 554 if (!m_SyncSource->prepareForEnable(time_to_enable_at)) { 555 debugFatal("Could not prepare Sync Source StreamProcessor for enable()...\n"); 556 return false; 557 } 558 559 debugOutput( DEBUG_LEVEL_VERBOSE, " Enable...\n"); 560 m_SyncSource->enable(time_to_enable_at); 561 562 debugOutput( DEBUG_LEVEL_VERBOSE, " Other StreamProcessors...\n"); 563 559 564 // we prepare the streamprocessors for enable 560 565 for ( StreamProcessorVectorIterator it = m_ReceiveProcessors.begin(); 561 566 it != m_ReceiveProcessors.end(); 562 ++it ) { 563 (*it)->prepareForEnable(); 567 ++it ) { 568 if(*it != m_SyncSource) { 569 debugOutput( DEBUG_LEVEL_VERBOSE, " Prepare Receive SP (%p)...\n",*it); 570 (*it)->prepareForEnable(time_to_enable_at); 571 } 564 572 } 565 573 … … 567 575 it != m_TransmitProcessors.end(); 568 576 ++it ) { 569 (*it)->prepareForEnable(); 577 if(*it != m_SyncSource) { 578 debugOutput( DEBUG_LEVEL_VERBOSE, " Prepare Transmit SP (%p)...\n",*it); 579 (*it)->prepareForEnable(time_to_enable_at); 580 } 570 581 } 571 582 … … 574 585 it != m_ReceiveProcessors.end(); 575 586 ++it ) { 576 (*it)->enable(time_to_enable_at); 587 if(*it != m_SyncSource) { 588 debugOutput( DEBUG_LEVEL_VERBOSE, " Enable Receive SP (%p)...\n",*it); 589 (*it)->enable(time_to_enable_at); 590 } 577 591 } 578 592 … … 580 594 it != m_TransmitProcessors.end(); 581 595 ++it ) { 582 (*it)->enable(time_to_enable_at); 596 if(*it != m_SyncSource) { 597 debugOutput( DEBUG_LEVEL_VERBOSE, " Enable Transmit SP (%p)...\n",*it); 598 (*it)->enable(time_to_enable_at); 599 } 583 600 } 584 601 branches/streaming-rework/src/libstreaming/StreamProcessorManager.h
r390 r396 70 70 bool unregisterProcessor(StreamProcessor *processor); ///< stop managing a streamprocessor 71 71 72 bool enableStreamProcessors(u nsigned int time_to_enable_at); /// enable registered StreamProcessors72 bool enableStreamProcessors(uint64_t time_to_enable_at); /// enable registered StreamProcessors 73 73 bool disableStreamProcessors(); /// disable registered StreamProcessors 74 74