swyh-rs icon indicating copy to clipboard operation
swyh-rs copied to clipboard

Are there any low-latency alternative software options for Mac OS?

Open luojiego opened this issue 1 year ago • 18 comments

About a year ago, I started experimenting with swyh-rs and noticed some latency on Windows. At that time, I felt it was acceptable as long as I could listen to music normally. However, recently I found that it's almost latency-free on Windows, making it suitable for watching videos or movies without any lag. But on Mac OS, I haven't come across software that's as efficient. I'm curious about what alternative software people use on Mac? Or is there any plan to adapt it for Mac?

luojiego avatar Aug 20 '23 03:08 luojiego

I'm sorry but I don't have a Mac so I can't adapt it myself, and I know nothing about Mac software...

dheijl avatar Aug 20 '23 10:08 dheijl

Thank you for your response. I sought help in the Sonos subreddit but found that the latency is too significant to ignore. I believe I'll use Windows to watch movies.

luojiego avatar Aug 20 '23 15:08 luojiego

Hi there - I appreciate that @dheijl doesn't have a mac, but I managed to successfully build swyh-rs on mac, but I keep receiving this error and no upnp devices are found. Do you have any idea on how I could possibly remedy this?

[ERROR] *E*E>Error reading SSDP M-SEARCH response: Resource temporarily unavailable (os error 35)
17:04:29 [ERROR] No renderers found!!!
Error: -1

Nosh118 avatar Aug 27 '23 17:08 Nosh118

Apparently the MAC returns a non-standard error code for EAGAIN:

in src/rendercontrol.rs at line 561:

            Err(e) => {
                // ignore socket read timeout on Windows or EAGAIN on Linux
                if !(e.to_string().contains("10060") || e.to_string().contains("os error 11")) {
                    logger(format!("*E*E>Error reading SSDP M-SEARCH response: {e}"));
                }
            }

I suppose that adding an additional check for "os error 35" here could solve it. Could you try this?

dheijl avatar Aug 27 '23 19:08 dheijl

Could you send across a specific code block to paste in? not very well versed in rust or error handling unfortunately

Nosh118 avatar Aug 27 '23 19:08 Nosh118

I applied the change on Github, so you can use the current master. But this is the changed code:

Err(e) => {
                // ignore socket read timeout on Windows or EAGAIN/EWOULBLOCK on Linux/Unix/MacOS
                if !(e.to_string().contains("10060")
                    || e.to_string().contains("os error 11")
                    || e.to_string().contains("os error 35"))
                {
                    logger(format!("*E*E>Error reading SSDP M-SEARCH response: {e}"));
                }
            }

dheijl avatar Aug 28 '23 06:08 dheijl

Thank you very much! Will report back once I rebuild.

Nosh118 avatar Aug 28 '23 08:08 Nosh118

Thank you @dheijl, that has resolved that error, although no devices are showing in the list, just as before. I have tried running with sudo and manually allowing through the firewall.

No worries if this isn't something you're able to solve though, I know you don't have a mac!

Nosh118 avatar Aug 28 '23 09:08 Nosh118

Can you run it with log level debug, and then attach the log file here? Or did you check already in the log that no devices are responding to the ssdp query?

dheijl avatar Aug 28 '23 09:08 dheijl

18:11:49 [DEBUG] (1) swyh_rs_cli: Try capturing system audio
18:11:49 [INFO] Capturing audio from: MacBook Pro Speakers
18:11:49 [INFO] Default audio SupportedStreamConfig { channels: 2, sample_rate: SampleRate(44100), buffer_size: Range { min: 14, max: 4096 }, sample_format: F32 }
18:11:49 [INFO] Discover networks
18:11:49 [INFO] Starting SSDP discovery
18:11:49 [INFO] The streaming server is listening on http://192.168.1.71:5901/stream/swyh.wav
18:11:49 [DEBUG] (3) swyh_rs::openhome::rendercontrol: SSDP discovery started
18:11:49 [INFO] Streaming sample rate: 44100, bits per sample: 16, format: LPCM
18:11:49 [DEBUG] (4) tiny_http: Server listening on 192.168.1.71:5901
18:11:49 [DEBUG] (5) tiny_http: Running accept thread
18:11:52 [DEBUG] (3) swyh_rs::openhome::rendercontrol: Getting new renderer descriptions
18:11:52 [DEBUG] (3) swyh_rs::openhome::rendercontrol: SSDP discovery complete
18:11:54 [ERROR] No renderers found!!!
Error: -1

Nosh118 avatar Aug 28 '23 18:08 Nosh118

Thanks, but:

  • debug logging is not activated (-l debug)
  • this is not the complete log file, just an excerpt

Can you attach the complete log file using the GitHub drag and drop feature?

But anyway it looks like the SSDP responses from UPNP devices are not getting through. Other programs seem to have similar problems using UDP on recent MAC OS versions according to Reddit ...

dheijl avatar Aug 28 '23 18:08 dheijl

Perhaps this explains it:

https://forum.xojo.com/t/big-sur-udp-broadcast-not-working-normally/58832

So goodbye to open source on MAC OS if this is true.

dheijl avatar Aug 28 '23 18:08 dheijl

From what I read, it still looks possible - just with a couple of extra caveats. Completely understand why you might not want to put the effort into adapting this though, just a shame I can't find anything near as good as this project for macOS!

Nosh118 avatar Aug 28 '23 18:08 Nosh118

Feel free to add anything needed and make a pull request if you get it to work!

dheijl avatar Aug 28 '23 18:08 dheijl

Thanks, but:

  • debug logging is not activated (-l debug)
  • this is not the complete log file, just an excerpt

Can you attach the complete log file using the GitHub drag and drop feature?

But anyway it looks like the SSDP responses from UPNP devices are not getting through. Other programs seem to have similar problems using UDP on recent MAC OS versions according to Reddit ...

Sorry - missed this, have tried running with -l debug now and I'm not sure where the log file is saved to.

Nosh118 avatar Aug 28 '23 18:08 Nosh118

It should be in a .swyhr-rs folder in your home directory, if such a thing exists on a MAC.

dheijl avatar Aug 28 '23 20:08 dheijl

Found the folder, but can’t seem to find any log files unfortunately.

Nosh118 avatar Aug 31 '23 15:08 Nosh118

Anyway, let's keep this open in the hope that someone with Mac and Rust knowledge is prepared to help...

dheijl avatar Aug 31 '23 19:08 dheijl