Commits on Jul 16, 2012
  1. Merge pull request #154 from grefab/master

    Fixes issue #147.
    JH Laird committed Jul 16, 2012
Commits on Jul 15, 2012
  1. Initiating resync when receiving strange packet

    The packet type 0x56, sequence number 0, containing 4 bytes (the first two are the sequence number of the previously requested packet) initiates a resync. Not sure what this packet is supposed to do, but it occurs after heavy requesting resending of packets. Seems to be an out of sync situation, so resyncing is not the worst idea.
    Signed-off-by: Gregor Fabritius <>
    grefab committed Jul 15, 2012
  2. Fixed Issue #147: Segfaults on ShairPort version 0.05 C port

    When requesting resend of packets a lot, iOS sometimes sends a packet with type 0x56 (Reply to resend request), but with sequence number 0 and length == 4. This short length leads to memory corruption later on when processing the packet: alac_decode() expects at least 16 bytes for AES IV. Therefore the segfault.
    This fix ignores packets with length < 16, as seen in another implementation here:
    Please be aware that this just fixes the segfault. The suspicious packet seems to be an information of an out of sync situation, so it may deserve further attention.
    Signed-off-by: Gregor Fabritius <>
    grefab committed Jul 15, 2012
Commits on Jun 3, 2012
  1. Merge pull request #145 from choongng/master

    Play silence while audio is paused.
    albertz committed Jun 3, 2012
Commits on Apr 15, 2012
Commits on Feb 27, 2012
  1. Merge pull request #140 from timdoug/howl-support

    Add support for mDNSPublish, from the howl zeroconf implementation.
    JH Laird committed Feb 27, 2012
  2. Add support for mDNSPublish, from the howl zeroconf implementation.

    Howl hasn't been actively developed for some years now; their website 404s,
    and the Wayback Machine archive of 2008 says it's dead.[1] Yet it's still
    functional and is much smaller than dbus and avahi, which makes it useful
    for embedded systems. In fact, OpenWrt has not dropped support for the howl
    tools, and it's because of howl that I can fit a functional shairport and
    supporting libraries and kernel onto the 4MB of flash in a TP-LINK
    timdoug committed Feb 27, 2012
Commits on Feb 26, 2012
  1. Merge pull request #139 from toofishes/math

    hairtunes: math and dithering optimisations
    JH Laird committed Feb 26, 2012
Commits on Feb 25, 2012
  1. hairtunes: implement a simple LCG-based RNG for dithering

    We are calling out to libc's rand() function, which has significant
    overhead, especially since we are calling it 88200 times per second
    (2 channels * 44100 samples).
    Implement a very simple linear congruential generator in our code that
    is plenty good enough for dithering purposes, and small enough for the
    compiler to optimize and inline.
    toofishes committed Feb 25, 2012
  2. hairtunes: simplify and reorganize some floating point operations

    The math operations are all equivalent, but are simplified a bit for the
    benefit of processors with slower floating point performance.
    * Don't use float casts when we need to eventually convert to double
      precision anyway.
    * Use multiplication instead of division when possible.
    toofishes committed Feb 25, 2012
Commits on Feb 24, 2012
  1. Merge pull request #138 from toofishes/cleanup

    Cleanup, optimization, and bug fixes
    albertz committed Feb 24, 2012
  2. Tabs to spaces conversion

    toofishes committed Feb 24, 2012
  3. Use static where appropriate in shairport.c

    Most functions don't need to be public outside of this file, so move all
    the forward declarations out of shairport.h.
    toofishes committed Feb 24, 2012
  4. Use the audio buffer mutex appropriately

    We need to use this any time we write to or access any of the
    audio-buffer related variables. This also removes the need to use
    'volatile', which cripples the compiler optimizations.
    toofishes committed Feb 24, 2012
  5. Use a pthread mutex around the volume settings

    Using the `volatile` qualifier in multithreading code is never the right
    answer. Mutexes should be used as was attempted with the audio buffer
    code. Here, we implement a new mutex for the volume and fix_volume
    globals, and grab a lock on it when necessary, which is for both reads
    and writes.
    toofishes committed Feb 24, 2012
  6. Return the correct value from biquad_filt()

    If you turned set `debug = 1` in hairtunes, you'd quickly get a mess of
    debug messages that showed bf_est_drift in bf_est_update() going quicky
    out of range toward a float NaN value (usually negative). Clearly the
    presence of this `out` variable in biquad_filt was meant to be used, not
    marked as unused.
    toofishes committed Feb 24, 2012
  7. hairtunes: use static keyword appropriately

    This allows the compiler to do a much better job on this file, as it
    currently can't inline most of the functions because they are
    technically visible outside the file. Mark most functions and variables
    static to let the compiler work.
    toofishes committed Feb 24, 2012
  8. Don't require extern usage of frame buffering value

    This makes things a bit cleaner and easier to grasp.
    toofishes committed Feb 24, 2012
  9. Fix dependency issue in Makefile

    Make the dependency and compile command match in the resources used.
    toofishes committed Feb 24, 2012
  10. Removed typo in Makefile

    dotmpe committed with toofishes Jul 30, 2011
  11. Improve resending of frames (and avoid missed frames)

    - when requesting a packet, do not request an already received packet
    - move the last-chance resend to buffer_get_frame
    - check more often for missing frames
      own checks show that some frames need to be requested up to 4 times
      on bad connections
    Stef Simoens committed with toofishes Oct 10, 2011
  12. Remove dead code in alac.c

    toofishes committed Feb 24, 2012
Commits on Jan 12, 2012
  1. Merge pull request #135 from alenichev/master

    Fix compilation error
    albertz committed Jan 12, 2012
Commits on Jan 11, 2012
Commits on Jan 8, 2012
  1. Merge pull request #123 from juhovh/master

    RSA and AES cleanup
    JH Laird committed Jan 8, 2012
  2. Reap child processes in shairport.c

    James Laird committed Jan 8, 2012
Commits on Nov 10, 2011
Commits on Nov 9, 2011
Commits on Oct 30, 2011
Commits on Oct 10, 2011
  1. Merge pull request #120 from stefdude/master

    1 x bugfix, 1 x improvement, 1 x new feature
    albertz committed Oct 10, 2011
  2. new feature: run program on first connection / run program on last

    I was looking to trigger an action when I connect to shairport.
    Basically, I want to switch on the stereo when I start playing music
    over shairport (and I want to switch if off when I stop streaming).
    Because my set-up will be different than any other set-up, I thought
    about making it generic.
    Two new command-line options --play_prog and --stop_prog take one
    argument: the command line to start when the first connection is made or
    when the last connection quits.
    $ --play_prog="amixer set PCM 100%"
    Stef Simoens committed Oct 10, 2011