SamDel / ChromeCast-Desktop-Audio-Streamer

Stream the sound of your desktop to your Chromecast Audio device
MIT License
415 stars 30 forks source link

Audio drop-outs #24

Closed SamDel closed 3 years ago

SamDel commented 5 years ago

Research the audio drop-outs.

Is it due to network load or bad connections? Can something be changed in the streaming or buffering to prevent drop-outs?

GrahamDLL commented 5 years ago

Thank you for this software.

I started using your Chromecast streamer yesterday and the audio dropouts are exactly the same as I get when using the Cast button inside the Chrome browser. My experience suggests that Chromecast devices do not do well when they are connected to a "borderline" network.

I have spent the last few weeks fiddling with the network in my home after I began to receive audio from the Radio Paradise website in FLAC format using the Chrome browser. I use the Cast button in Chrome to stream the audio to three Chromecast devices.

The switch to FLAC put higher bitrate audio on the network and appears to have pushed the Chromecasts over the edge resulting in frequent dropouts of one or more devices. I bought wired Ethernet adapters for the Chromecasts and that improved the situation with a reduction in dropouts. I currently have network cable all over the floor bypassing the 100 Mbps switches that I was using. This has also improved the situation and I have ordered new 1000 Mbps switches to replace the antique switches.

In short, I am pretty confident that I have significantly reduced (or, perhaps, eliminated) dropouts by making my network as good as it can be.

I am happy to help if there is any testing that I can do.

Thank you. Graham.

SamDel commented 5 years ago

Thanks, maybe your solution helps someone else (@FA-Bubba).

We're testing the latest changes in the development thread, feel free to join. You can download the latest test version in that thread. New features are: mp3 support (reduced network load!), group support (synchronizing devices), multilingual support, improved Chromecast control, etc.

FA-Bubba commented 5 years ago

An interesting approach by @grahamdilloway... I do have CAT V wiring to most of the rooms here, but not sure I want to replace the existing switches. AudioStreamer v1.9.45 has been quite stable, with no drop-outs for the past 24 hours. Your App has been steadily improving since I first got involved, and I'm onboard to assist its continued evolution.

Thank you for your GREAT WORK!

SamDel commented 5 years ago

Same here, no dropouts. I'm streaming in mp3 (320 kbps) format most of the time, and you? Indeed, the application improved a lot the last weeks!

FA-Bubba commented 5 years ago

Yes, streaming MP3 at 320 k... As noted in the other thread, I'm using v1.9.47 now.

FA-Bubba commented 4 years ago

I'm getting disconnects on one Speaker Group ("First Floor Speakers"). DAS is loading this Group multiple times, and a quick look at the log revealed these lines:

  Discovered device: First Floor Speakers 192.168.1.75:42148 null

  Discovered device: First Floor Speakers 192.168.1.193:42682 null

  Discovered device: First Floor Speakers 192.168.1.193:42450 null

...at different points just after start-up. Note two different IP Addresses, and the number after the IP Address differs for the entries with the same IP Address.

What could be causing this, and what is a fix?

Full log is attached

Log-2019-11-24-v2-5-2-DropOuts.TXT

SamDel commented 4 years ago

The members of a group elect a leader. I don't know when a new leader is elected (maybe bad connection, devices that are updating, etc.). The application only connects to the leader of the group.

In your log the leader of 'First Floor Speakers' changes three times in two minutes between 'Dining Room Speakers' and 'Kitchen Hub'. The ip changes, and also the port. Normal behaviour is that the port stays the same for a group.

The application tries to resume playing the group when the ip address changes. When the group broadcasts another ID (is not logged) the application also adds a new device box.

It looks like the group had problems electing a leader. I think it will resolve automatically, did it? If not you can try rebooting the devices in the group. And maybe restart the application to cleanup the group boxes.

FA-Bubba commented 4 years ago

When I shut down DAS and restart, one of the duplicated "First Floor Speakers" Groups shows "Connect Error". It isn't clear what is happening, or if this is an attempt to 'resume playing' the Group...

My network Client List shows very good connections to all of the speakers (at least when I looked at it), so I don't know if the 2 speakers you noted above (Dining Room & Kitchen) are experiencing connectivity issues.

I am thinking of simply removing all of the speakers from the First Floor Group & playing individual speakers to monitor for specific issues. .. Unless you can suggest an alternative way to trouble-shoot.

Thank you for your help!

SamDel commented 4 years ago

It looks like the application thinks there are two 'First Floor Speakers' groups now. You can also try to remove the one with the 'Connect Error' from the user.config file, in: C:\Users\<username>\AppData\Local\ChromeCast

Shut down DAS, edit user.config, start DAS again.

FA-Bubba commented 4 years ago

After a full system reboot, I noticed the audio dropping-out several times, so I looked at the Device Box, and noted TWO instances of "First Floor Speakers". One was 'Tan' in color -- I deselected it, then selected the other one, and the drop-outs ceased.

In the Log, there are FOUR 'Discoveries' for the "First Floor Speakers" Group... The 4th instance had a different IP Address, and I am assuming that was the 2nd instance that was displayed in the Device Box. After de-selecting the instance that was failing, I selected the 2nd instance, and the audio has been playing OK since.

I am assuming that there was a problem loading the "First Floor Speaker" Group, and after the IP Address changed, the second instance is working properly.

For me, the BIG questions are:

When this happened a few weeks ago, I edited the config file and removed BOTH instances, reloaded DAS, and everything worked as expected.

I am guessing that the Instance with the 'bad IP Address' was found in the Config file, and DAS was attempting to reload it, but the system reboot may have assigned new IP Addresses to some Devices &/or Groups. It occurs to me that on start-up deleting (or flushing) ALL discovered devices and Groups would enable DAS to find them without using an old IP Address that may have changed. Perhaps a User-Selectable option to "Refresh ALL IP Addresses on Startup" could prevent this. (In it's simplest form, this option would essentially erase all stored IP Addresses, and do a full Discovery Process -- is this feasible?).

Here are the key lines from the attached log that shows the old/new IP Address for this Group:

Discovered device: First Floor Speakers 192.168.1.189:42682 null Discovered device: First Floor Speakers 192.168.1.189:42682 null Discovered device: First Floor Speakers 192.168.1.189:42682 null Discovered device: First Floor Speakers 192.168.1.156:42885 null

Log-2019-12-07-v2-5-2-LoadFailed.zip

SamDel commented 4 years ago

why didn't the second 'Discovery' replace the previous 'Discovery' (instead of having two instances)?

For groups DAS is using the id/uuid (is in user.config) to uniquely identify a group. I'm not sure if that's the right way to do it. In your case it looks like this id changed for 'First Floor Speakers', I thought this id was persisted in a group.

In Setup 2.5.6.zip the application uses the group name to uniquely identify a group. This should prevent double instances of a group(name) in the device list. When there's a new 'Discovered device' with the same group name then the new ip/port is used by the application for this group. I think it should work better this way in most cases. Can you try?

BTW: 'Reset settings' on the options tab also clears the list of known devices! It can be used when the IP address changed for all devices.

FA-Bubba commented 4 years ago

Thank you for the follow-up and suggestions. I tried several things:

While still running v2.5.2, I tried the "Reset Settings", then "Scan Again for Devices" This did not eliminate the duplicate Speaker Group.

I then upgraded to v2.5.6, clicked "Reset Settings", and "Scan Again...". DAS never did find all of my devices; Also, it showed the two Speaker Groups I typically use with "Connect Error" in their respective Device Box. This was BEFORE I tried to click on them to begin Casting.

I tried "Reset Settings", and "Scan Again..." multiple times, but not all Devices were found, and the "Connect Errors" remained.

I have since downgraded back to v 2.5.2, and it is working as before, albeit with multiple instances of one Speaker Group.

Screen Shots & Log are attached.

v-2-5-6-Issues.zip

FA-Bubba commented 4 years ago

Further to this, not every Speaker in the selected Speaker Groups is playing... When I walked-around, I noted several speakers that were not playing (i.e.: No audio output).

See attached screenshot. Devices that have the footnote: "Connected Casting Desktop Audio Streamer" are in fact streaming audio. Devices that only have the footnote: "Connected" are not streaming. In summary, here are the devices, the Group(s) they are assigned to, and their status:

Device Name.........................GROUPS..................................................................STATUS


Basement Mini....................First Floor Speakers & ALL Speakers...........Playing Basement Speakers...........First Floor Speakers & ALL Speakers...........NOT Playing Dining Room Speakers....First Floor Speakers & ALL Speakers...........NOT Playing Family Room Speakers.....First Floor Speakers & ALL Speakers...........NOT Playing Kitchen Hub.........................First Floor Speakers & ALL Speakers...........NOT Playing Study Speakers...................First Floor Speakers & ALL Speakers...........Playing

Guest Room Speakers.....Second Floor Speakers & ALL Speakers......Playing Jade's Room Speakers....Second Floor Speakers & ALL Speakers......Playing Office Speakers.................Second Floor Speakers & ALL Speakers......Playing PlayRoom Speakers.........Second Floor Speakers & ALL Speakers......Playing

Family Room Mini............Not in any Group..................................................NOT Playing Family Room TV................Not in any Group..................................................NOT Playing Office Mini...........................Not in any Group..................................................NOT Playing

The first 10 Devices should be playing, but 4 of them are not... What can explain this behaviour?

NotAllSpkrsPlaying

FA-Bubba commented 4 years ago

I renamed two of the Speaker Groups, and removed ALL "DiscoveredDevice" references from the config file. All seems to be working OK now:

RenamedGroups-OK

SamDel commented 4 years ago

Thanks for letting me know. I'm not sure what was causing the duplicate entries.

In 2.5.8 the 'Reset settings' button 'really' clears the device list, and also clears the devices in the devices box. After clearing it's doing an automatic 'Scan for devices' now.