Changeset 1343

Show
Ignore:
Timestamp:
09/24/08 07:25:27 (12 years ago)
Author:
ppalmers
Message:

fix max packet latency estimate

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/libffado-2.0/src/libieee1394/IsoHandler.h

    r1292 r1343  
    119119    unsigned int getMaxPacketSize() { return m_max_packet_size;}; 
    120120    unsigned int getNbBuffers() { return m_buf_packets;}; 
    121     int getPacketLatency() { return m_irq_interval;}; 
     121    int getIrqInterval() { return m_irq_interval;}; 
    122122 
    123123    unsigned int getPreBuffers() {return m_prebuffers;}; 
  • branches/libffado-2.0/src/libieee1394/IsoHandlerManager.cpp

    r1342 r1343  
    986986    { 
    987987        if((*it)->isStreamRegistered(stream)) { 
    988             return (*it)->getPacketLatency(); 
     988            unsigned int page_size = getpagesize(); 
     989            unsigned int max_packet_size = stream->getMaxPacketSize() + 8; 
     990            int average_packet_size_bytes = stream->getAveragePacketSize(); 
     991            int irq_interval = (*it)->getIrqInterval(); 
     992 
     993            // mimic kernel initialization 
     994            unsigned int kern_buff_stride = RAW1394_RCV_MIN_BUF_STRIDE; 
     995            for (; kern_buff_stride < max_packet_size; kern_buff_stride *= 2); 
     996            if (kern_buff_stride > page_size) kern_buff_stride = page_size; 
     997             
     998            // we can only have one interrupt every kern_buff_stride bytes 
     999            int packets_per_block = kern_buff_stride / average_packet_size_bytes; 
     1000            int blocks_per_interrupt = irq_interval / packets_per_block + 1; 
     1001            return blocks_per_interrupt * packets_per_block; 
    9891002        } 
    9901003    }