albertz/shairport — Issue #117: distorted audio after sequence number wraps
Author: stefdude
Created: 2011-10-09 17:13:12+00:00
State: open

I notice audio distortion every time the sequence number wraps (FFFF=>0000).

Why? Because (with the default setting of BUFFER_FRAMES as 320), buffer_put_packet() stores sequence FFFF in audio_buffer 255 (65535 mod 320 = 255) ... and sequence 0000 is stored in audio_buffer 0 (0 mod 320 = 0).

Changing BUFFER_FRAMES to 512 (or any other power of two) does not provoke this problem.
Another non-trivial solution would be to review the BUFIDX-macro...