Skip to content
  • James Bottomley's avatar
    bluetooth: add support for mSBC codec · f22cfa8f
    James Bottomley authored and PulseAudio Marge Bot's avatar PulseAudio Marge Bot committed
    
    
    Adding processing support for the mSBC codec is somewhat problematic,
    because, although it is a SBC codec, the a2dp handling can't simply be
    reused because the codec is used on an eSCO link with transparent
    data, meaning the transmission unit has to be 48 bytes (fragmenting
    the codec packets) and reassembly and boundary detection is required
    to be done by the implementation.  Therefore we have to implement
    separate render and push routines for msbc that do this fragmentation.
    
    Fragmentation is done by emulating circular buffers.  The receive
    (push) buffer is easy, since the mSBC packet size is 60, simply have a
    buffer of this size in the sbc_info area where the fragments are
    reassembled.  Once we have a full 60 bytes, decode and restart from
    zero.  The send (render) buffer is more problematic, since the
    transmit must be done from contiguous memory.  This means that the
    buffer must be the lowest common multiple of the transmission unit and
    the packet size.  This value is 240 since 240/48 == 5 and 240/60 == 4.
    So the buffer pointers are reset at 240 which is a whole number of
    both rendered packets and eSCO transmission units.
    
    Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
    Part-of: <!507>
    f22cfa8f