philippe44 / AirConnect

Use AirPlay to stream to UPnP/Sonos & Chromecast devices
Other
3.52k stars 217 forks source link

Aircast stops while playing on Google Nest Hub (Max) #479

Closed vilcenzo closed 11 months ago

vilcenzo commented 1 year ago

Hello,

I try using aircast on a raspberry 32 bits armv7l but every time I try to stream on my Google Nest Hub Max the program stops working without displaying any error message. Even with maximum debug level no error message is displayed. uname -a: Linux raspberrypi 6.1.21-v7+ #1642 SMP Mon Apr 3 17:20:52 BST 2023 armv7l GNU/Linux

vilcenzo@raspberrypi:~ $ cat /etc/os-release PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)" NAME="Raspbian GNU/Linux" VERSION_ID="11" VERSION="11 (bullseye)" VERSION_CODENAME=bullseye ID=raspbian ID_LIKE=debian HOME_URL="http://www.raspbian.org/" SUPPORT_URL="http://www.raspbian.org/RaspbianForums" BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs" vilcenzo@raspberrypi:~ $

Binary version (standards options): aircast-linux-arm

Log:

[06:39:15.811924] http_thread_func:1060 [0x705056e8]: got HTTP connection 19 (silent frames 0) [06:39:15.888927] buffer_put_packet:620 [0x705056e8]: fill [level:1537] [W:62400 R:60864] [06:39:16.027914] handle_http:1236 [0x705056e8]: received GET HTTP/1.1 Host: 192.168.68.80:58437 Connection: keep-alive User-Agent: Mozilla/5.0 (Fuchsia) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36 CrKey/1.56.500000 Accept-Encoding: identity;q=1, ;q=0 Accept: /* CAST-DEVICE-CAPABILITIES: {"bluetooth_supported":true,"display_supported":true,"hi_res_audio_supported":false,"remote_control_input_supported":false,"touch_input_supported":true} Accept-Language: fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7 Range: bytes=0-

[06:39:16.028552] handle_http:1281 [0x705056e8]: responding: HTTP/1.0 200 OK Server: HairTunes Content-Type: audio/flac Connection: close

[06:39:16.028906] _buffer_get_frame:919 [0x705056e8]: Buffer overrun 1562 [06:39:16.028965] _buffer_get_frame:959 [0x705056e8]: drain [level:960 gap:-5915] [W:62425 R:61465] [R:0 S:0 F:0] [06:39:16.072084] _buffer_get_frame:959 [0x705056e8]: drain [level:454 gap:-1872] [W:62431 R:61977] [R:0 S:0 F:0] [06:39:16.281592] CastSocketThread:673 [0x20574f0]: Media session id 1 [06:39:16.355738] ProcessQueue:455 [0x20574f0]: Processing PLAY (id:6) [06:39:16.416062] ProcessQueue:448 [0x20574f0]: Processing VOLUME (id:8) [06:39:16.416283] MRThread:292 [0x20574f0]: Cast playing [06:39:16.525014] _buffer_get_frame:959 [0x705056e8]: drain [level:0 gap:1756] [W:62489 R:62489] [R:0 S:0 F:0] [06:39:17.442094] ProcessQueue:455 [0x20574f0]: Processing PLAY (id:10) [06:39:17.505563] ProcessQueue:455 [0x20574f0]: Processing PLAY (id:11) [06:39:17.600653] ProcessQueue:455 [0x20574f0]: Processing PLAY (id:12) [06:39:17.654067] ProcessQueue:455 [0x20574f0]: Processing PLAY (id:13) [06:39:17.701544] ProcessQueue:455 [0x20574f0]: Processing PLAY (id:14) vilcenzo@raspberrypi:~ $

philippe44 commented 1 year ago

Can you try another platform?

philippe44 commented 1 year ago

Maybe try 1.1.8, I've just fixed a bug that would lead to crash

IcySakura commented 1 year ago

This problem still exist in 1.1.9. It would connect, play for maybe 1~2 seconds, and then crashed.

Server: Ubuntu 22.04 x86-64 (6.2.0-31-generic) Client: iPhone 14 Pro (iOS 17) Chromecast Device: Google Nest Hub

philippe44 commented 1 year ago

All, per previous request did you try to run it on any other platform?

jcthomsonjr commented 1 year ago

Also experiencing this in the Home Assistant Add on (Home Assistant OS on Raspberry Pi), which is updated AirConnect v 1.2.0. The issue does not happen when casting to a Nest Mini. Starting playback on the home device and switching to Casting on the Hub appears to force the Hub playback to start. If there are any debug steps, please let us know.

philippe44 commented 1 year ago

Sorry but what do you exactly experience?

jcthomsonjr commented 1 year ago

When a Google Hub is selected as the playback device, it shows the album information and a playback bar. The audio plays for 2 seconds and stops, dropping the connection. I've managed to turn on logging and I think the relevant error is: "Service AirCast exited with code 256 (by signal 13)" (note AirCast is the Home Assistant add in name). Thanks for being so responsive.

philippe44 commented 1 year ago

oh, then that's a crash indeed. Do you know how to use gdb by any chance?

jcthomsonjr commented 1 year ago

Sorry that I do not, and it looks like it would be a heavy lift to set up on the systems I have available (Mac and the Raspberry Pi).

philippe44 commented 1 year ago

On a Mac it's a real pain I agree but on a Pi (assuming Raspberry Pi OS) it's just another apt-get. But without that, it's difficult to figure out. You can always try a log will "-d all=sdebug" to see if it gives me a better idea where it crashes.

litecross91 commented 12 months ago

I have same issue. I have two google nest hub and I can't play any podcast or stream from my iPhone with airplay.... The streaming stop after 3-5 sec and disconnect. I have Chromecast for tv and google home mini --> These work perfectly.

Server: Rpi3, HA OS, up to date all component

Log detail:

22:59:41.894745] CastSocketThread:656 [0x3d54e210]: Receiver launched [22:59:41.896332] ProcessQueue:448 [0x3d54e210]: Processing VOLUME (id:3) [22:59:42.013456] ProcessQueue:448 [0x3d54e210]: Processing VOLUME (id:5) [22:59:43.041296] ProcessQueue:483 [0x3d54e210]: Processing LOAD (id:6) [22:59:43.458318] http_thread_func:1060 [0x7fa4004dc0]: got HTTP connection 20 (silent frames 0) [22:59:43.698724] handle_http:1237 [0x7fa4004dc0]: received GET HTTP/1.1 Host: 192.168.50.9:54251 Connection: keep-alive User-Agent: Mozilla/5.0 (Fuchsia) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36 CrKey/1.56.500000 Accept-Encoding: identity;q=1, ;q=0 Accept: /* CAST-DEVICE-CAPABILITIES: {"bluetooth_supported":true,"display_supported":true,"hi_res_audio_supported":false,"remote_control_input_supported":false,"touch_input_supported":true} Accept-Language: en-GB,en-US;q=0.9,en;q=0.8 Range: bytes=0- [22:59:43.699284] handle_http:1293 [0x7fa4004dc0]: responding: HTTP/1.0 200 OK Server: HairTunes Content-Type: audio/flac Connection: close

[22:59:43.699518] _buffer_get_frame:959 [0x7fa4004dc0]: drain [level:484 gap:-2120] [W:61386 R:60902] [R:0 S:0 F:0] [22:59:43.897961] buffer_put_packet:620 [0x7fa4004dc0]: fill [level:1] [W:61414 R:61414] [22:59:43.906227] CastSocketThread:670 [0x3d54e210]: Media session id 1 [22:59:43.908463] _buffer_get_frame:959 [0x7fa4004dc0]: drain [level:1 gap:1757] [W:61415 R:61414] [R:0 S:0 F:0] [22:59:43.972903] ProcessQueue:455 [0x3d54e210]: Processing PLAY (id:8) [22:59:44.048070] ProcessQueue:448 [0x3d54e210]: Processing VOLUME (id:10) [22:59:44.048307] MRThread:292 [0x3d54e210]: Cast playing [22:59:45.105118] ProcessQueue:455 [0x3d54e210]: Processing PLAY (id:13) [22:59:45.179241] ProcessQueue:455 [0x3d54e210]: Processing PLAY (id:14) [22:59:45] INFO: Service AirCast exited with code 256 (by signal 13) [22:59:46] INFO: Starting the AirCast server... [22:59:48.968515] main:916 Starting aircast version: v1.2.0 (Sep 8 2023 @ 18:59:18) [22:59:48.970338] Start:682 Binding to eth0@192.168.50.9 [22:59:48.971608] Start:708 Starting pico HTTP server on port 54733 [22:59:48.997801] AddCastDevice:646

philippe44 commented 12 months ago

As said above, there is a crash happening and I need somebody that can run gdb to locate it

litecross91 commented 12 months ago

Okay. How can I help you?

philippe44 commented 12 months ago

Run aircast, not as a service, but directly as an application, using gdb and see where it crashes.once I have this information, it will likely be easy to fix it

litecross91 commented 12 months ago

I don't know how can use gdb on rpi with Home Assistant OS. I have terminal but gdb command is unknown. Please give me a step by step help.

sitrukx commented 11 months ago

So I am having the same problem described above. Everything works well on a google home mini, but using a Google Home Hub Max, the stream will start and then stop after only playing for a few seconds.
I've attached a file of the terminal output running at the higher debug level you specified above: aircast-linux Debug log.txt

I also installed gdb and ran aircast through there to try and capture the crash log. Interestingly, when running in gdb, the aircast app doesn't crash. It just endlessly prints out that it is filling the stream buffer, but never drains it and nothing ever plays from the speaker. The home hub max does chime and change the screen to the text indicating it's waiting for a stream, but it never starts playing anything. If I cast it to a google home mini in gdb, the stream works just fine and plays as it should, printing out the fill and drain messages as it should.

Let me know if there is something else I can try to capture to help you find the cause. just FYI, I'm running it normally as an add on for Home Assistant, but for this log ran the linux-armv6 binary on a Raspberry Pi W2 running Raspian Bullseye. Thanks!

Edit to add: I also just tried the Windows aircast.exe and it seemed to work just fine, though it never loaded the album art picture. I don't have an issue with that, just thought it may help shed some light.

philippe44 commented 11 months ago

oh ... I think I finally found the issue thanks to your debug log. Please give a try to 1.2.3

litecross91 commented 11 months ago

Thank you! Will this update somehow be included in HomeAssistant AirCast? aircast

philippe44 commented 11 months ago

Probably, but I need to know if it worked for you first

sitrukx commented 11 months ago

It looks like the log got a couple of lines further, but the song still stops after a few seconds. I've attached a new log file. This version still doesn't crash in gdb. aircast-linux Debug log 1.2.3.txt

I've also added a log from the stream working in windows all the way through hitting control-C to stop the app. aircast-linux Debug log 1.2.3_windows.txt

Let me know if there is anything else I can do to test for you.

philippe44 commented 11 months ago

It's unlikely but I might have missed something in the build. Can you try the attached files? airupnp-linux-armv6.zip

hikayke commented 11 months ago

Getting the same issue with a regular Nest Hub 2nd Gen. Using it with the Nest Mini works flawlessly.

sitrukx commented 11 months ago

I got version 1.2.4 to crash in gdb. It didn't load symbols, but it does show a SIGPIPE error. I've attached the log and I'm pulling down the entire repository now to see if I can get a more useful log generated in gdb. gdb.txt

I got a more useful error at the end: gdb_new.txt

philippe44 commented 11 months ago

I'll look at them. let me know if you want to rebuild and need help or I can build a version with full debug symbols

philippe44 commented 11 months ago

ah, this time it might really work... (see attached) aircast-linux-arm.zip

[edit]: if this works, I'd appreciate a log but just in "info" level and waiting at least 2 minutes after the end of a track to make sure that all resources are released.

litecross91 commented 11 months ago

My fingers are crossed that it works.

sitrukx commented 11 months ago

That worked! I've got to run off to work this morning, but I'll get the log for you this evening. Thanks!

sitrukx commented 11 months ago

I've attached an info level log from the system playing a song and then transferring back to the phone and waiting for a couple of minutes until after the google home max screen goes back to normal. Thanks again for the help! info_log.txt

philippe44 commented 11 months ago

Thanks - There was a remaining issue as I suspected, I've uploaded an updated version

philippe44 commented 11 months ago

I'll close that now - @sitrukx, thanks for your help!

litecross91 commented 11 months ago

I updated the latest version 3.6.1 on HA. It works on Nest Hub gen 2 but doesn't work on Nest Hub gen 1. Thank you!

philippe44 commented 11 months ago

I don't know what version is being used on HA