Changeset 831 for branches

Show
Ignore:
Timestamp:
01/10/08 13:15:38 (13 years ago)
Author:
ppalmers
Message:

small tweaks

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/api-cleanup/config.h.in

    r821 r831  
    6868#define STREAMPROCESSORMANAGER_PRESTART_CYCLES_FOR_RECV     0 
    6969#define STREAMPROCESSORMANAGER_SYNCSTART_TRIES              10 
     70#define STREAMPROCESSORMANAGER_SYNC_WAIT_TIME_MSEC          200 
    7071#define STREAMPROCESSORMANAGER_ALIGN_AVERAGE_TIME_MSEC      200 
    7172#define STREAMPROCESSORMANAGER_NB_ALIGN_TRIES               40 
  • branches/api-cleanup/src/libieee1394/IsoHandler.cpp

    r821 r831  
    202202IsoHandler::Execute() 
    203203{ 
    204     //debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "%p: Execute thread...\n", this); 
     204    debugOutput( DEBUG_LEVEL_VERY_VERBOSE, "%p: Execute thread...\n", this); 
    205205 
    206206    // bypass if not running 
     
    273273IsoHandler::iterate() { 
    274274//     if(m_type==eHT_Receive) { 
    275 //         debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "(%p, %s) Iterating ISO handler\n",  
     275//         debugOutput(DEBUG_LEVEL_VERBOSE, "(%p, %s) Iterating ISO handler\n",  
    276276//                 this, (m_type==eHT_Receive?"Receive":"Transmit")); 
    277277//     } 
     
    281281#endif 
    282282        if(raw1394_loop_iterate(m_handle)) { 
    283             debugOutput( DEBUG_LEVEL_VERBOSE, 
    284                         "IsoHandler (%p): Failed to iterate handler: %s\n", 
     283            debugError( "IsoHandler (%p): Failed to iterate handler: %s\n", 
    285284                        this, strerror(errno)); 
    286285            return false; 
    287286        } 
     287//         debugOutput(DEBUG_LEVEL_VERBOSE, "(%p, %s)  done iterating ISO handler\n",  
     288//                 this, (m_type==eHT_Receive?"Receive":"Transmit")); 
    288289        return true; 
    289290    } else { 
  • branches/api-cleanup/src/libieee1394/IsoHandlerManager.cpp

    r807 r831  
    378378        } 
    379379 
    380         max_packet_size = page_size; 
     380        //max_packet_size = page_size; // HACK 
    381381        unsigned int irq_interval = packets_per_period / MINIMUM_INTERRUPTS_PER_PERIOD; 
    382382        if(irq_interval <= 0) irq_interval=1; 
     
    395395            return false; 
    396396        } 
     397 
    397398    } else { 
    398399        debugFatal("Bad stream type\n"); 
  • branches/api-cleanup/src/libstreaming/amdtp/AmdtpTransmitStreamProcessor.cpp

    r829 r831  
    676676        { 
    677677            AmdtpPortInfo *pinfo=dynamic_cast<AmdtpPortInfo *>(*it); 
    678             debugOutput(DEBUG_LEVEL_VERBOSE, "idx %u: looking at port %s at position %u\n", 
     678            debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "idx %u: looking at port %s at position %u\n", 
    679679                                              idx, (*it)->getName().c_str(), pinfo->getPosition()); 
    680680            if(pinfo->getPosition() == idx) { 
     
    707707    { 
    708708        AmdtpPortInfo *pinfo=dynamic_cast<AmdtpPortInfo *>(*it); 
    709         debugOutput(DEBUG_LEVEL_VERBOSE, "idx %u: looking at port %s at position %u, location %u\n", 
     709        debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "idx %u: looking at port %s at position %u, location %u\n", 
    710710                                        idx, (*it)->getName().c_str(), pinfo->getPosition(), pinfo->getLocation()); 
    711711        if ((*it)->getPortType() == Port::E_Midi) { 
  • branches/api-cleanup/src/libstreaming/generic/StreamProcessor.cpp

    r829 r831  
    6868    , m_local_node_id ( 0 ) // local cache 
    6969    , m_channel( -1 ) 
    70     , m_dropped(0) 
    71     , m_last_timestamp(0) 
    72     , m_last_timestamp2(0) 
     70    , m_dropped( 0 ) 
     71    , m_last_timestamp( 0 ) 
     72    , m_last_timestamp2( 0 ) 
     73    , m_correct_last_timestamp( false ) 
    7374    , m_scratch_buffer( NULL ) 
    7475    , m_scratch_buffer_size_bytes( 0 ) 
     
    133134    // the waitForClient in IsoHandler will take care of the fact that the frames are 
    134135    // not present in time 
    135     unsigned int packets_to_prebuffer = (getPacketsPerPeriod() * (m_StreamProcessorManager.getNbBuffers()))
     136    unsigned int packets_to_prebuffer = (getPacketsPerPeriod() * (m_StreamProcessorManager.getNbBuffers())) + 10
    136137    debugOutput(DEBUG_LEVEL_VERBOSE, "Nominal prebuffer: %u\n", packets_to_prebuffer); 
    137138    return packets_to_prebuffer; 
     
    367368    // check the packet header 
    368369    enum eChildReturnValue result = processPacketHeader(data, length, channel, tag, sy, cycle, dropped_cycles); 
     370 
     371    // handle dropped cycles 
     372    if(dropped_cycles) { 
     373        // make sure the last_timestamp is corrected 
     374        m_correct_last_timestamp = true; 
     375        if (m_state == ePS_Running) { 
     376            // this is an xrun situation 
     377            m_in_xrun = true; 
     378            debugWarning("Should update state to WaitingForStreamDisable due to dropped packet xrun\n"); 
     379            m_cycle_to_switch_state = cycle + 1; // switch in the next cycle 
     380            m_next_state = ePS_WaitingForStreamDisable; 
     381            // execute the requested change 
     382            if (!updateState()) { // we are allowed to change the state directly 
     383                debugError("Could not update state!\n"); 
     384                POST_SEMAPHORE; 
     385                return RAW1394_ISO_ERROR; 
     386            } 
     387        } 
     388    } 
     389 
    369390    if (result == eCRV_OK) { 
    370391        debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "RECV: CY=%04u TS=%011llu\n", 
     
    374395        m_last_dropped = dropped_cycles; 
    375396 
    376         // handle dropped cycles 
    377         if(dropped_cycles) { 
     397        if(m_correct_last_timestamp) { 
    378398            // they represent a discontinuity in the timestamps, and hence are 
    379399            // to be dealt with 
    380400            debugWarning("(%p) Correcting timestamp for dropped cycles, discarding packet...\n", this); 
    381             m_data_buffer->setBufferTailTimestamp(m_last_timestamp); 
    382             if (m_state == ePS_Running) { 
    383                 // this is an xrun situation 
    384                 m_in_xrun = true; 
    385                 debugWarning("Should update state to WaitingForStreamDisable due to dropped packet xrun\n"); 
    386                 m_cycle_to_switch_state = cycle + 1; // switch in the next cycle 
    387                 m_next_state = ePS_WaitingForStreamDisable; 
    388                 // execute the requested change 
    389                 if (!updateState()) { // we are allowed to change the state directly 
    390                     debugError("Could not update state!\n"); 
    391                     POST_SEMAPHORE; 
    392                     return RAW1394_ISO_ERROR; 
    393                 } 
    394             } 
     401            m_data_buffer->setBufferTailTimestamp(substractTicks(m_last_timestamp, getNominalFramesPerPacket() * getTicksPerFrame())); 
     402            m_correct_last_timestamp = false; 
    395403        } 
    396404 
     
    749757    } 
    750758 
    751     debugOutput(DEBUG_LEVEL_ULTRA_VERBOSE, "XMIT EMPTY: CY=%04u\n", cycle); 
     759    debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "XMIT EMPTY: CY=%04u\n", cycle); 
    752760    generateSilentPacketHeader(data, length, tag, sy, cycle, dropped_cycles, max_length); 
    753761    generateSilentPacketData(data, length, tag, sy, cycle, dropped_cycles, max_length); 
     
    902910StreamProcessor::waitForSignal() 
    903911{ 
     912    debugOutput(DEBUG_LEVEL_VERBOSE, "(%p, %s) wait ...\n", this, getTypeString()); 
    904913    int result; 
    905914    if(m_state == ePS_Running && m_next_state == ePS_Running) { 
     
    13261335            m_ticks_per_frame = ticks_per_frame; 
    13271336            m_local_node_id= m_1394service.getLocalNodeId() & 0x3f; 
     1337            m_correct_last_timestamp = false; 
    13281338 
    13291339            debugOutput(DEBUG_LEVEL_VERBOSE,"Initializing remote ticks/frame to %f\n", ticks_per_frame); 
  • branches/api-cleanup/src/libstreaming/generic/StreamProcessor.h

    r829 r831  
    326326    uint64_t m_last_timestamp; /// last timestamp (in ticks) 
    327327    uint64_t m_last_timestamp2; /// last timestamp (in ticks) 
    328     uint64_t m_last_timestamp_at_period_ticks; 
     328    bool m_correct_last_timestamp; 
     329    uint64_t m_last_timestamp_at_period_ticks; // FIXME: still used? 
    329330 
    330331//--- data buffering and accounting 
  • branches/api-cleanup/src/libstreaming/StreamProcessorManager.cpp

    r821 r831  
    222222    debugOutput( DEBUG_LEVEL_VERBOSE, "Putting StreamProcessor streams into dry-running state...\n"); 
    223223    debugOutput( DEBUG_LEVEL_VERBOSE, " Schedule start dry-running...\n"); 
    224     for ( StreamProcessorVectorIterator it = m_ReceiveProcessors.begin(); 
    225             it != m_ReceiveProcessors.end(); 
     224    for ( StreamProcessorVectorIterator it = m_TransmitProcessors.begin(); 
     225            it != m_TransmitProcessors.end(); 
    226226            ++it ) { 
    227227        if (!(*it)->isDryRunning()) { 
     
    234234        } 
    235235    } 
    236     for ( StreamProcessorVectorIterator it = m_TransmitProcessors.begin(); 
    237             it != m_TransmitProcessors.end(); 
     236    for ( StreamProcessorVectorIterator it = m_ReceiveProcessors.begin(); 
     237            it != m_ReceiveProcessors.end(); 
    238238            ++it ) { 
    239239        if (!(*it)->isDryRunning()) { 
     
    326326    // DLL to have a decent sync (FIXME: does the DLL get updated when dry-running)? 
    327327    debugOutput( DEBUG_LEVEL_VERBOSE, "Waiting for sync...\n"); 
    328     int nb_sync_runs=20; 
     328     
     329    unsigned int nb_sync_runs = (STREAMPROCESSORMANAGER_SYNC_WAIT_TIME_MSEC * getNominalRate()); 
     330    nb_sync_runs /= 1000; 
     331    nb_sync_runs /= getPeriodSize(); 
     332 
    329333    int64_t time_till_next_period; 
    330334    while(nb_sync_runs--) { // or while not sync-ed? 
  • branches/api-cleanup/src/libutil/TimestampedBuffer.cpp

    r829 r831  
    11741174 
    11751175    if (diff > max_abs_diff) { 
    1176         debugShowBackLogLines(100); 
     1176//         debugShowBackLogLines(100); 
    11771177        debugWarning("(%p) difference rather large (+): diff="TIMESTAMP_FORMAT_SPEC", max="TIMESTAMP_FORMAT_SPEC", "TIMESTAMP_FORMAT_SPEC", "TIMESTAMP_FORMAT_SPEC"\n", 
    11781178            this, diff, max_abs_diff, ts, pred_buffer_next_tail_timestamp); 
    11791179    } else if (diff < -max_abs_diff) { 
    1180         debugShowBackLogLines(100); 
     1180//         debugShowBackLogLines(100); 
    11811181        debugWarning("(%p) difference rather large (-): diff="TIMESTAMP_FORMAT_SPEC", max="TIMESTAMP_FORMAT_SPEC", "TIMESTAMP_FORMAT_SPEC", "TIMESTAMP_FORMAT_SPEC"\n", 
    11821182            this, diff, -max_abs_diff, ts, pred_buffer_next_tail_timestamp); 
  • branches/api-cleanup/tests/streaming/teststreaming3.cpp

    r821 r831  
    236236{ 
    237237    run = 0; 
    238     set_realtime_priority(0); 
    239238} 
    240239 
  • branches/api-cleanup/tests/test-ieee1394service.cpp

    r789 r831  
    5656DECLARE_GLOBAL_DEBUG_MODULE; 
    5757 
    58 #define DIFF_CONSIDERED_LARGE 100000 
     58#define DIFF_CONSIDERED_LARGE 3072 
    5959int PORT_TO_USE = 0; 
    6060 
  • branches/api-cleanup/tests/test-streamdump.cpp

    r742 r831  
    191191 
    192192        if ( pCons->m_iIsoChannel != -1 ) { 
     193            printf( "disconnect\n"); 
    193194            iec61883_cmp_disconnect( pHandle, 
    194195                                     pCons->m_output,