airplay audio help
#1
Hello. I am looking for some help with airplay audio. Video works great but audio only I get frequent drops/stutters. I am using my iPhone 5S hotspot to airplay to an iPhone 4s. Obviously it's not a router and I considered maybe it's a wifi reception issue but since video works great maybe it's a buffering issue? I tried to educate myself to self troubleshoot. I saw and read through info regarding advancedsettings.xml but it looks like increasing the cache that way is intended for video cache. I discovered the git repo for shairplay and saw this comment in an issue thread:

Quote:"If you have time, could you try to play with the buffer values? The resend buffer can be found from src/lib/raop_buffer.c and can be increased by changing the value #define RAOP_BUFFER_LENGTH 16 (length in packets). If the CLI tool is used, the audio buffer is at src/shairplay.c inside shairplay_session_t struct as the char buffer[8192]; array (length in bytes). If suitable buffer sizes for non-stutter sound could be found just by modifying these, it would be quite easy."

But in kodi it looks like the shairplay file is a dynamic library so I don't know how to compile (if that's the right term) an edited version of the repo into a dynamic library for kodi. My log is located here

Any help is appreciated.
Reply
#2
I'm still having trouble with this if anyone could help. I made a new log that has airtune logging enabled:log file The Airtunes part doesn't start until near line 964
Reply
#3
Well this use case is so fragil - iwouldn't expect any help on it.
AppleTV4/iPhone/iPod/iPad: HowTo find debug logs and everything else which the devs like so much: click here
HowTo setup NFS for Kodi: NFS (wiki)
HowTo configure avahi (zeroconf): Avahi_Zeroconf (wiki)
READ THE IOS FAQ!: iOS FAQ (wiki)
Reply
#4
(2016-09-09, 07:10)Memphiz Wrote: Well this use case is so fragil - iwouldn't expect any help on it.

By fragil are you referring to the age of using an iphone 4 as the airplay receiver device? If so would a Rpi 3 be a better alternative? The reason for utilizing the iphone 4s is this is a car installation. The 4s sits in my glove box with the video and audio out to my vehicle's inbuilt monitor/amplifier while I use the 5s on ios 8 as my primary phone and airplay apple music to kodi. Like I mentioned before video works fine without drops while audio only has this stuttering issue. Perhaps ALAC is more data than compressed video.
Reply
#5
Is there a way to change the buffer for audio? I found this commentary on the shairport git under an open issue, maybe it provides some insight?

Quote:@juhovh

Currently shairplay keeps as small buffer as possible with default values
I had another look into your code. Buffering is done in the audio_process() function of shairplay.c:
if (session->buflen+buflen < sizeof(session->buffer)) { memcpy(session->buffer+session->buflen, buffer, buflen); session->buflen += buflen; return; }

Audio data is always buffered until the buffer is full. Buffer size is hardcoded to 8192 bytes in shairplay_session_t. Assuming stereo 16-bit audio and 48 kHz sampling frequency, this means about 42ms of latency here.

Another buffer raop_rtp->buffer is found in raop_rtp.c which is hardcoded to maximum 32 packets. Each packet should contain 4096 audio frames by default (see frameLength here). Assuming 48 kHz sampling frequency this means 85ms latency per packet. Obviously the buffer could provide lots of latency when getting full, however it seems it is processed immediately when packages arrive in the correct order.

It seems the reason for having lots of latency is within KODI. Digging a bit deeper I found that KODI uses its own callback functions for handling audio processing (see CAirTunesServer::Initialize in xbmc/network/AirTunesServer.cpp). Audio data is written to a pipe instead of directly being sent to the audio output device like shairplay actually does.
Reply

Logout Mark Read Team Forum Stats Members Help
airplay audio help0