mikebrady / shairport-sync

AirPlay and AirPlay 2 audio player
Other
7.29k stars 574 forks source link

How to use the aac encoding format when integrating shaiport sync 4.3.2 into Linux devices with arm64 architecture?[Problem]: #1807

Closed Biao7 closed 6 months ago

Biao7 commented 8 months ago

What happened?

I have a question: I integrated sharport sync 4.3.2 in the Linux system, which supports airplay 2 functionality. I am using an iPhone to connect to a Linux device and can connect normally, but the audio encoding transmitted is default to using Alac. How can I have my phone send audio data encoded with AAC? Can we modify the code of sharport sync to force the use of aac encoding format for data processing during connection negotiation?

Relevant log output

0.000374208 "rtsp.c:5316" Connection 1: RTSP Response:
         0.000101792 "rtsp.c:5317"   Response Code: 400.
         0.000069708 "rtsp.c:5317"   Type: "CSeq", content: "12"
         0.000074667 "rtsp.c:5317"   Type: "Server", content: "AirTunes/366.0"
         0.000077291 "rtsp.c:5317"   No Content Plist. Content length: 0.
         0.000719834 "rtsp.c:872" msg_free freed message 26
         0.000163916 "rtsp.c:872" msg_free freed message 25
         0.000085459 "rtsp.c:5229" mutex_lock "&conns_lock".
         0.000085166 "common.c:1687" mutex_unlock "&conns_lock" at "rtsp.c:5236".
         0.744088917 "dacp.c:503" mutex_lock "&dacp_server_information_lock".
         1.263851751 "rtsp.c:782" msg_init message 27
         0.000184625 "rtsp.c:896" RTSP Message Received: "POST /feedback RTSP/1.0".
         0.000121333 "rtsp.c:927"     CSeq: 13.
         0.000091000 "rtsp.c:927"     DACP-ID: AE3560490A904467.
         0.000080500 "rtsp.c:927"     Active-Remote: 4035741149.
         0.000082834 "rtsp.c:927"     User-Agent: AirPlay/710.79.1.
         0.000130375 "rtsp.c:782" msg_init message 28
         0.000091583 "rtsp.c:5255" conbiao: Connection 1: Received an RTSP Packet of type "POST":
         0.000082250 "rtsp.c:5257"   Type: "CSeq", content: "13"
         0.000073500 "rtsp.c:5257"   Type: "DACP-ID", content: "AE3560490A904467"
         0.000074375 "rtsp.c:5257"   Type: "Active-Remote", content: "4035741149"
         0.000074375 "rtsp.c:5257"   Type: "User-Agent", content: "AirPlay/710.79.1"
         0.000075250 "rtsp.c:5257"   No Content Plist. Content length: 0.
         0.000092167 "rtsp.c:2430" Connection 1: POST /feedback Content-Length 0
         0.000077000 "rtsp.c:2432"   Type: "CSeq", content: "13"
         0.000072625 "rtsp.c:2432"   Type: "DACP-ID", content: "AE3560490A904467"
         0.000072625 "rtsp.c:2432"   Type: "Active-Remote", content: "4035741149"
         0.000072333 "rtsp.c:2432"   Type: "User-Agent", content: "AirPlay/710.79.1"
         0.000074375 "rtsp.c:2432"   No Content Plist. Content length: 0.
         0.000122792 "rtsp.c:5316" Connection 1: RTSP Response:
         0.000082541 "rtsp.c:5317"   Response Code: 200.
         0.000074084 "rtsp.c:5317"   Type: "CSeq", content: "13"
         0.000071750 "rtsp.c:5317"   Type: "Server", content: "AirTunes/366.0"
         0.000077000 "rtsp.c:5317"   No Content Plist. Content length: 0.
         0.000706416 "rtsp.c:872" msg_free freed message 28
         0.000166250 "rtsp.c:872" msg_free freed message 27
         0.000066209 "rtsp.c:5229" mutex_lock "&conns_lock".
         0.000070000 "common.c:1687" mutex_unlock "&conns_lock" at "rtsp.c:5236".
         0.452852458 "rtsp.c:782" msg_init message 29
         0.000213208 "rtsp.c:896" RTSP Message Received: "SETUP rtsp://2408:8456:a613:3e6e:da44:1d49:d1ef:13eb/13493227198529357339 RTSP/1.0".
         0.000159542 "rtsp.c:927"     Content-Length: 350.
         0.000065042 "rtsp.c:927"     Content-Type: application/x-apple-binary-plist.
         0.000086625 "rtsp.c:927"     CSeq: 14.
         0.000073791 "rtsp.c:927"     DACP-ID: AE3560490A904467.
         0.000106750 "rtsp.c:927"     Active-Remote: 4035741149.
         0.000134459 "rtsp.c:927"     User-Agent: AirPlay/710.79.1.
         0.000098291 "rtsp.c:782" msg_init message 30
         0.000083417 "rtsp.c:5255" conbiao: Connection 1: Received an RTSP Packet of type "SETUP":
         0.000079333 "rtsp.c:5257"   Type: "Content-Length", content: "350"
         0.000073500 "rtsp.c:5257"   Type: "Content-Type", content: "application/x-apple-binary-plist"
         0.000077875 "rtsp.c:5257"   Type: "CSeq", content: "14"
         0.000073500 "rtsp.c:5257"   Type: "DACP-ID", content: "AE3560490A904467"
         0.000077000 "rtsp.c:5257"   Type: "Active-Remote", content: "4035741149"
         0.000073500 "rtsp.c:5257"   Type: "User-Agent", content: "AirPlay/710.79.1"
         0.000501084 "rtsp.c:5257"   Content Plist (as XML):
--
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>streams</key>
        <array>
                <dict>
                        <key>audioFormat</key>
                        <integer>262144</integer>
                        <key>supportsDynamicStreamID</key>
                        <true/>
                        <key>streamConnectionID</key>
                        <integer>-3918528415999638601</integer>
                        <key>ct</key>
                        <integer>2</integer>
                        <key>audioMode</key>
                        <string>default</string>
                        <key>spf</key>
                        <integer>352</integer>
                        <key>controlPort</key>
                        <integer>61903</integer>
                        <key>latencyMax</key>
                        <integer>88200</integer>
                        <key>isMedia</key>
                        <true/>
                        <key>type</key>
                        <integer>96</integer>
                        <key>sr</key>
                        <integer>44100</integer>
                        <key>shk</key>
                        <data>
                        1mnvphuYDaeVpFQUqo81m0x9hPwLte+Y5Mbf7qZAke0=
                        </data>
                        <key>latencyMin</key>
                        <integer>11025</integer>
                </dict>
        </array>
</dict>
</plist>
--
         0.000901250 "rtsp.c:2870" conbiao: Connection 1: SETUP (AirPlay 2)
         0.000099750 "rtsp.c:2871" conbiao: SETUP (AirPlay 2) SETUP incoming message
         0.000077875 "rtsp.c:2871"   Type: "Content-Length", content: "350"
         0.000075541 "rtsp.c:2871"   Type: "Content-Type", content: "application/x-apple-binary-plist"
         0.000076125 "rtsp.c:2871"   Type: "CSeq", content: "14"
         0.000070000 "rtsp.c:2871"   Type: "DACP-ID", content: "AE3560490A904467"
         0.000076125 "rtsp.c:2871"   Type: "Active-Remote", content: "4035741149"
         0.000075542 "rtsp.c:2871"   Type: "User-Agent", content: "AirPlay/710.79.1"
         0.000462000 "rtsp.c:2871"   Content Plist (as XML):
--
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>streams</key>
        <array>
                <dict>
                        <key>audioFormat</key>
                        <integer>262144</integer>
                        <key>supportsDynamicStreamID</key>
                        <true/>
                        <key>streamConnectionID</key>
                        <integer>-3918528415999638601</integer>
                        <key>ct</key>
                        <integer>2</integer>
                        <key>audioMode</key>
                        <string>default</string>
                        <key>spf</key>
                        <integer>352</integer>
                        <key>controlPort</key>
                        <integer>61903</integer>
                        <key>latencyMax</key>
                        <integer>88200</integer>
                        <key>isMedia</key>
                        <true/>
                        <key>type</key>
                        <integer>96</integer>
                        <key>sr</key>
                        <integer>44100</integer>
                        <key>shk</key>
                        <data>
                        1mnvphuYDaeVpFQUqo81m0x9hPwLte+Y5Mbf7qZAke0=
                        </data>
                        <key>latencyMin</key>
                        <integer>11025</integer>
                </dict>
        </array>
</dict>
</plist>
--
         0.001229958 "rtsp.c:3212" conbiao: Connection 1: SETUP on PTP stream. A "streams" array has been found
         0.000107625 "rtsp.c:3215" conbiao: conn->airplay_stream_category == ptp_stream
         0.000083417 "ptp-utilities.c:223" Send control message to NQPTP: "/nqptp B"
         0.000714292 "rtsp.c:3241" Connection 1: UDP control port opened: 37568.
         0.000536375 "rtsp.c:3250" Connection 1: SETUP AP2 -- Active-Remote string seen: "4035741149".
         0.000139125 "rtsp.c:760" msg_free increment reference counter message 29 to 2.
         0.000205333 "rtsp.c:760" msg_free increment reference counter message 29 to 3.
         0.000048125 "rtsp.c:505" metadata queue- "pipe" 0/500.
         0.000074667 "rtsp.c:760" msg_free increment reference counter message 29 to 4.
         0.000079042 "rtsp.c:505" metadata queue- "multicast" 0/500.
         0.000079625 "rtsp.c:4093"                                                                     multicast: type 73736e63, code 61637265, length 10, message 29.
         0.000063291 "rtsp.c:760" msg_free increment reference counter message 29 to 5.
         0.000021875 "rtsp.c:4104"                                                                     multicast: done.
         0.000028292 "rtsp.c:505" metadata queue- "mqtt" 0/500.
         0.000064458 "rtsp.c:856" msg_free decrement reference counter message 29 to 4
         0.000030625 "rtsp.c:505" metadata queue- "hub" 0/500.
         0.000169167 "rtsp.c:4132"                     hub: type 73736e63, code 61637265, length 10, message 29.
         0.000116375 "rtsp.c:4139"                     hub: done.
         0.000020708 "rtsp.c:4061"      pipe: type 73736e63, code 61637265, length 10, message 29.
         0.000104417 "rtsp.c:3270" Connection 1: SETUP AP2 -- DACP-ID string seen: "AE3560490A904467".
         0.000193958 "rtsp.c:856" msg_free decrement reference counter message 29 to 3
         0.000325208 "rtsp.c:4067"      pipe: done.
         0.000225167 "rtsp.c:856" msg_free decrement reference counter message 29 to 2
         0.000100333 "rtsp.c:856" msg_free decrement reference counter message 29 to 1
         0.000211459 "rtsp.c:760" msg_free increment reference counter message 29 to 2.
         0.000131541 "rtsp.c:760" msg_free increment reference counter message 29 to 3.
         0.000027709 "rtsp.c:505" metadata queue- "pipe" 0/500.
         0.000102375 "rtsp.c:760" msg_free increment reference counter message 29 to 4.
         0.000117541 "rtsp.c:760" msg_free increment reference counter message 29 to 5.
         0.000016917 "rtsp.c:505" metadata queue- "multicast" 0/500.
         0.000020125 "rtsp.c:505" metadata queue- "mqtt" 0/500.
         0.000052500 "rtsp.c:4093"                                                                     multicast: type 73736e63, code 64616964, length 16, message 29.
         0.000167708 "rtsp.c:3291" conbiao: item_value = 96.
         0.000159250 "rtsp.c:4104"                                                                     multicast: done.
         0.000073500 "rtsp.c:856" msg_free decrement reference counter message 29 to 4
         0.000023042 "rtsp.c:505" metadata queue- "hub" 0/500.
         0.000077875 "rtsp.c:4061"      pipe: type 73736e63, code 64616964, length 16, message 29.
         0.000282917 "rtsp.c:4132"                     hub: type 73736e63, code 64616964, length 16, message 29.
         0.000032083 "rtsp.c:3296" conbiao: Connection 1. AP2 Realtime Audio Stream.
         0.000060375 "rtsp.c:4067"      pipe: done.
         0.000025667 "rtsp.c:3297" Realtime Audio Stream SETUP incoming message
         0.000100625 "rtsp.c:3297"   Type: "Content-Length", content: "350"
         0.000077292 "rtsp.c:856" msg_free decrement reference counter message 29 to 3
         0.000099750 "rtsp.c:3297"   Type: "Content-Type", content: "application/x-apple-binary-plist"
         0.000128333 "rtsp.c:4139"                     hub: done.
         0.000207083 "rtsp.c:3297"   Type: "CSeq", content: "14"
         0.000017500 "rtsp.c:856" msg_free decrement reference counter message 29 to 2
         0.000170917 "rtsp.c:3297"   Type: "DACP-ID", content: "AE3560490A904467"
         0.000133875 "rtsp.c:856" msg_free decrement reference counter message 29 to 1
         0.000045500 "rtsp.c:3297"   Type: "Active-Remote", content: "4035741149"
         0.000150500 "rtsp.c:3297"   Type: "User-Agent", content: "AirPlay/710.79.1"
         0.000509541 "rtsp.c:3297"   Content Plist (as XML):

System Information.

rk3308 arm64

Configuration Information.

root@rk3308bs-buildroot:/# shairport-sync --displayConfig
warning: conbiao: main start!

warning: conbiao: if define CONFIG_AIRPLAY_2!

warning: conbiao: CONFIG_AIRPLAY_2 has been defined!

>> Display Config Start.

From "uname -a":
 Linux rk3308bs-buildroot 5.10.160+ #10 SMP PREEMPT Mon Feb 19 10:24:40 CST 2024 aarch64 GNU/Linux

From /etc/os-release:
 Buildroot 2021.11

From /sys/firmware/devicetree/base/model:
 Rockchip RK3308B-S evb digital-pdm mic v11 board

Shairport Sync Version String:
 4.3.2-AirPlay2-smi10-libdaemon-OpenSSL-Avahi-ALSA-stdout-pipe-soxr-convolution-metadata-mqtt-dbus-mpris-sysconfdir:/etc

Command Line:
 shairport-sync --displayConfig

Configuration File:
 /etc/shairport-sync.conf

Configuration File Settings:
 general :
 {
   name = "smart_airplay";
 };
 alsa :
 {
   output_device = "pulse";
 };
 stdout :
 {
 };
 ao :
 {
 };

>> Display Config End.
>> Goodbye!
root@rk3308bs-buildroot:/#

PulseAudio or PipeWire installed?

How did you install Shairport Sync?

Built from source

Check previous issues

mikebrady commented 8 months ago

Please see the discussion here.

github-actions[bot] commented 6 months ago

This issue has been inactive for 28 days so will be closed 7 days from now. To prevent this, please remove the "stale" label or post a comment.