Changeset 1037
- Timestamp:
- 04/25/08 12:07:32 (14 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libffado/src/libstreaming/amdtp/AmdtpReceiveStreamProcessor.cpp
r1036 r1037 94 94 uint32_t pkt_ctr) 95 95 { 96 #ifdef DEBUG97 static uint32_t now_prev=0;98 static uint64_t now_prev_ticks=0;99 #endif100 101 96 struct iec61883_packet *packet = (struct iec61883_packet *) data; 102 97 assert(packet); 103 98 bool ok = (packet->syt != 0xFFFF) && 104 105 106 107 99 (packet->fdf != 0xFF) && 100 (packet->fmt == 0x10) && 101 (packet->dbs > 0) && 102 (length >= 2*sizeof(quadlet_t)); 108 103 if(ok) { 104 m_last_timestamp = sytRecvToFullTicks2((uint32_t)ntohs(packet->syt), pkt_ctr); 105 //#ifdef DEBUG 106 #if 0 109 107 uint32_t now = m_1394service.getCycleTimer(); 110 108 111 #ifdef DEBUG 112 uint64_t now_ticks = CYCLE_TIMER_TO_TICKS(now); 113 114 if (diffTicks(now_ticks, now_prev_ticks) < 0) { 115 debugWarning("non-monotonic CTR on cycle %04u: %llu -> %llu\n", 116 CYCLE_TIMER_GET_CYCLES(pkt_ctr), now_prev_ticks, now_ticks); 117 debugWarning(" : %08X -> %08X\n", now_prev, now); 118 debugOutput ( DEBUG_LEVEL_VERBOSE, 119 " current: %011llu (%03us %04ucy %04uticks)\n", 120 now, 121 (unsigned int)TICKS_TO_SECS( now ), 122 (unsigned int)TICKS_TO_CYCLES( now ), 123 (unsigned int)TICKS_TO_OFFSET( now ) ); 124 debugOutput ( DEBUG_LEVEL_VERBOSE, 125 " prev : %011llu (%03us %04ucy %04uticks)\n", 126 now_prev, 127 (unsigned int)TICKS_TO_SECS( now_prev ), 128 (unsigned int)TICKS_TO_CYCLES( now_prev ), 129 (unsigned int)TICKS_TO_OFFSET( now_prev ) ); 130 } 131 now_prev = now; 132 now_prev_ticks=now_ticks; 109 //=> convert the SYT to a full timestamp in ticks 110 uint64_t old_last_timestamp = sytRecvToFullTicks((uint32_t)ntohs(packet->syt), 111 CYCLE_TIMER_GET_CYCLES(pkt_ctr), now); 112 if(m_last_timestamp != old_last_timestamp) { 113 debugWarning("discepancy between timestamp calculations\n"); 114 } 133 115 #endif 134 135 //=> convert the SYT to a full timestamp in ticks136 m_last_timestamp = sytRecvToFullTicks((uint32_t)ntohs(packet->syt),137 CYCLE_TIMER_GET_CYCLES(pkt_ctr), now);138 116 } 139 117 return (ok ? eCRV_OK : eCRV_Invalid ); trunk/libffado/src/libstreaming/amdtp/AmdtpTransmitStreamProcessor.cpp
r1036 r1037 93 93 // the base timestamp is the one of the next sample in the buffer 94 94 ffado_timestamp_t ts_head_tmp; 95 m_data_buffer->getBufferHeadTimestamp 95 m_data_buffer->getBufferHeadTimestamp( &ts_head_tmp, &fc ); // thread safe 96 96 97 97 // the timestamp gives us the time at which we want the sample block … … 100 100 101 101 // now we calculate the time when we have to transmit the sample block 102 transmit_at_time = substractTicks 102 transmit_at_time = substractTicks( presentation_time, AMDTP_TRANSMIT_TRANSFER_DELAY ); 103 103 104 104 // calculate the cycle this block should be presented in