ralph-irving / squeezeplay

Squeezeplay software player for Lyrion Music Server.
https://sourceforge.net/projects/lmsclients/files/squeezeplay/
50 stars 14 forks source link

PortAudio: Limit high sample rate streams to 1 second output threshold #9

Closed mw9 closed 3 years ago

mw9 commented 3 years ago

SqueezePlay on macOS will stall when playing a flac file with 352 kHz sample rate.

The cause is insufficient available audio output buffer capacity: LMS sets an output threshold of 2 seconds for such files, and the existing output buffer will only accommodate about 1.1 seconds.

SqueezePlay on macOS uses PortAudio. This proposed change replicates a change already taken up in the Alsa audio backend, which limits the output threshold to 1 second. It has been effective on the very few 352/384 kHz test files that I have, and has the advantage of applying a consistent approach to both backends.

Flac files with sample rates greater than 384 kHz (e.g. 768 kHz) would, more than likely, continue to stall with the existing output buffer size, or with the 1 second threshold. That may require consideration should SqueezePlay ever be called upon to render them.

I have only been able to test on a macOS X86_64 platform (Mojave, 10.14.6). Built against MacOSX10.11.sdk which I found from somewhere !

During the build I observed that fdk-aac-2.0.1 has no configure script, which required a run of autogen.h for the build to succeed.

This is a follow up to our discussion on the LMS forum:

https://forums.slimdevices.com/showthread.php?113234-LMS-7-9-4-and-8-0-x-no-longer-play-PCM-352-files-(DXD)&p=995522&viewfull=1#post995522