Changeset 411

Show
Ignore:
Timestamp:
02/21/07 14:25:53 (17 years ago)
Author:
pieterpalmers
Message:

cycletimer.h:
- some extra operations on Ticks (diffTicks & substractTicks)

StreamProcessor?.cpp
AmdtpStreamProcessor?.cpp
MotuStreamProcessor?.cpp:
- Moved the syncDelay to StreamProcessor::getTimeUntilNextPeriodSignalUsecs(). This delay should be the delay between the actual period boundary and the time it is reported to the SPManager. Therefore it's place is not as a buffer offset, but in the calculation of the signalling time.
This makes that the buffer timestamps correspond to 'real' timestamps. These might have to be manipulated by the transmit or receive handles to account for e.g. iso buffering etc..., but at least the timestamps themselves have a well-defined meaning now.

StreamProcessorManager?.cpp:
- The only stream that needs to be running is the sync source stream. It is assumed that the other streams start running in time. 'In time' is currently about 2000 cycles afterwards.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/streaming-rework/src/libfreebobavc/ieee1394service.cpp

    r408 r411  
    11/* ieee1394service.cpp 
    22 * Copyright (C) 2005,07 by Daniel Wagner 
     3 * Copyright (C) 2007 by Pieter Palmers 
    34 * 
    45 * This file is part of FreeBoB. 
     
    3233#include <iomanip> 
    3334 
    34 IMPL_DEBUG_MODULE( Ieee1394Service, Ieee1394Service, DEBUG_LEVEL_NORMAL ); 
     35IMPL_DEBUG_MODULE( Ieee1394Service, Ieee1394Service, DEBUG_LEVEL_VERBOSE ); 
    3536 
    3637Ieee1394Service::Ieee1394Service() 
     
    379380 */ 
    380381signed int Ieee1394Service::allocateIsoChannelGeneric(unsigned int bandwidth) { 
     382    debugOutput(DEBUG_LEVEL_VERBOSE, "Allocating ISO channel using generic method...\n" ); 
     383     
    381384    struct ChannelInfo cinfo; 
    382385 
     
    433436    ) { 
    434437 
     438    debugOutput(DEBUG_LEVEL_VERBOSE, "Allocating ISO channel using IEC61883 CMP...\n" ); 
     439     
    435440    struct ChannelInfo cinfo; 
    436441     
     
    482487 */ 
    483488bool Ieee1394Service::freeIsoChannel(signed int c) { 
     489    debugOutput(DEBUG_LEVEL_VERBOSE, "Freeing ISO channel %d...\n", c ); 
    484490     
    485491    if (c < 0 || c > 63) { 
    486         debugWarning("Invalid channel number: %d", c); 
     492        debugWarning("Invalid channel number: %d\n", c); 
    487493        return false; 
    488494    } 
     
    490496    switch (m_channels[c].alloctype) { 
    491497        default: 
    492             debugError("BUG: invalid allocation type!\n"); 
     498            debugError(" BUG: invalid allocation type!\n"); 
    493499            return false; 
    494500             
    495501        case AllocFree:  
    496             debugWarning("Channel %d not registered\n", c); 
     502            debugWarning(" Channel %d not registered\n", c); 
    497503            return false; 
    498504             
    499505        case AllocGeneric: 
     506            debugOutput(DEBUG_LEVEL_VERBOSE, " allocated using generic routine...\n" ); 
    500507            if (unregisterIsoChannel(c)) { 
    501508                return false; 
    502509            } else { 
     510                debugOutput(DEBUG_LEVEL_VERBOSE, " freeing %d bandwidth units...\n", m_channels[c].bandwidth ); 
    503511                if (raw1394_bandwidth_modify(m_handle, m_channels[c].bandwidth, RAW1394_MODIFY_FREE) !=0) { 
    504512                    debugWarning("Failed to deallocate bandwidth\n"); 
    505513                } 
     514                debugOutput(DEBUG_LEVEL_VERBOSE, " freeing channel %d...\n", m_channels[c].channel ); 
    506515                if (raw1394_channel_modify (m_handle, m_channels[c].channel, RAW1394_MODIFY_FREE) != 0) { 
    507516                    debugWarning("Failed to free channel\n"); 
     
    511520             
    512521        case AllocCMP: 
     522            debugOutput(DEBUG_LEVEL_VERBOSE, " allocated using IEC61883 CMP...\n" ); 
    513523            if (unregisterIsoChannel(c)) { 
    514524                return false; 
    515525            } else { 
     526                debugOutput(DEBUG_LEVEL_VERBOSE, " performing IEC61883 CMP disconnect...\n" ); 
    516527                if(iec61883_cmp_disconnect( 
    517528                        m_handle,  
  • branches/streaming-rework/src/libstreaming/AmdtpStreamProcessor.cpp

    r407 r411  
    126126    // the difference between the cycle this 
    127127    // packet is intended for and 'now' 
    128     int cycle_diff = substractCycles(cycle, now_cycles); 
     128    int cycle_diff = diffCycles(cycle, now_cycles); 
    129129     
    130130#ifdef DEBUG 
     
    139139    // to be 'running' 
    140140    // NOTE: this works only at startup 
    141     if (!m_running && cycle_diff >= 0 && cycle != -1) { 
     141    if (!m_running && cycle_diff >= 0 && cycle >= 0) { 
    142142            debugOutput(DEBUG_LEVEL_VERBOSE, "Xmit StreamProcessor %p started running at cycle %d\n",this, cycle); 
    143143            m_running=true; 
     
    157157            // the number of cycles the sync source lags (> 0) 
    158158            // or leads (< 0) 
    159             int sync_lag_cycles=substractCycles(cycle, m_SyncSource->getLastCycle()); 
     159            int sync_lag_cycles=diffCycles(cycle, m_SyncSource->getLastCycle()); 
    160160             
    161161            // account for the cycle lag between sync SP and this SP 
     
    167167            // therefore sync_lag_cycles * TICKS_PER_CYCLE earlier than 
    168168            // T1. 
    169             ts_head = addTicks(ts_head, sync_lag_cycles * TICKS_PER_CYCLE); 
    170              
     169            ts_head = addTicks(ts_head, (sync_lag_cycles) * TICKS_PER_CYCLE); 
     170             
     171            ts_head = substractTicks(ts_head, TICKS_PER_CYCLE); 
     172             
     173            // account for one extra packet of frames 
     174            ts_head = substractTicks(ts_head,  
     175                        (uint32_t)((float)m_syt_interval * m_SyncSource->m_data_buffer->getRate())); 
     176 
    171177            m_data_buffer->setBufferHeadTimestamp(ts_head); 
    172              
     178 
    173179            #ifdef DEBUG 
    174180            if ((unsigned int)m_data_buffer->getFrameCounter() != m_data_buffer->getBufferSize()) { 
     
    176182            } 
    177183            #endif 
    178             debugOutput(DEBUG_LEVEL_VERBOSE,"XMIT TS SET: TS=%10lld, LAG=%03d, FC=%4d\n", 
     184            debugOutput(DEBUG_LEVEL_VERBOSE,"XMIT TS SET: TS=%10llu, LAG=%03d, FC=%4d\n", 
    179185                            ts_head, sync_lag_cycles, m_data_buffer->getFrameCounter()); 
    180186        } else { 
     
    202208    // packet is sent, unless TRANSFER_DELAY > 3072. 
    203209    // this means that we need at least one cycle of extra buffering. 
    204     uint64_t ticks_to_advance = TICKS_PER_CYCLE * TRANSMIT_ADVANCE_CYCLES; 
     210    uint32_t ticks_to_advance = TICKS_PER_CYCLE * TRANSMIT_ADVANCE_CYCLES; 
    205211     
    206212    // if cycle lies cycle_diff cycles in the future, we should 
     
    210216 
    211217    // determine the 'now' time in ticks 
    212     uint64_t cycle_timer=CYCLE_TIMER_TO_TICKS(ctr); 
     218    uint32_t cycle_timer=CYCLE_TIMER_TO_TICKS(ctr); 
     219     
     220    cycle_timer = addTicks(cycle_timer, ticks_to_advance); 
    213221     
    214222    // time until the packet is to be sent (if > 0: send packet) 
    215     int64_t until_next=substractTicks(ts_head, cycle_timer + ticks_to_advance); 
     223    int32_t until_next=diffTicks(ts_head, cycle_timer); 
    216224 
    217225    // if until_next < 0 we should send a filled packet 
     
    219227    if((until_next<0) && (m_running)) { 
    220228        // add the transmit transfer delay to construct the playout time (=SYT timestamp) 
    221         uint64_t ts_packet=addTicks(ts_head, TRANSMIT_TRANSFER_DELAY); 
     229        uint32_t ts_packet=addTicks(ts_head, TRANSMIT_TRANSFER_DELAY); 
    222230     
    223231        // if we are disabled, send a silent packet 
     
    228236            m_dbc += fillDataPacketHeader(packet, length, ts_packet); 
    229237             
    230             debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "XMIT SYNC: CY=%04u TSH=%011llu TSP=%011llu\n", 
     238            debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "XMIT SYNC: CY=%04u TSH=%011llu TSP=%011lu\n", 
    231239                cycle, ts_head, ts_packet); 
    232240 
     
    252260                } 
    253261                 
    254                 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "XMIT: CY=%04u TSH=%011llu TSP=%011llu\n", 
     262                debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "XMIT DATA: CY=%04u TSH=%011llu TSP=%011lu\n", 
    255263                    cycle, ts_head, ts_packet); 
    256264                 
     
    282290         
    283291    } else { // no packet due, send no-data packet 
     292        debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "XMIT NONE: CY=%04u TSH=%011llu\n", 
     293                cycle, ts_head); 
     294                 
    284295        m_dbc += fillNoDataPacketHeader(packet, length); 
    285296        return RAW1394_ISO_DEFER; 
     
    356367    // lies in the future for every possible buffer fill case. 
    357368    int offset=(int)(m_ringbuffer_size_frames*m_ticks_per_frame); 
    358      
    359     // we can substract the delay as it introduces 
    360     // unnescessary delay 
    361     offset -= m_SyncSource->getSyncDelay(); 
    362369     
    363370    m_data_buffer->setTickOffset(offset); 
     
    594601    ts_head=addTicks(ts_head, TRANSMIT_ADVANCE_CYCLES*TICKS_PER_CYCLE); 
    595602     
     603    // we want the SP to start sending silent packets somewhat earlier than the 
     604    // time it is enabled 
     605    ts_head=substractTicks(ts_head, 100*TICKS_PER_CYCLE); 
     606     
    596607    m_data_buffer->setBufferTailTimestamp(ts_head); 
    597608 
     
    888899    } 
    889900 
    890  
    891901    debugOutput(DEBUG_LEVEL_VERY_VERBOSE,"ch%2u: CY=%4u, SYT=%08X (%4ucy + %04uticks) (running=%d, disabled=%d,%d)\n", 
    892902        channel, cycle,ntohs(packet->syt),   
     
    914924            // because we're going to update the buffer again this loop 
    915925            // using writeframes 
    916             m_data_buffer->setBufferTailTimestamp(m_last_timestamp2); 
     926            m_data_buffer->setBufferTailTimestamp(m_last_timestamp); 
    917927 
    918928        } else { 
     
    10371047// ISO buffering 
    10381048int AmdtpReceiveStreamProcessor::getMinimalSyncDelay() { 
    1039     return ((int)(m_handler->getWakeupInterval() * m_syt_interval * m_ticks_per_frame)+10000); 
     1049    return ((int)(m_handler->getWakeupInterval() * m_syt_interval * m_ticks_per_frame)); 
    10401050} 
    10411051 
     
    10561066    m_PacketStat.reset(); 
    10571067    m_WakeupStat.reset(); 
    1058      
    1059     // this makes that the buffer lags a little compared to reality 
    1060     // the result is that we get some extra time before period boundaries 
    1061     // are signaled. 
    1062     // ISO buffering causes the packets to be received at max 
    1063     // m_handler->getWakeupInterval() later than the time they were received. 
    1064     // hence their payload is available this amount of time later. However, the 
    1065     // period boundary is predicted based upon earlier samples, and therefore can 
    1066     // pass before these packets are processed. Adding this extra term makes that 
    1067     // the period boundary is signalled later 
    1068     m_data_buffer->setTickOffset(m_SyncSource->getSyncDelay()); 
     1068 
     1069    m_data_buffer->setTickOffset(0); 
    10691070 
    10701071    // reset all non-device specific stuff 
  • branches/streaming-rework/src/libstreaming/cycletimer.h

    r397 r411  
    9898 
    9999/** 
     100 * @brief Wraps x to the minimum number of ticks 
     101 * 
     102 * The input value is wrapped to the minimum value of the cycle 
     103 * timer, in ticks (= 0). 
     104 * 
     105 * @param x time to wrap 
     106 * @return wrapped time 
     107 */ 
     108static inline uint32_t wrapAtMinTicks(int64_t x) { 
     109    if (x < 0) { 
     110        x += TICKS_PER_SECOND * 128L; 
     111    } 
     112 
     113#ifdef DEBUG 
     114        if (x < 0) { 
     115            debugWarning("insufficient wrapping: %lld\n",x); 
     116             
     117            debugWarning("correcting...\n"); 
     118            while (x < 0) { 
     119                x += TICKS_PER_SECOND * 128L; 
     120                 
     121                if (x < 0) { 
     122                    debugWarning(" insufficient wrapping: %lld\n",x); 
     123                } 
     124            } 
     125        } 
     126 
     127#endif 
     128 
     129    return (uint32_t)x; 
     130} 
     131 
     132/** 
    100133 * @brief Wraps both at minimum and maximum value for ticks 
     134 * 
     135 * The input value is wrapped to the maximum value of the cycle 
     136 * timer, in ticks (128sec * 24576000 ticks/sec), and  
     137 * to the minimum value of the cycle timer, in ticks (= 0). 
     138 * 
    101139 * @param x value to wrap 
    102140 * @return wrapped value 
     
    137175 * @return the difference x-y, unwrapped 
    138176 */ 
    139 static inline int32_t substractTicks(uint32_t x, uint32_t y) { 
     177static inline int32_t diffTicks(uint32_t x, uint32_t y) { 
    140178    int64_t diff=(int64_t)x - (int64_t)y; 
    141179     
     
    165203 * 
    166204 * This function computes a sum of timestamps in ticks, 
    167  * wrapping the result if nescessary. 
     205 * wrapping the result if necessary. 
    168206 * 
    169207 * @param x First timestamp  
     
    175213 
    176214    return wrapAtMaxTicks(sum); 
     215} 
     216 
     217/** 
     218 * @brief Computes a substraction of timestamps 
     219 * 
     220 * This function computes a substraction of timestamps in ticks, 
     221 * wrapping the result if necessary. 
     222 * 
     223 * @param x First timestamp  
     224 * @param y Second timestamp 
     225 * @return the difference x-y, wrapped 
     226 */ 
     227static inline uint32_t substractTicks(uint32_t x, uint32_t y) { 
     228    int64_t subs=x-y; 
     229 
     230    return wrapAtMinTicks(subs); 
    177231} 
    178232 
     
    351405 * such that it respects wrapping (at 8000 cycles). 
    352406 * 
    353  * See substractTicks 
     407 * See diffTicks 
    354408 * 
    355409 * @param x First cycle value  
     
    357411 * @return the difference x-y, unwrapped 
    358412 */ 
    359 static inline int substractCycles(unsigned int x, unsigned int y) { 
     413static inline int diffCycles(unsigned int x, unsigned int y) { 
    360414    int diff = x - y; 
    361415     
  • branches/streaming-rework/src/libstreaming/MotuStreamProcessor.cpp

    r410 r411  
    109109    // the difference between the cycle this 
    110110    // packet is intended for and 'now' 
    111     int cycle_diff = substractCycles(cycle, now_cycles); 
     111    int cycle_diff = diffCycles(cycle, now_cycles); 
    112112     
    113113        // Signal that streaming is still active 
     
    118118    // to be 'running' 
    119119    // NOTE: this works only at startup 
    120     if (!m_running && cycle_diff >= 0 && cycle != -1) { 
     120    if (!m_running && cycle_diff >= 0 && cycle >= 0) { 
    121121            debugOutput(DEBUG_LEVEL_VERBOSE, "Xmit StreamProcessor %p started running at cycle %d\n",this, cycle); 
    122122            m_running=true; 
     
    135135            // the number of cycles the sync source lags (> 0) 
    136136            // or leads (< 0) 
    137             int sync_lag_cycles=substractCycles(cycle, m_SyncSource->getLastCycle()); 
     137            int sync_lag_cycles=diffCycles(cycle, m_SyncSource->getLastCycle()); 
    138138             
    139139            // account for the cycle lag between sync SP and this SP 
     
    199199     
    200200    // time until the packet is to be sent (if > 0: send packet) 
    201     int64_t until_next=substractTicks(timestamp, cycle_timer + ticks_to_advance); 
     201    int32_t until_next=diffTicks(timestamp, cycle_timer + ticks_to_advance); 
    202202     
    203203        // Size of a single data frame in quadlets 
     
    370370    int offset=(int)(m_data_buffer->getBufferSize()*m_ticks_per_frame); 
    371371     
    372     // we can substract the delay as it introduces 
    373     // unnescessary delay 
    374     offset -= m_SyncSource->getSyncDelay(); 
    375      
    376372    m_data_buffer->setTickOffset(offset); 
    377373     
     
    591587     
    592588    m_data_buffer->setBufferTailTimestamp(ts_head); 
    593  
    594589 
    595590    if (!StreamProcessor::prepareForEnable(time_to_enable_at)) { 
     
    10461041 
    10471042        debugOutput( DEBUG_LEVEL_VERBOSE, "Resetting...\n"); 
    1048          
    1049     // this makes that the buffer lags a little compared to reality 
    1050     // the result is that we get some extra time before period boundaries 
    1051     // are signaled. 
    1052     // ISO buffering causes the packets to be received at max 
    1053     // m_handler->getWakeupInterval() later than the time they were received. 
    1054     // hence their payload is available this amount of time later. However, the 
    1055     // period boundary is predicted based upon earlier samples, and therefore can 
    1056     // pass before these packets are processed. Adding this extra term makes that 
    1057     // the period boundary is signalled later 
    1058     m_data_buffer->setTickOffset(m_SyncSource->getSyncDelay()); 
     1043 
     1044    m_data_buffer->setTickOffset(0); 
    10591045 
    10601046        // reset all non-device specific stuff 
  • branches/streaming-rework/src/libstreaming/StreamProcessor.cpp

    r407 r411  
    232232} 
    233233 
    234 int64_t StreamProcessor::getTimeUntilNextPeriodUsecs() { 
     234int64_t StreamProcessor::getTimeUntilNextPeriodSignalUsecs() { 
    235235    uint64_t time_at_period=getTimeAtPeriod(); 
    236236     
     237    // we delay the period signal with the sync delay 
     238    // this makes that the period signals lag a little compared to reality 
     239    // ISO buffering causes the packets to be received at max 
     240    // m_handler->getWakeupInterval() later than the time they were received. 
     241    // hence their payload is available this amount of time later. However, the 
     242    // period boundary is predicted based upon earlier samples, and therefore can 
     243    // pass before these packets are processed. Adding this extra term makes that 
     244    // the period boundary is signalled later 
     245    time_at_period = addTicks(time_at_period, m_SyncSource->getSyncDelay()); 
     246 
    237247    uint64_t cycle_timer=m_handler->getCycleTimerTicks(); 
    238248     
    239249    // calculate the time until the next period 
    240     int64_t until_next=substractTicks(time_at_period,cycle_timer); 
     250    int32_t until_next=diffTicks(time_at_period,cycle_timer); 
    241251     
    242252    debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "=> TAP=%11llu, CTR=%11llu, UTN=%11lld\n", 
     
    321331uint64_t TransmitStreamProcessor::getTimeAtPeriod() { 
    322332    uint64_t next_period_boundary=m_data_buffer->getTimestampFromTail((m_nb_buffers-1) * m_period); 
    323      
     333 
    324334    #ifdef DEBUG 
    325335    uint64_t ts,fc; 
  • branches/streaming-rework/src/libstreaming/StreamProcessor.h

    r401 r411  
    154154         
    155155        /** 
    156          * \brief return the time until the next period boundary (in microseconds) 
    157          * 
    158          * Return the time until the next period boundary. If this StreamProcessor  
     156         * \brief return the time until the next period boundary should be signaled (in microseconds) 
     157         * 
     158         * Return the time until the next period boundary signal. If this StreamProcessor  
    159159         * is the current synchronization source, this function is called to  
    160160         * determine when a buffer transfer can be made. When this value is 
     
    164164         * \return the time in usecs 
    165165         */ 
    166         int64_t getTimeUntilNextPeriodUsecs(); 
     166        int64_t getTimeUntilNextPeriodSignalUsecs(); 
    167167        /** 
    168168         * \brief return the time of the next period boundary (in microseconds) 
     
    181181         * \brief return the time of the next period boundary (in internal units)  
    182182         * 
    183          * The same as getTimeUntilNextPeriodUsecs() but in internal units. 
     183         * The same as getTimeUntilNextPeriodSignalUsecs() but in internal units. 
    184184         * 
    185185         * @return the time in internal units 
  • branches/streaming-rework/src/libstreaming/StreamProcessorManager.cpp

    r407 r411  
    4040#define PREPARE_TIMEOUT_MSEC 4000 
    4141#define ENABLE_TIMEOUT_MSEC 4000 
     42 
     43#define ENABLE_DELAY_CYCLES 2000 
    4244 
    4345namespace FreebobStreaming { 
     
    259261bool StreamProcessorManager::syncStartAll() { 
    260262 
    261     debugOutput( DEBUG_LEVEL_VERBOSE, "Waiting for all StreamProcessor streams to start running...\n"); 
     263    debugOutput( DEBUG_LEVEL_VERBOSE, "Waiting for StreamProcessor streams to start running...\n"); 
    262264    // we have to wait until all streamprocessors indicate that they are running 
    263265    // i.e. that there is actually some data stream flowing 
     
    268270        notRunning=false; 
    269271         
    270         for ( StreamProcessorVectorIterator it = m_ReceiveProcessors.begin(); 
    271                 it != m_ReceiveProcessors.end(); 
    272                 ++it ) { 
    273             if(!(*it)->isRunning()) notRunning=true; 
    274         } 
    275  
    276         for ( StreamProcessorVectorIterator it = m_TransmitProcessors.begin(); 
    277                 it != m_TransmitProcessors.end(); 
    278                 ++it ) { 
    279             if(!(*it)->isRunning()) notRunning=true; 
    280         } 
     272//         for ( StreamProcessorVectorIterator it = m_ReceiveProcessors.begin(); 
     273//                 it != m_ReceiveProcessors.end(); 
     274//                 ++it ) { 
     275//             if(!(*it)->isRunning()) notRunning=true; 
     276//         } 
     277//  
     278//         for ( StreamProcessorVectorIterator it = m_TransmitProcessors.begin(); 
     279//                 it != m_TransmitProcessors.end(); 
     280//                 ++it ) { 
     281//             if(!(*it)->isRunning()) notRunning=true; 
     282//         } 
     283         
     284        // EXPERIMENT: 
     285        // the only stream that should be running is the sync 
     286        // source stream, as this is the one that defines 
     287        // when to signal buffers. Maybe we get an xrun at startup, 
     288        // but that should be handled. 
     289         
     290        // the problem is that otherwise a setup with a device  
     291        // that waits for decent input before sending output  
     292        // will not start up (e.g. the bounce device), because 
     293        // all streams are required to be running. 
     294         
     295        // other streams still have at least ENABLE_DELAY_CYCLES cycles  
     296        // to start up 
     297        if(!m_SyncSource->isRunning()) notRunning=true; 
     298         
    281299        usleep(1000); 
    282300        debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "Running check: %d\n",notRunning); 
     
    285303    if(!wait_cycles) { // timout has occurred 
    286304        debugFatal("One or more streams are not starting up (timeout):\n"); 
    287                      
     305 
    288306        for ( StreamProcessorVectorIterator it = m_ReceiveProcessors.begin(); 
    289307                it != m_ReceiveProcessors.end(); 
     
    305323            } 
    306324        } 
    307          
    308325        return false; 
    309326    } 
     
    356373     
    357374    // FIXME: this should not be in cycles, but in 'time' 
    358     unsigned int enable_at=TICKS_TO_CYCLES(now)+2000
     375    unsigned int enable_at=TICKS_TO_CYCLES(now)+ENABLE_DELAY_CYCLES
    359376    if (enable_at > 8000) enable_at -= 8000; 
    360377 
     
    746763    assert(m_SyncSource); 
    747764     
    748     time_till_next_period=m_SyncSource->getTimeUntilNextPeriodUsecs(); 
     765    time_till_next_period=m_SyncSource->getTimeUntilNextPeriodSignalUsecs(); 
    749766     
    750767    while(time_till_next_period > 0) { 
     
    770787 
    771788        // check if we were waked up too soon 
    772         time_till_next_period=m_SyncSource->getTimeUntilNextPeriodUsecs(); 
     789        time_till_next_period=m_SyncSource->getTimeUntilNextPeriodSignalUsecs(); 
    773790    } 
    774791     
  • branches/streaming-rework/src/libutil/TimestampedBuffer.cpp

    r407 r411  
    565565    } 
    566566#endif 
    567      
    568     int64_t diff=m_buffer_next_tail_timestamp - m_buffer_tail_timestamp; 
    569     if (diff < 0) diff += m_wrap_at; 
    570567 
    571568    pthread_mutex_lock(&m_framecounter_lock); 
     
    605602    int64_t ts=new_timestamp; 
    606603 
    607     int64_t diff=m_buffer_next_tail_timestamp - m_buffer_tail_timestamp; 
    608     if (diff < 0) diff += m_wrap_at; 
    609      
    610604    pthread_mutex_lock(&m_framecounter_lock); 
    611605     
  • branches/streaming-rework/tests/test-cycletimer.cpp

    r394 r411  
    159159     
    160160    int32_t subs; 
    161     subs=substractTicks(10, 8); 
     161    subs=diffTicks(10, 8); 
    162162    if (subs != 2) { 
    163          debugOutput(DEBUG_LEVEL_NORMAL, "  substractTicks(10, 8) != 2 : %ld\n", 
    164             subs); 
    165         failures++;    
    166     } 
    167      
    168     subs=substractTicks(10, 12); 
     163         debugOutput(DEBUG_LEVEL_NORMAL, "  diffTicks(10, 8) != 2 : %ld\n", 
     164            subs); 
     165        failures++;    
     166    } 
     167     
     168    subs=diffTicks(10, 12); 
    169169    if (subs != -2) { 
    170          debugOutput(DEBUG_LEVEL_NORMAL, "  substractTicks(10, 12) != -2 : %ld\n", 
    171             subs); 
    172         failures++;    
    173     } 
    174      
    175     subs=substractTicks(TICKS_PER_SECOND*128L + 10, 8); 
     170         debugOutput(DEBUG_LEVEL_NORMAL, "  diffTicks(10, 12) != -2 : %ld\n", 
     171            subs); 
     172        failures++;    
     173    } 
     174     
     175    subs=diffTicks(TICKS_PER_SECOND*128L + 10, 8); 
    176176    if (subs != 2) { 
    177          debugOutput(DEBUG_LEVEL_NORMAL, "  substractTicks(TICKS_PER_SECOND*128L + 10, 8) != 2 : %ld\n", 
    178             subs); 
    179         failures++;    
    180     } 
    181      
    182     subs=substractTicks(TICKS_PER_SECOND*128L + 10, 12); 
     177         debugOutput(DEBUG_LEVEL_NORMAL, "  diffTicks(TICKS_PER_SECOND*128L + 10, 8) != 2 : %ld\n", 
     178            subs); 
     179        failures++;    
     180    } 
     181     
     182    subs=diffTicks(TICKS_PER_SECOND*128L + 10, 12); 
    183183    if (subs != -2) { 
    184          debugOutput(DEBUG_LEVEL_NORMAL, "  substractTicks(TICKS_PER_SECOND*128L + 10, 12) != -2 : %ld\n", 
    185             subs); 
    186         failures++;    
    187     } 
    188      
    189     subs=substractTicks(10, TICKS_PER_SECOND*128L + 8); 
     184         debugOutput(DEBUG_LEVEL_NORMAL, "  diffTicks(TICKS_PER_SECOND*128L + 10, 12) != -2 : %ld\n", 
     185            subs); 
     186        failures++;    
     187    } 
     188     
     189    subs=diffTicks(10, TICKS_PER_SECOND*128L + 8); 
    190190    if (subs != 2) { 
    191          debugOutput(DEBUG_LEVEL_NORMAL, "  substractTicks(10, TICKS_PER_SECOND*128L + 8) != 2 : %ld\n", 
    192             subs); 
    193         failures++;    
    194     } 
    195      
    196     subs=substractTicks(10, TICKS_PER_SECOND*128L + 12); 
     191         debugOutput(DEBUG_LEVEL_NORMAL, "  diffTicks(10, TICKS_PER_SECOND*128L + 8) != 2 : %ld\n", 
     192            subs); 
     193        failures++;    
     194    } 
     195     
     196    subs=diffTicks(10, TICKS_PER_SECOND*128L + 12); 
    197197    if (subs != -2) { 
    198          debugOutput(DEBUG_LEVEL_NORMAL, "  substractTicks(10, TICKS_PER_SECOND*128L + 12) != -2 : %l011llu\n", 
     198         debugOutput(DEBUG_LEVEL_NORMAL, "  diffTicks(10, TICKS_PER_SECOND*128L + 12) != -2 : %l011llu\n", 
    199199            subs); 
    200200        failures++;