No audio over AirTunes (AirPlay w/ video works)

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
gimli Offline
Team-XBMC Developer
Posts: 437
Joined: Jun 2009
Reputation: 9
Post: #11
AirTunes support for the PI is now in master.
find quote
ribbon10 Offline
Junior Member
Posts: 5
Joined: Oct 2012
Reputation: 0
Post: #12
Once again thanks for the Demuxer. But the libshairport problem with the ipv6 patch is still present. This is not part of xbmc itself but the patch is deliverd in the xbmc sources.

So the problem occures on machines that have AF_INET6 defined during compilation but IPv6 is not available on runtime. Here are the relavant xbmc.log entries with a little bit extra enabled debug output. It was captured on an OpenELEC build that have the above preconditions. What should be the default at the moment.

Code:
root ~ # cat .xbmc/temp/xbmc.log | grep AIR
20:07:04 T:1075663376    INFO: AIRPLAY Server: Successfully initialized
20:07:04 T:1075663376   DEBUG: AIRTUNES: initializing shairport
20:07:04 T:1075663376   DEBUG: AIRTUNES: LogLevel: 0
20:07:04 T:1075663376   DEBUG: AIRTUNES: AirName: ShairPort
20:07:04 T:1075663376   DEBUG: AIRTUNES: HWID: '????
20:07:04 T:1075663376   DEBUG: AIRTUNES: HWID_Hex(12): XXXXXXXXXXXX
20:07:04 T:1075663376   DEBUG: AIRTUNES: Starting connection server: specified server port: 36666
20:07:04 T:1075663376   DEBUG: AIRTUNES: Listening on IPv6 Socket
20:07:04 T:1075663376   DEBUG: AIRTUNES: Failed to create ipv6 socket. Trying ipv4
20:07:04 T:1075663376   DEBUG: AIRTUNES: Error: Could not bind socket
20:07:04 T:1075663376   DEBUG: AIRTUNES: Error setting up server socket on port 36666, try specifying a different port

Have made a minimal invasive patch that fixes the problem. But I am not happy with the libshairport src/socketlib.c code at all.
The patch is a a little bit hard to read because it is a patch for the ipv6 patch.

Code:
From ea7356a62cac8f232d1043e055c8dd857f7eaa99 Mon Sep 17 00:00:00 2001
From: ribbon10 <ribbon10>
Date: Sun, 7 Oct 2012 21:53:26 +0200
Subject: [PATCH] libshairport server now starts on system where ipv4 is
enabled on compile time but not on runtime.

---
tools/rbp/depends/libshairport/009_fix_ipv6.patch | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/tools/rbp/depends/libshairport/009_fix_ipv6.patch b/tools/rbp/depends/libshairport/009_fix_ipv6.patch
index 01ff026..a728718 100644
--- a/tools/rbp/depends/libshairport/009_fix_ipv6.patch
+++ b/tools/rbp/depends/libshairport/009_fix_ipv6.patch
@@ -1,5 +1,5 @@
---- src/socketlib.c    2012-01-04 20:41:05.000000000 +0100
-+++ src/socketlib.c    2012-01-04 20:35:53.000000000 +0100
+--- src/socketlib.c    2012-10-07 21:20:09.000000000 +0200
++++ src/socketlib.c    2012-10-07 21:47:37.000000000 +0200
@@ -48,7 +48,7 @@
    if((tSock==-1) && (pAddrInfo->ai_family == AF_INET6) && (errno == EAFNOSUPPORT))
    {
@@ -9,7 +9,15 @@
      pAddrInfo->ai_family = AF_INET;
      tSock = socket(pAddrInfo->ai_family, pAddrInfo->ai_socktype, 0);
    }
-@@ -158,8 +158,8 @@
+@@ -118,6 +118,7 @@
+
+   int tEnable = 1;
+   setsockopt(tSock, SOL_SOCKET, SO_REUSEADDR, &tEnable, sizeof (tEnable));
++  server_addr->ai_addr->sa_family = server_addr->ai_family; // ensure that server_addr has same famliy than the socket
+   if (bind(tSock, server_addr->ai_addr, server_addr->ai_addrlen) < 0)
+   {
+     close(tSock);
+@@ -158,8 +159,8 @@
      sprintf(tService, "%d", pPort); // copies port to string
      int tFamily = AF_INET;
      #ifdef AF_INET6
--
1.7.11.1
(This post was last modified: 2012-10-07 22:08 by ribbon10.)
find quote
Memphiz Offline
Team-XBMC Developer
Posts: 7,915
Joined: Feb 2011
Reputation: 91
Location: germany
Post: #13
We are not happy with libshairports code aswell - but thats what we got for supporting airtunes. We want to switch over to libshairplay after frodo and moving all the airplaycode to an addon aswell. Until then i will try to remember to test and add your patch before frodo.

thx

AppleTV2/iPhone/iPod: HowTo find debug logs and everything else which the devs like so much: click here
HowTo setup NFS for XBMC: Wiki NFS
HowTo configure avahi (zeroconf): Wiki Avahi
READ THE IOS FAQ!: iOS FAQ
find quote
sraue Offline
Team-XBMC Developer
Posts: 803
Joined: Oct 2009
Reputation: 14
Location: Switzerland, Solothurn
Post: #14
(2012-10-04 21:18)ribbon10 Wrote:  Long time since last post here. But AirTunes/AirPlay music support is still broken with openelec. Last build i tested was with xbmc-frodo-35d401b source.

(2012-10-07 08:01)PeteUKinUSA Wrote:  +10 cool points to Gimli. I pulled the latest from Git, added the above patch and files and it works like a champ. Can't thank you enough.

(2012-10-07 09:17)gimli Wrote:  AirTunes support for the PI is now in master.

updated in OpenELEC r12055, see:
http://forum.xbmc.org/showthread.php?tid...pid1208536

greetings, Stephan

[Image: userbar-openelec-001.gif]
[Image: project_thin_badge.gif]
find quote
Memphiz Offline
Team-XBMC Developer
Posts: 7,915
Joined: Feb 2011
Reputation: 91
Location: germany
Post: #15
@ribbon10

Patch can be watched here https://github.com/xbmc/xbmc/pull/1573

thx again. (though i didn't test because everything is ipv6 enabled here - at least it didn't break it. But i just try to trust in you that you have verified it. Well once in a time i try to trust Wink ).

AppleTV2/iPhone/iPod: HowTo find debug logs and everything else which the devs like so much: click here
HowTo setup NFS for XBMC: Wiki NFS
HowTo configure avahi (zeroconf): Wiki Avahi
READ THE IOS FAQ!: iOS FAQ
find quote
dhead Online
Member+
Posts: 192
Joined: May 2010
Reputation: 0
Post: #16
kudos to gimli,
great work.
find quote
StefanK Online
Member+
Posts: 103
Joined: Mar 2012
Reputation: 1
Post: #17
I also cannot play sound over airplay (windows-frodo-alpha2 compiled with spotify).
But being a complete github noob I dont know if the four files from gimli can be used by me - not to say how to use them if they do work...
find quote
Memphiz Offline
Team-XBMC Developer
Posts: 7,915
Joined: Feb 2011
Reputation: 91
Location: germany
Post: #18
Nahh this is definitly not the same issue. Windows uses a different lib. Not really sure if airtunes support for windows was already there in alpha2 tbh. Maybe try a more up to date version.

AppleTV2/iPhone/iPod: HowTo find debug logs and everything else which the devs like so much: click here
HowTo setup NFS for XBMC: Wiki NFS
HowTo configure avahi (zeroconf): Wiki Avahi
READ THE IOS FAQ!: iOS FAQ
find quote
LehighBri Offline
Senior Member
Posts: 237
Joined: Jan 2009
Reputation: 0
Post: #19
I just got my rpi and I've been using openelec builds 12220 through 12350 today and I can't get airplay working in any of them. I have airplay enabled in xbmc with no password protection and zeroconf on too, but my iphone doesn't even detect that an airplay device exists and thus doesn't show the airplay icon (other airplay devices on the same network work fine). I tried raspbmc and confirmed that the airplay icon appears on my iphone (but playback of audio doesn't work) and in xbian both the icon and playback of audio works... video didn't).

How can I further debug this with openelec? Step 1 for me is to figure out why the rpi isn't showing as an airplay device on my iphone. Thoughts on what logs to produce to help debug?
find quote
Post Reply