ha7ilm / openwebrx

Open source, multi-user SDR receiver software with a web interface
https://sdr.hu/openwebrx
GNU Affero General Public License v3.0
980 stars 462 forks source link

Audio receiving hangs or stutters until reload #115

Open naorunaoru opened 6 years ago

naorunaoru commented 6 years ago

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 commented 6 years ago

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

ha7ilm commented 6 years ago

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

ha7ilm commented 6 years ago

(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.)

naorunaoru commented 6 years ago

@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 commented 6 years ago

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.

ha7ilm commented 6 years ago

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.

naorunaoru commented 6 years ago

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.

tggo commented 5 years ago

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