Changeset 493
- Timestamp:
- 07/22/07 16:55:57 (16 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libffado/src/libstreaming/MotuStreamProcessor.cpp
r492 r493 64 64 // too. 65 65 if (CYCLE_TIMER_GET_CYCLES(sph) > now_cycles + 1000) { 66 debugOutput(DEBUG_LEVEL_VERBOSE, "now=%d, ct=%d\n", now_cycles, CYCLE_TIMER_GET_CYCLES(sph));66 //debugOutput(DEBUG_LEVEL_VERBOSE, "now=%d, ct=%d\n", now_cycles, CYCLE_TIMER_GET_CYCLES(sph)); 67 67 if (ts_sec) 68 68 ts_sec--; … … 71 71 } else 72 72 if (now_cycles > CYCLE_TIMER_GET_CYCLES(sph) + 1000) { 73 debugOutput(DEBUG_LEVEL_VERBOSE, "inverted wrap: now=%d, ct=%d\n", now_cycles, CYCLE_TIMER_GET_CYCLES(sph));73 //debugOutput(DEBUG_LEVEL_VERBOSE, "inverted wrap: now=%d, ct=%d\n", now_cycles, CYCLE_TIMER_GET_CYCLES(sph)); 74 74 if (ts_sec == 127) 75 75 ts_sec = 0; … … 193 193 // These are just copied from AmdtpStreamProcessor. At some point we should 194 194 // verify that they make sense for the MOTU. 195 //ts_head = substractTicks(ts_head, TICKS_PER_CYCLE);195 ts_head = substractTicks(ts_head, TICKS_PER_CYCLE); 196 196 // account for the number of cycles we are too late to enable 197 197 ts_head = addTicks(ts_head, cycles_past_enable * TICKS_PER_CYCLE); 198 198 // account for one extra packet of frames 199 //ts_head = substractTicks(ts_head,200 //(uint32_t)((float)n_events * m_SyncSource->m_data_buffer->getRate()));199 ts_head = substractTicks(ts_head, 200 (uint32_t)((float)n_events * m_SyncSource->m_data_buffer->getRate())); 201 201 202 202 m_data_buffer->setBufferTailTimestamp(ts_head); … … 347 347 348 348 float ticks_per_frame = m_SyncSource->m_data_buffer->getRate(); 349 //debugOutput(DEBUG_LEVEL_VERBOSE, "ticks per frame=%10.6f\n",ticks_per_frame); 349 350 for (i=0; i<n_events; i++, quadlet += dbs) { 350 351 //FIXME: not sure which is best for the MOTU … … 1116 1117 m_last_timestamp = sphRecvToFullTicks(last_sph, m_handler->getCycleTimer()); 1117 1118 #endif 1119 //debugOutput(DEBUG_LEVEL_VERBOSE,"ave ticks=%g\n",(m_last_timestamp-m_last_timestamp2)/8.0); 1118 1120 1119 1121 // Signal that we're running … … 1133 1135 // the next (possible) sample is not this one, but lies 1134 1136 // SYT_INTERVAL * rate later 1135 float frame _size=m_framerate<=48000?8:(m_framerate<=96000?16:32);1137 float frames_per_packet=m_framerate<=48000?8:(m_framerate<=96000?16:32); 1136 1138 uint64_t ts=addTicks(m_last_timestamp, 1137 (uint64_t)(frame _size* m_ticks_per_frame));1139 (uint64_t)(frames_per_packet * m_ticks_per_frame)); 1138 1140 // uint64_t ts=addTicks(m_last_timestamp, 1139 1141 // (uint64_t)(m_ticks_per_frame)); … … 1143 1145 // corresponding to the last frame which would have been added to the 1144 1146 // buffer this cycle if we weren't disabled. 1145 if (ts >= 128L* TICKS_PER_SECOND) 1146 ts -= 128L*TICKS_PER_SECOND; 1147 // m_data_buffer->setBufferTailTimestamp(ts); 1148 m_data_buffer->setBufferTailTimestamp(m_last_timestamp); 1147 // 1148 // FIXME: in theory m_last_timestamp is already equal to the 1149 // timestamp of the last frame/sample in this packet since 1150 // that's what we used to set it in the first place. However, 1151 // if m_last_timestamp is used to set the buffer tail we get a 1152 // series of "difference too large" warnings during the early 1153 // stages after enabling. These tend to indicate that the 1154 // buffer timestamp is one packet out. Using ts (which predicts 1155 // the timestamp of the last frame of the *next* packet) seems 1156 // to stop these warnings most of the time and allow for a 1157 // smoother startup. 1158 m_data_buffer->setBufferTailTimestamp(ts); 1159 // m_data_buffer->setBufferTailTimestamp(m_last_timestamp); 1149 1160 //debugOutput(DEBUG_LEVEL_VERBOSE,"%p, last ts=%lld, ts=%lld, lts2=%lld\n", m_data_buffer, m_last_timestamp, ts, m_last_timestamp2); 1150 1161 trunk/libffado/src/libstreaming/StreamProcessorManager.cpp
r480 r493 36 36 #define ENABLE_TIMEOUT_MSEC 4000 37 37 38 #define ENABLE_DELAY_CYCLES 100 38 //#define ENABLE_DELAY_CYCLES 100 39 #define ENABLE_DELAY_CYCLES 1000 39 40 40 41 namespace Streaming { trunk/libffado/src/libutil/TimestampedBuffer.cpp
r445 r493 807 807 m_framecounter += nbframes; 808 808 809 m_buffer_tail_timestamp=m_buffer_next_tail_timestamp; 809 // m_buffer_tail_timestamp=m_buffer_next_tail_timestamp; 810 // m_buffer_next_tail_timestamp += (int64_t)(m_dll_b * err + m_dll_e2); 811 m_buffer_tail_timestamp=ts; 810 812 m_buffer_next_tail_timestamp += (int64_t)(m_dll_b * err + m_dll_e2); 811 813