openwebrx icon indicating copy to clipboard operation
openwebrx copied to clipboard

Audio receiving hangs or stutters until reload

Open naorunaoru opened this issue 6 years ago • 8 comments

So I'm now running a test setup here: http://naoruatho.me:8073/

Currently it's tuned up on the Belorussky railway station frequency in Moscow.

The server is Cubieboard2 with Armbian installed. Performance isn't very good, I'm getting low enough CPU usage with only 300ksps bandwidth.

Everything runs ok, but from time to time it starts repeating a sample over and over and only reloading the page helps. Buffer overrun starts flashing. Waterfall still works. Other clients usually work fine when it happens, only to get the stutter some time later.

I've turned off ADPCM audio compression hoping that it's a simple codec issue but no dice.

Clients use latest Chrome on Windows PCs and Macs. On Edge sound just stops instead of looping.

Can you help me debug this issue?

naorunaoru avatar Jun 05 '18 21:06 naorunaoru

I've compiled csdr with following flags:

PARAMS_NEON = -mfloat-abi=hard -mcpu=cortex-a7 -mtune=cortex-a7 -mfpu=neon-vfpv4 -mvectorize-with-neon-quad -funsafe-math-optimizations -Wformat=0 -ffast-math -DNEON_OPTS

naorunaoru avatar Jun 05 '18 21:06 naorunaoru

Could you please check the Javascript console in Chrome when it happens?

ha7ilm avatar Jun 06 '18 09:06 ha7ilm

(Actually, the page can hang due to high memory usage if you leave it open for a very long time, e.g. hours or days. In the current version the waterfall is never cleaned up in the browser.)

ha7ilm avatar Jun 06 '18 09:06 ha7ilm

@ha7ilm console output:

openwebrx.js:1475 audio overrun, 1
openwebrx.js:1475 audio overrun, 2
openwebrx.js:1475 audio overrun, 3
openwebrx.js:1475 audio overrun, 4
openwebrx.js:1475 audio overrun, 5
openwebrx.js:1302 waterfall queue length: 25
openwebrx.js:1475 audio overrun, 6
openwebrx.js:1302 waterfall queue length: 24
openwebrx.js:1475 audio overrun, 7
openwebrx.js:1475 audio overrun, 8
openwebrx.js:1302 waterfall queue length: 25
openwebrx.js:1475 audio overrun, 9
openwebrx.js:1302 waterfall queue length: 24
openwebrx.js:1475 audio overrun, 10
openwebrx.js:1475 audio overrun, 11
openwebrx.js:1302 waterfall queue length: 25
openwebrx.js:1475 audio overrun, 12
openwebrx.js:1302 waterfall queue length: 24
openwebrx.js:1475 audio overrun, 13
openwebrx.js:1475 audio overrun, 14
openwebrx.js:1302 waterfall queue length: 22
openwebrx.js:1475 audio overrun, 15
openwebrx.js:1475 audio overrun, 16
openwebrx.js:1475 audio overrun, 17
openwebrx.js:1475 audio overrun, 18
openwebrx.js:1475 audio overrun, 19
openwebrx.js:1475 audio overrun, 20

I found that the probability of getting stuck audio increases with server CPU load and does not correlate with how long the page has been open.

naorunaoru avatar Jun 06 '18 10:06 naorunaoru

I fully understand that you shouldn't expect perfect audio with this setup, but at least the application should recover and not hang with a need to manually restart it.

naorunaoru avatar Jun 06 '18 10:06 naorunaoru

Thanks for the feedback. Unfortunately I don't know yet why this happens at you. The application is designed to recover. You could probabily check the internal state of the application by sending it the USR1 or USR2 signal (I don't recall which). There's a particular variable called loopstat that shows where the server stays if there is a hang.

ha7ilm avatar Jun 06 '18 11:06 ha7ilm

I'm guessing that it has something to do with client audio processing, not the server. I'll try to look into it some time later.

naorunaoru avatar Jun 06 '18 11:06 naorunaoru

yes, some problem in Chrome/71.0.3578.98 and Safari/605.1.15 the speaker icon doesn't even start showing

but if open in Firefox/46.0 - all is well

Console in Chrome: The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://goo.gl/7K7WLu

tggo avatar Jan 07 '19 02:01 tggo