savonet / liquidsoap

Liquidsoap is a statically typed scripting general-purpose language with dedicated operators and backend for all thing media, streaming, file generation, automation, HTTP backend and more.
http://liquidsoap.info
GNU General Public License v2.0
1.39k stars 126 forks source link

Liquidsoap stalling when buffer.adaptative gets emptied both in liquidsoap stable and rolling release #2974

Closed hydrosIII closed 2 weeks ago

hydrosIII commented 1 year ago

We have a server playing a stream from the internet. We have some clock issues and latency issues so we have implemented buffer.adaptative as a solution however, sometimes the buffer gets emptied. That is normal, the only problem is that is not starting again, but it is stalling the entire program. So we have a script to restart liquidsoap every x hours. We are always trying to restart liquidsoap before the buffer gets full, so it does not gets emptied.

The number of hours when the buffers get emptied varies, but is after 3 hours of running. We are restarting every 4 hours liquidsoap.

The desired behaviour is that after the buffer gets emptied it restarts and the program continue to run, so we can at least restart the program every 12 hours or so. Or do not restart it at all.

Is there any mistake in the usage of the buffer? Maybe this is a config option? Is there a way to ensure that it will restart after it gets emptied?

The relevant lines of the log are:

mar 22 12:48:00 violetaradio liquidsoap[1458595]: 2023/03/22 12:48:00 [buffer.adaptative_producer_0:3] Buffer emptied, start buffering.>
mar 22 12:48:00 violetaradio liquidsoap[1458595]: 2023/03/22 12:48:00 [mksafe:3] Switch to safe_blank with transition.

We do not have more logs even if we set to the max debug.

Liquidsoap version: Liquidsoap 2.1.3. Installed trough .deb package. Debian buster.

The relevant script:

settings.frame.audio.samplerate.set(48000)

#### encodings de las canciones
settings.tag.encodings.set(["UTF-8", "ISO-8859-1"])

##### max latency
settings.root.max_latency.set(150.)

#### logs a stdout para systemd y a un archivo de log para backup
log.stdout.set(true)
settings.log.file.path.set("/home/violetaradio/violeta.log")

### debug mode 
settings.srt.log.level.set(5)
settings.srt.log.verbosity.set("debug")
settings.server.log.level.set(3)

### ffmpeg
settings.decoder.decoders.set(["FFMPEG"])
settings.ffmpeg.log.verbosity.set("debug")

settings.init.allow_root.set(true)

#### input 
radio = input.ffmpeg(max_buffer=60.0,self_sync=true,"https://b.stream.mayfirst.org/violetaradio.mp3")

###### buffer.adapatative
radio = buffer.adaptative(radio,max=240.,buffer=5.0,fallible=true,averaging=60., limit=1.1, reset=true)

## posprocessing
radio = compress.old(radio, attack = 8.0, gain = -2.0, knee = 1.0, ratio = 4.0, release = 600.0, threshold = -10.0)
radio = normalize(radio, target = -13.0, threshold = -25.0)

#### output directamente en alsa, pongo fallible true como fallback. 
output.alsa(id="alsa",fallible=true,mksafe(radio))

The relevant line is this:

###### buffer.adzptative
radio = buffer.adaptative(radio,max=240.,buffer=5.0,fallible=true,averaging=60., limit=1.1, reset=true)
toots commented 1 year ago

Hi and thanks for reporting. We are currently looking at this operator so hopefully we should be able to get back to you soon.

hydrosIII commented 1 year ago

Hi, We are facing this issue with the normal buffer operator also.

hydrosIII commented 1 year ago

Same issue with version 2.1.4 Liquidsoap 2.1.4

hydrosIII commented 1 year ago

I can confirm the same issue with rolling release liquidsoap 2.2.0+git@f3df74f81

I get:


 14:06:50 [adaptativo:3] Buffer emptied, start buffering...
 14:06:50 [mksafe.2:3] Switch to safe_blank.2 with transition.
 14:06:50 [source:4] Source replay_metadata gets down.
hydrosIII commented 2 weeks ago

Issue solved with new change introduced in liquidsoap version 2.2.4-1 about managing long running streams. @toots Thank you very much for your hard work. I made a small donation to the project.

toots commented 2 weeks ago

Thank you!