Changeset 1544

Show
Ignore:
Timestamp:
04/26/09 07:11:05 (12 years ago)
Author:
ppalmers
Message:

round the transmit safety buffer size to one packet size (in frames) to avoid messing up the MIDI time muxed stream position

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/libffado-2.0/src/libieee1394/CycleTimerHelper.cpp

    r1525 r1544  
    390390        if(not_good) { 
    391391            debugOutput(DEBUG_LEVEL_VERBOSE,  
    392                         "(%p) have to retry CTR read, diff unrealistic: diff: %lld, max: +/- %ld (try: %d) %lld\n",  
     392                        "(%p) have to retry CTR read, diff unrealistic: diff: %lld, max: +/- %u (try: %d) %lld\n",  
    393393                        this, err_ticks, 1*TICKS_PER_CYCLE, ntries, expected_ticks); 
    394394            // sleep half a cycle to make sure the hardware moved on 
    395             Util::SystemTimeSource::SleepUsecRelative(USECS_PER_CYCLE); 
     395            Util::SystemTimeSource::SleepUsecRelative(USECS_PER_CYCLE / 2); 
    396396        } 
    397397 
  • branches/libffado-2.0/src/libstreaming/amdtp/AmdtpReceiveStreamProcessor.cpp

    r1530 r1544  
    378378                    sample_int |= 0x01000000; // flag that there is a midi event present 
    379379                    *buffer = sample_int; 
     380                    debugOutputExtreme(DEBUG_LEVEL_VERBOSE, "(%p) MIDI [%d]: %08X\n", this, i, sample_int); 
    380381                } else if(IEC61883_AM824_HAS_LABEL(sample_int, IEC61883_AM824_LABEL_MIDI_2X) 
    381382                       || IEC61883_AM824_HAS_LABEL(sample_int, IEC61883_AM824_LABEL_MIDI_3X) ) { 
  • branches/libffado-2.0/src/libstreaming/amdtp/AmdtpTransmitStreamProcessor.cpp

    r1525 r1544  
    268268    if (m_data_buffer->readFrames(m_syt_interval, (char *)(data + 8))) 
    269269    { 
    270         debugOutputExtreme(DEBUG_LEVEL_VERY_VERBOSE, 
     270        debugOutputExtreme(DEBUG_LEVEL_VERBOSE, 
    271271                           "XMIT DATA: TSP= %011llu (%04u)\n", 
    272272                           m_last_timestamp, 
    273273                           (unsigned int)TICKS_TO_CYCLES(m_last_timestamp)); 
     274        #if 0 
     275        // debug code to output the packet content 
     276        char tmpbuff[8192]; 
     277        int cnt=0; 
     278        quadlet_t *tmp = (quadlet_t *)((char *)(data + 8)); 
     279 
     280        for(int i=0; i<m_syt_interval; i++) { 
     281            cnt += snprintf(tmpbuff + cnt, 8192-cnt, "[%02d] ", i); 
     282            for(int j=0; j<m_dimension; j++) { 
     283                cnt += snprintf(tmpbuff + cnt, 8192-cnt, "%08X ", *tmp); 
     284                tmp++; 
     285            } 
     286            cnt += snprintf(tmpbuff + cnt, 8192-cnt, "\n"); 
     287        } 
     288        debugOutput(DEBUG_LEVEL_VERBOSE, "\n%s\n", tmpbuff); 
     289        #endif 
    274290        return eCRV_OK; 
    275291    } 
     
    10331049                    tmpval = ((*buffer)<<16) & 0x00FF0000; 
    10341050                    tmpval = IEC61883_AM824_SET_LABEL(tmpval, IEC61883_AM824_LABEL_MIDI_1X); 
     1051                    tmpval = 0x817F0000; 
    10351052                    *target_event = CondSwapToBus32(tmpval); 
    10361053 
    1037 //                     debugOutput ( DEBUG_LEVEL_VERBOSE, "MIDI port %s, pos=%u, loc=%u, nevents=%u, dim=%d\n", 
    1038 //                                p.port->getName().c_str(), p.position, p.location, nevents, m_dimension ); 
    1039 //                     debugOutput ( DEBUG_LEVEL_VERBOSE, "base=%p, target=%p, value=%08X\n", 
    1040 //                                data, target_event, tmpval ); 
     1054                    debugOutputExtreme( DEBUG_LEVEL_VERBOSE, "MIDI port %s, pos=%u, loc=%u, nevents=%u, dim=%d\n", 
     1055                               p.port->getName().c_str(), p.position, p.location, nevents, m_dimension ); 
     1056                    debugOutputExtreme( DEBUG_LEVEL_VERBOSE, "base=%p, target=%p, value=%08X\n", 
     1057                               data, target_event, tmpval ); 
    10411058                } else { 
    10421059                    // can't send a byte, either because there is no byte, 
  • branches/libffado-2.0/src/libstreaming/StreamProcessorManager.cpp

    r1536 r1544  
    623623        sync_delay_frames); 
    624624 
     625    // the amount of prebuffer frames should be a multiple of the common block size 
     626    // as otherwise the position of MIDI is messed up 
     627    if(xmit_prebuffer_frames % max_packet_size_frames) { 
     628        int tmp = 0; 
     629        while(tmp < xmit_prebuffer_frames) { 
     630            tmp += max_packet_size_frames; 
     631        } 
     632        debugOutput(DEBUG_LEVEL_VERBOSE, 
     633                    "The number of prebuffer frames (%d) is not a multiple of the common block size (%d), increased to %d...\n",  
     634                    xmit_prebuffer_frames, max_packet_size_frames, tmp); 
     635        xmit_prebuffer_frames = tmp; 
     636    } 
     637 
    625638    // check if this can even work. 
    626639    // the worst case point where we can receive a period is at 1 period + sync delay