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.4k stars 128 forks source link

input.harbor: "Buffer emptied, buffering needed." every few hours #3033

Closed gabsoftware closed 1 year ago

gabsoftware commented 1 year ago

Describe the bug With input.harbor, every few hours, I get the message "Source failed (no more tracks) stopping output...". With log level at 4, the message is only "Buffer emptied, buffering needed.".

Then the security (single) plays and never stops even though input.harbor has data (I know it has data because it receives metadata in the log).

To Reproduce Here is the script that is failing

#!/usr/bin/liquidsoap

# must be included by another script with the following variables:
# home_path (string)
# log_path (string)
# default_wav_path (string)
# harbor_port (int)
# harbor_password (string)
# radio_name (string)
# radio_desc (string)
# radio_genre (string)
# radio_host (string)
# radio_url (string)
# icecast_host (string)
# icecast_port (int)
# icecast_password (string)

settings.harbor.bind_addrs.set(["0.0.0.0"])
log.file.path.set(log_path)
log.level.set(4)

runtime.gc.set(runtime.gc.get().{
  space_overhead = 20,
  allocation_policy = 2
})

# configure security input
security = single(
    id="security_single",
    default_wav_path
)

def on_harbor_connected(_) =
    log("Harbor connected!")
end
def on_harbor_disconnected() =
    log("Harbor disconnected!")
end

# configure harbor input
input_harbor = audio_to_stereo(
    id="input_harbor_audio_to_stereo",
    clock(
        id="input_harbor_clock",
        input.harbor(
            id="input_harbor_master_stream",
            port=harbor_port,
            password=harbor_password,
            replay_metadata=true,
            buffer=5.0,
            max=20.0,
            timeout=30.0,
            metadata_charset="UTF-8",
            on_connect=on_harbor_connected,
            on_disconnect=on_harbor_disconnected,
            "/master-stream.wav"
        )
    )
)

# make a safe radio
def saferadio(radio, n) =
    mksafe(
        id="radio_mksafe_#{n}",
        add(
            id="radio_mix_blank_#{n}",
            normalize=false,
            [
                blank(
                    id="radio_blank_#{n}"
                ),
                fallback(
                    id="radio_fallback_#{n}",
                    track_sensitive=false,
                    replay_metadata=true,
                    [
                        radio,
                        security
                    ]
                )
            ]
        )
    )
end

output.icecast(
    id="output_icecast_ogg",
    %ffmpeg(
        format="ogg",
        %audio(
            codec="libvorbis",
            global_quality="9"
        )
    ),
    saferadio(
        input_harbor,
        "ogg"
    ),
    host=icecast_host,
    port=icecast_port,
    password=icecast_password,
    mount="/stream.ogg",
    name="#{radio_name} (OGG)",
    genre=radio_genre,
    description=radio_desc,
    url="#{radio_url}/stream.ogg",
    encoding="UTF-8",
    format="audio/ogg",
    start=true
)

output.icecast(
    id="output_icecast_opus",
    %ffmpeg(
        format="opus",
        %audio(
            codec="libopus",
            b="327680",
            ar="48000"
        )
    ),
    saferadio(
        input_harbor,
        "opus"
    ),
    host=icecast_host,
    port=icecast_port,
    password=icecast_password,
    mount="/stream.opus",
    name="#{radio_name} (OPUS)",
    genre=radio_genre,
    description=radio_desc,
    url="#{radio_url}/stream.opus",
    encoding="UTF-8",
    format="audio/ogg",
    start=true
)

output.icecast(
    id="output_icecast_mp3",
    %ffmpeg(
        format="mp3",
        %audio(
            codec="libmp3lame",
            b="320k"
        )
    ),
    saferadio(
        input_harbor,
        "mp3"
    ),
    host=icecast_host,
    port=icecast_port,
    password=icecast_password,
    mount="/stream.mp3",
    name="#{radio_name} (MP3)",
    genre=radio_genre,
    description=radio_desc,
    url="#{radio_url}/stream.mp3",
    icy_metadata="true",
    encoding="UTF-8",
    format="audio/mpeg",
    start=true
)

output.icecast(
    id="output_icecast_flac",
    %ogg(
        %flac(
            samplerate=44100,
            channels=2,
            compression=7,
            bits_per_sample=16
        )
    ),
    saferadio(
        input_harbor,
        "flac"
    ),
    host=icecast_host,
    port=icecast_port,
    password=icecast_password,
    mount="/stream.flac",
    name="#{radio_name} (FLAC)",
    genre=radio_genre,
    description=radio_desc,
    url="#{radio_url}/stream.flac",
    encoding="UTF-8",
    format="audio/ogg",
    start=true
)

Liquidsoap stdout reports:

[pcm_s16le @ 0x7f809001fa00] Multiple frames in a packet.
[pcm_s16le @ 0x7f809001fa00] Invalid PCM packet, data has size 3 but at least a size of 4 was expected

Here is an example of log:

2023/04/29 14:42:44 >>> LOG START
2023/04/29 14:42:42 [main:3] Liquidsoap 2.1.4
2023/04/29 14:42:42 [main:3] Using: bytes=[distributed with OCaml 4.02 or above] posix-time2=65ec333 pcre=7.5.0 sedlex=3.0 menhirLib=20220210 curl=0.9.2 uri=4.2.0 memtrace=0.2.3 mem_usage=0.0.4 dtools=0.4.4 duppy=0.9.3 cry=0.6.8 mm=0.8.3 xmlplaylist=0.1.5 lastfm=0.3.3 ogg=0.7.3 ogg.decoder=0.7.3 vorbis=0.8.1 vorbis.decoder=0.8.1 opus=0.2.3 opus.decoder=0.2.3 speex=0.4.1 speex.decoder=0.4.1 mad=0.5.3 flac=0.3.1 flac.ogg=0.3.1 flac.decoder=0.3.1 dynlink=[distributed with Ocaml] lame=0.3.6 shine=0.2.3 frei0r=0.1.2 fdkaac=0.3.3 theora=0.4.0 theora.decoder=0.4.0 ffmpeg=1.1.8 bjack=0.1.6 alsa=0.3.0 ao=0.2.4 samplerate=0.1.6 taglib=0.3.10 ssl=0.5.13 magic=0.7.3 camomile=1.0.2 inotify=2.0-58-g1beb568 faad=0.5.2 soundtouch=0.1.9 portaudio=0.2.3 pulseaudio=0.1.6 ladspa=0.2.2 dssi=0.1.5 tsdl=v0.9.9 tsdl-ttf=0.5 tsdl-image=0.5 camlimages=4.2.6 camlimages.freetype=5.0.4 cohttp-lwt-unix=5.0.0 prometheus-app=1.2 srt.constants=0.3.0 srt.types=0.3.0 srt.stubs=0.3.0 srt.stubs.locked=0.3.0 srt=0.3.0 lo=0.2.0 gd=1.0a5 irc-client-unix=[unspecified]
2023/04/29 14:42:42 [clock:3] Using native (high-precision) implementation for latency control
2023/04/29 14:42:44 [frame:4] frame.audio.samplerate set to: 44100
2023/04/29 14:42:44 [frame:4] frame.video.framerate set to: 25
2023/04/29 14:42:44 [frame:4] frame.audio.channels set to: 2
2023/04/29 14:42:44 [frame:4] frame.video.default set to: false
2023/04/29 14:42:44 [frame:4] frame.midi.channels set to: 0
2023/04/29 14:42:44 [frame:4] frame.video.width set to: 1280
2023/04/29 14:42:44 [frame:4] frame.video.height set to: 720
2023/04/29 14:42:44 [frame:4] frame.audio.samplerate set to: 44100
2023/04/29 14:42:44 [frame:3] Using 44100Hz audio, 25Hz video, 44100Hz main.
2023/04/29 14:42:44 [frame:3] Video frame size set to: 1280x720
2023/04/29 14:42:44 [frame:3] Frame size must be a multiple of 1764 ticks = 1764 audio samples = 1 video samples.
2023/04/29 14:42:44 [frame:3] Targeting 'frame.duration': 0.04s = 1764 audio samples = 1764 ticks.
2023/04/29 14:42:44 [frame:3] Frames last 0.04s = 1764 audio samples = 1 video samples = 1764 ticks.
2023/04/29 14:42:44 [sandbox:3] Sandboxing disabled
2023/04/29 14:42:44 [video.converter:3] Using preferred video converter: ffmpeg.
2023/04/29 14:42:44 [audio.converter:3] Using samplerate converter: libsamplerate.
2023/04/29 14:42:44 [clock:4] Currently 1 clock(s) allocated.
2023/04/29 14:42:44 [clock.input_harbor_clock:4] Starting 5 source(s)...
2023/04/29 14:42:44 [source:4] Source input_harbor_master_stream gets up with content kind: {audio=pcm,video=none,midi=none}.
2023/04/29 14:42:44 [input_harbor_master_stream:4] Content type is {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [harbor:4] Opening port 9000 with icy = false
2023/04/29 14:42:44 [harbor:3] Adding mountpoint '/master-stream.wav' on port 9000
2023/04/29 14:42:44 [source:4] Source output_icecast_ogg gets up with content kind: {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [output_icecast_ogg:4] Content type is {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [source:4] Source radio_mksafe_ogg gets up with content kind: {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [source:4] Source radio_mix_blank_ogg gets up with content kind: {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [radio_mix_blank_ogg:4] Content type is {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [source:4] Source radio_blank_ogg gets up with content kind: {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [radio_blank_ogg:4] Content type is {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [source:4] Source radio_fallback_ogg gets up with content kind: {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [source:4] Source input_harbor_audio_to_stereo gets up with content kind: {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [input_harbor_audio_to_stereo:4] Content type is {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [source:4] Source security_single gets up with content kind: {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [security_single:3] "/home/user/default.wav" is static, resolving once for all...
2023/04/29 14:42:44 [decoder.mad:4] Unsupported file extension for "/home/user/default.wav"!
2023/04/29 14:42:44 [decoder.mad:4] Unsupported MIME type for "/home/user/default.wav": audio/x-wav!
2023/04/29 14:42:44 [decoder.ogg:4] Unsupported file extension for "/home/user/default.wav"!
2023/04/29 14:42:44 [decoder.ogg:4] Unsupported MIME type for "/home/user/default.wav": audio/x-wav!
2023/04/29 14:42:44 [decoder.mp4:4] Unsupported file extension for "/home/user/default.wav"!
2023/04/29 14:42:44 [decoder.mp4:4] Unsupported MIME type for "/home/user/default.wav": audio/x-wav!
2023/04/29 14:42:44 [decoder.aac:4] Unsupported file extension for "/home/user/default.wav"!
2023/04/29 14:42:44 [decoder.aac:4] Unsupported MIME type for "/home/user/default.wav": audio/x-wav!
2023/04/29 14:42:44 [decoder.flac:4] Unsupported file extension for "/home/user/default.wav"!
2023/04/29 14:42:44 [decoder.flac:4] Unsupported MIME type for "/home/user/default.wav": audio/x-wav!
2023/04/29 14:42:44 [decoder.srt:4] Unsupported file extension for "/home/user/default.wav"!
2023/04/29 14:42:44 [decoder.srt:4] Unsupported MIME type for "/home/user/default.wav": audio/x-wav!
2023/04/29 14:42:44 [decoder.aiff:4] Unsupported file extension for "/home/user/default.wav"!
2023/04/29 14:42:44 [decoder.aiff:4] Unsupported MIME type for "/home/user/default.wav": audio/x-wav!
2023/04/29 14:42:44 [decoder:4] Available decoders: FFMPEG (priority: 10), IMAGE (priority: 1), WAV (priority: 1)
2023/04/29 14:42:44 [decoder:4] Trying decoder "FFMPEG"
2023/04/29 14:42:44 [decoder.ffmpeg:4] ffmpeg recognizes "/home/user/default.wav" as: audio: {codec: pcm_s16le, 44100Hz, 2 channel(s)} and content-type: {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [decoder:4] Selected decoder FFMPEG for file "/home/user/default.wav" with expected kind {audio=pcm(stereo),video=none,midi=none} and detected content {audio=pcm(stereo),video=none,midi=none}
2023/04/29 14:42:44 [metadata.flac:4] Unsupported file extension for "/home/user/default.wav"!
2023/04/29 14:42:44 [metadata.flac:4] Unsupported MIME type for "/home/user/default.wav": audio/x-wav!
2023/04/29 14:42:44 [metadata.mp4:4] Unsupported file extension for "/home/user/default.wav"!
2023/04/29 14:42:44 [metadata.mp4:4] Unsupported MIME type for "/home/user/default.wav": audio/x-wav!
2023/04/29 14:42:44 [decoder.ogg:4] Unsupported file extension for "/home/user/default.wav"!
2023/04/29 14:42:44 [decoder.ogg:4] Unsupported MIME type for "/home/user/default.wav": audio/x-wav!
2023/04/29 14:42:44 [decoder.taglib:4] Unsupported MIME type for "/home/user/default.wav": audio/x-wav!
2023/04/29 14:42:44 [decoder.image.metadata:4] Unsupported file extension for "/home/user/default.wav"!
2023/04/29 14:42:44 [decoder.image.metadata:4] Unsupported MIME type for "/home/user/default.wav": audio/x-wav!
2023/04/29 14:42:44 [decoder.video.metadata:4] Unsupported file extension for "/home/user/default.wav"!
2023/04/29 14:42:44 [decoder.video.metadata:4] Unsupported MIME type for "/home/user/default.wav": audio/x-wav!
2023/04/29 14:42:44 [source:4] Source safe_blank gets up with content kind: {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [safe_blank:4] Content type is {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [security_single:3] Prepared "/home/user/default.wav" (RID 0).
2023/04/29 14:42:44 [source:4] Source output_icecast_opus gets up with content kind: {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [output_icecast_opus:4] Content type is {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [source:4] Source radio_mksafe_opus gets up with content kind: {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [source:4] Source radio_mix_blank_opus gets up with content kind: {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [radio_mix_blank_opus:4] Content type is {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [source:4] Source radio_blank_opus gets up with content kind: {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [radio_blank_opus:4] Content type is {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [source:4] Source radio_fallback_opus gets up with content kind: {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [source:4] Source safe_blank gets up with content kind: {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [safe_blank:4] Content type is {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [source:4] Source output_icecast_mp3 gets up with content kind: {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [output_icecast_mp3:4] Content type is {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [source:4] Source radio_mksafe_mp3 gets up with content kind: {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [source:4] Source radio_mix_blank_mp3 gets up with content kind: {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [radio_mix_blank_mp3:4] Content type is {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [source:4] Source radio_blank_mp3 gets up with content kind: {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [radio_blank_mp3:4] Content type is {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [source:4] Source radio_fallback_mp3 gets up with content kind: {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [source:4] Source safe_blank gets up with content kind: {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [safe_blank:4] Content type is {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [source:4] Source output_icecast_flac gets up with content kind: {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [output_icecast_flac:4] Content type is {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [source:4] Source radio_mksafe_flac gets up with content kind: {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [source:4] Source radio_mix_blank_flac gets up with content kind: {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [radio_mix_blank_flac:4] Content type is {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [source:4] Source radio_blank_flac gets up with content kind: {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [radio_blank_flac:4] Content type is {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [source:4] Source radio_fallback_flac gets up with content kind: {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [source:4] Source safe_blank gets up with content kind: {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [safe_blank:4] Content type is {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [threads:4] Created thread "clock_input_harbor_clock" (1 total).
2023/04/29 14:42:44 [clock:4] Main phase starts.
2023/04/29 14:42:44 [threads:4] Created thread "generic queue #1" (1 total).
2023/04/29 14:42:44 [threads:4] Created thread "generic queue #2" (2 total).
2023/04/29 14:42:44 [threads:4] Created thread "non-blocking queue #1" (3 total).
2023/04/29 14:42:44 [threads:4] Created thread "non-blocking queue #2" (4 total).
2023/04/29 14:42:44 [video.text:3] Using camlimages implementation
2023/04/29 14:42:44 [clock.input_harbor_clock:3] Streaming loop starts in auto-sync mode
2023/04/29 14:42:44 [clock.input_harbor_clock:3] Delegating synchronisation to CPU clock
2023/04/29 14:42:44 [radio_mksafe_ogg:3] Switch to radio_mix_blank_ogg.
2023/04/29 14:42:44 [radio_fallback_ogg:3] Switch to security_single.
2023/04/29 14:42:44 [output_icecast_ogg:3] Connecting mount /stream.ogg for source@localhost...
2023/04/29 14:42:44 [output_icecast_ogg:3] Connection setup was successful.
2023/04/29 14:42:44 [radio_mksafe_opus:3] Switch to radio_mix_blank_opus.
2023/04/29 14:42:44 [radio_fallback_opus:3] Switch to security_single.
2023/04/29 14:42:44 [source:4] Source replay_metadata_0 gets up with content kind: {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [replay_metadata_0:4] Content type is {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [output_icecast_opus:3] Connecting mount /stream.opus for source@localhost...
2023/04/29 14:42:44 [output_icecast_opus:3] Connection setup was successful.
2023/04/29 14:42:44 [radio_mksafe_mp3:3] Switch to radio_mix_blank_mp3.
2023/04/29 14:42:44 [radio_fallback_mp3:3] Switch to security_single.
2023/04/29 14:42:44 [source:4] Source replay_metadata_1 gets up with content kind: {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [replay_metadata_1:4] Content type is {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [output_icecast_mp3:3] Connecting mount /stream.mp3 for source@localhost...
2023/04/29 14:42:44 [output_icecast_mp3:3] Connection setup was successful.
2023/04/29 14:42:44 [radio_mksafe_flac:3] Switch to radio_mix_blank_flac.
2023/04/29 14:42:44 [radio_fallback_flac:3] Switch to security_single.
2023/04/29 14:42:44 [source:4] Source replay_metadata_2 gets up with content kind: {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [replay_metadata_2:4] Content type is {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 14:42:44 [output_icecast_flac:3] Connecting mount /stream.flac for source@localhost...
2023/04/29 14:42:44 [output_icecast_flac:3] Connection setup was successful.
2023/04/29 14:42:44 [ogg.muxer:4] output_icecast_flac: Starting all streams
2023/04/29 14:42:45 [harbor:4] New client on port 9000: xxx.xxx.xxx.xxx
2023/04/29 14:42:45 [harbor:4] Method: SOURCE, uri: /master-stream.wav, protocol: HTTP/1.0
2023/04/29 14:42:45 [harbor:4] Header: Host, value: server.com:9000.
2023/04/29 14:42:45 [harbor:4] Header: ice-name, value: /master-stream.wav.
2023/04/29 14:42:45 [harbor:4] Header: ice-public, value: 1.
2023/04/29 14:42:45 [harbor:4] Header: User-Agent, value: Liquidsoap/2.2.0+git@2a3bf62e1 (Unix; OCaml 4.14.0).
2023/04/29 14:42:45 [harbor:4] Header: ice-audio-info, value: channels=2;samplerate=44100.
2023/04/29 14:42:45 [harbor:4] Header: Content-Type, value: audio/wav.
2023/04/29 14:42:45 [harbor:4] Client logged in.
2023/04/29 14:42:45 [harbor:4] SOURCE request on /master-stream.wav.
2023/04/29 14:42:45 [harbor:4] Adding source on mountpoint "/master-stream.wav" with type "audio/wav".
2023/04/29 14:42:45 [decoder:4] Available decoders:
2023/04/29 14:42:45 [decoder:4] FFMPEG (priority: 10)
2023/04/29 14:42:45 [decoder:4] WAV (priority: 1)
2023/04/29 14:42:45 [decoder:4] Selected decoder FFMPEG for mime-type audio/wav with expected content {audio=pcm(stereo),video=none,midi=none}
2023/04/29 14:42:45 [lang:3] Harbor connected!
2023/04/29 14:42:45 [threads:4] Created thread "harbor source feeding" (2 total).
2023/04/29 14:42:45 [input_harbor_master_stream:3] Decoding...
2023/04/29 14:42:50 [radio_fallback_ogg:3] Switch to input_harbor_audio_to_stereo with transition.
2023/04/29 14:42:50 [radio_fallback_opus:3] Switch to input_harbor_audio_to_stereo with transition.
2023/04/29 14:42:50 [source:4] Source replay_metadata_0 gets down.
2023/04/29 14:42:50 [radio_fallback_mp3:3] Switch to input_harbor_audio_to_stereo with transition.
2023/04/29 14:42:50 [source:4] Source replay_metadata_1 gets down.
2023/04/29 14:42:50 [radio_fallback_flac:3] Switch to input_harbor_audio_to_stereo with transition.
2023/04/29 14:42:50 [source:4] Source replay_metadata_2 gets down.
2023/04/29 14:48:08 [harbor:4] New client on port 9000: xxx.xxx.xxx.xxx
2023/04/29 14:48:08 [harbor:4] Method: GET, uri: /admin/metadata?mode=updinfo&mount=/master-stream.wav&charset=UTF-8&comment=Anachron%20Sounds&genre=Modern%20classical&title=Nova%20%28Maestoso%29&artist=VNV%20Nation&song=VNV%20Nation%20%2D%20Nova%20%28Maestoso%29&date=2015&album=Resonance%3A%20Music%20For%20Orchestra%20Vol%2E%201, protocol: HTTP/1.0
2023/04/29 14:48:08 [harbor:4] Header: Host, value: server.com:9000.
2023/04/29 14:48:08 [harbor:4] Header: ice-name, value: /master-stream.wav.
2023/04/29 14:48:08 [harbor:4] Header: ice-public, value: 1.
2023/04/29 14:48:08 [harbor:4] Header: User-Agent, value: Liquidsoap/2.2.0+git@2a3bf62e1 (Unix; OCaml 4.14.0).
2023/04/29 14:48:08 [harbor:4] Header: ice-audio-info, value: channels=2;samplerate=44100.
2023/04/29 14:48:08 [harbor:4] HTTP GET request on /admin/metadata.
2023/04/29 14:48:08 [harbor:4] HTTP Arg: genre, value: Modern classical.
2023/04/29 14:48:08 [harbor:4] HTTP Arg: comment, value: Anachron Sounds.
2023/04/29 14:48:08 [harbor:4] HTTP Arg: mount, value: /master-stream.wav.
2023/04/29 14:48:08 [harbor:4] HTTP Arg: title, value: Nova (Maestoso).
2023/04/29 14:48:08 [harbor:4] HTTP Arg: artist, value: VNV Nation.
2023/04/29 14:48:08 [harbor:4] HTTP Arg: song, value: VNV Nation - Nova (Maestoso).
2023/04/29 14:48:08 [harbor:4] HTTP Arg: charset, value: UTF-8.
2023/04/29 14:48:08 [harbor:4] HTTP Arg: mode, value: updinfo.
2023/04/29 14:48:08 [harbor:4] HTTP Arg: date, value: 2015.
2023/04/29 14:48:08 [harbor:4] HTTP Arg: album, value: Resonance: Music For Orchestra Vol. 1.
2023/04/29 14:48:08 [harbor:4] Request to update metadata for mount /master-stream.wav on port 9000
2023/04/29 14:48:08 [harbor:4] Client logged in.
2023/04/29 14:48:08 [input_harbor_master_stream:3] New metadata chunk VNV Nation -- VNV Nation - Nova (Maestoso).
2023/04/29 14:54:32 [harbor:4] New client on port 9000: xxx.xxx.xxx.xxx
2023/04/29 14:54:32 [harbor:4] Method: GET, uri: /admin/metadata?mode=updinfo&mount=/master-stream.wav&charset=UTF-8&genre=Electronic&title=Nova&artist=VNV%20Nation&song=VNV%20Nation%20%2D%20Nova&date=2011&album=Automatic, protocol: HTTP/1.0
2023/04/29 14:54:32 [harbor:4] Header: Host, value: server.com:9000.
2023/04/29 14:54:32 [harbor:4] Header: ice-name, value: /master-stream.wav.
2023/04/29 14:54:32 [harbor:4] Header: ice-public, value: 1.
2023/04/29 14:54:32 [harbor:4] Header: User-Agent, value: Liquidsoap/2.2.0+git@2a3bf62e1 (Unix; OCaml 4.14.0).
2023/04/29 14:54:32 [harbor:4] Header: ice-audio-info, value: channels=2;samplerate=44100.
2023/04/29 14:54:32 [harbor:4] HTTP GET request on /admin/metadata.
2023/04/29 14:54:32 [harbor:4] HTTP Arg: genre, value: Electronic.
2023/04/29 14:54:32 [harbor:4] HTTP Arg: mount, value: /master-stream.wav.
2023/04/29 14:54:32 [harbor:4] HTTP Arg: title, value: Nova.
2023/04/29 14:54:32 [harbor:4] HTTP Arg: artist, value: VNV Nation.
2023/04/29 14:54:32 [harbor:4] HTTP Arg: song, value: VNV Nation - Nova.
2023/04/29 14:54:32 [harbor:4] HTTP Arg: charset, value: UTF-8.
2023/04/29 14:54:32 [harbor:4] HTTP Arg: mode, value: updinfo.
2023/04/29 14:54:32 [harbor:4] HTTP Arg: date, value: 2011.
2023/04/29 14:54:32 [harbor:4] HTTP Arg: album, value: Automatic.
2023/04/29 14:54:32 [harbor:4] Request to update metadata for mount /master-stream.wav on port 9000
2023/04/29 14:54:32 [harbor:4] Client logged in.
2023/04/29 14:54:32 [input_harbor_master_stream:3] New metadata chunk VNV Nation -- VNV Nation - Nova.

...

2023/04/29 21:02:09 [input_harbor_master_stream:3] New metadata chunk FM-84 -- FM-84 - Wild Ones (feat. Ollie Wride).
2023/04/29 21:03:18 [input_harbor_master_stream:4] Buffer emptied, buffering needed.
2023/04/29 21:03:18 [radio_fallback_flac:3] Switch to security_single with transition.
2023/04/29 21:03:18 [source:4] Source replay_metadata_10 gets down.
2023/04/29 21:03:18 [source:4] Source replay_metadata_11 gets up with content kind: {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 21:03:18 [replay_metadata_11:4] Content type is {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 21:03:18 [radio_fallback_mp3:3] Switch to security_single with forgetful transition.
2023/04/29 21:03:18 [source:4] Source replay_metadata_9 gets down.
2023/04/29 21:03:18 [source:4] Source replay_metadata_12 gets up with content kind: {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 21:03:18 [replay_metadata_12:4] Content type is {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 21:03:18 [radio_fallback_opus:3] Switch to security_single with forgetful transition.
2023/04/29 21:03:18 [source:4] Source replay_metadata_7 gets down.
2023/04/29 21:03:18 [source:4] Source replay_metadata_13 gets up with content kind: {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 21:03:18 [replay_metadata_13:4] Content type is {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 21:03:18 [radio_fallback_ogg:3] Switch to security_single with forgetful transition.
2023/04/29 21:03:18 [source:4] Source replay_metadata_8 gets down.
2023/04/29 21:03:18 [source:4] Source replay_metadata_14 gets up with content kind: {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 21:03:18 [replay_metadata_14:4] Content type is {audio=pcm(stereo),video=none,midi=none}.
2023/04/29 21:06:38 [harbor:4] New client on port 9000: xxx.xxx.xxx.xxx
2023/04/29 21:06:38 [harbor:4] Method: GET, uri: /admin/metadata?mode=updinfo&mount=/master-stream.wav&charset=UTF-8&comment=Steam%20release&genre=Soundtrack&title=Run&artist=iamthekidyouknowwhatimean&song=iamthekidyouknowwhatimean%20%2D%20Run&date=2015&album=Hotline%20Miami%202%3A%20Wrong%20Number, protocol: HTTP/1.0
2023/04/29 21:06:38 [harbor:4] Header: Host, value: server.com:9000.
2023/04/29 21:06:38 [harbor:4] Header: ice-name, value: /master-stream.wav.
2023/04/29 21:06:38 [harbor:4] Header: ice-public, value: 1.
2023/04/29 21:06:38 [harbor:4] Header: User-Agent, value: Liquidsoap/2.2.0+git@2a3bf62e1 (Unix; OCaml 4.14.0).
2023/04/29 21:06:38 [harbor:4] Header: ice-audio-info, value: channels=2;samplerate=44100.
2023/04/29 21:06:38 [harbor:4] HTTP GET request on /admin/metadata.
2023/04/29 21:06:38 [harbor:4] HTTP Arg: genre, value: Soundtrack.
2023/04/29 21:06:38 [harbor:4] HTTP Arg: comment, value: Steam release.
2023/04/29 21:06:38 [harbor:4] HTTP Arg: mount, value: /master-stream.wav.
2023/04/29 21:06:38 [harbor:4] HTTP Arg: title, value: Run.
2023/04/29 21:06:38 [harbor:4] HTTP Arg: artist, value: iamthekidyouknowwhatimean.
2023/04/29 21:06:38 [harbor:4] HTTP Arg: song, value: iamthekidyouknowwhatimean - Run.
2023/04/29 21:06:38 [harbor:4] HTTP Arg: charset, value: UTF-8.
2023/04/29 21:06:38 [harbor:4] HTTP Arg: mode, value: updinfo.
2023/04/29 21:06:38 [harbor:4] HTTP Arg: date, value: 2015.
2023/04/29 21:06:38 [harbor:4] HTTP Arg: album, value: Hotline Miami 2: Wrong Number.
2023/04/29 21:06:38 [harbor:4] Request to update metadata for mount /master-stream.wav on port 9000
2023/04/29 21:06:38 [harbor:4] Client logged in.
2023/04/29 21:06:38 [input_harbor_master_stream:3] New metadata chunk iamthekidyouknowwhatimean -- iamthekidyouknowwhatimean - Run.
2023/04/29 21:09:56 [decoder:4] Decoding "/home/user/default.wav" ended: Ffmpeg_decoder.End_of_file.
2023/04/29 21:09:56 [decoder:4] Raised at Ffmpeg_decoder.mk_decoder.(fun).f in file "decoder/ffmpeg_decoder.ml", line 698, characters 12-29
2023/04/29 21:09:56 [decoder:4] Called from Decoder.mk_decoder.fill in file "decoder/decoder.ml", line 506, characters 10-31
2023/04/29 21:09:56 [decoder:4]
2023/04/29 21:09:56 [security_single:4] Finished with "/home/user/default.wav".
2023/04/29 21:09:56 [security_single:3] Prepared "/home/user/default.wav" (RID 0).
2023/04/29 21:11:31 [harbor:4] New client on port 9000: xxx.xxx.xxx.xxx
2023/04/29 21:11:31 [harbor:4] Method: GET, uri: /admin/metadata?mode=updinfo&mount=/master-stream.wav&charset=UTF-8&title=Reborn%20%28feat%2E%20Romuald%29&artist=Kavinsky&song=Kavinsky%20%2D%20Reborn%20%28feat%2E%20Romuald%29&date=2022&album=Reborn, protocol: HTTP/1.0
2023/04/29 21:11:31 [harbor:4] Header: Host, value: server.com:9000.
2023/04/29 21:11:31 [harbor:4] Header: ice-name, value: /master-stream.wav.
2023/04/29 21:11:31 [harbor:4] Header: ice-public, value: 1.
2023/04/29 21:11:31 [harbor:4] Header: User-Agent, value: Liquidsoap/2.2.0+git@2a3bf62e1 (Unix; OCaml 4.14.0).
2023/04/29 21:11:31 [harbor:4] Header: ice-audio-info, value: channels=2;samplerate=44100.
2023/04/29 21:11:31 [harbor:4] HTTP GET request on /admin/metadata.
2023/04/29 21:11:31 [harbor:4] HTTP Arg: mount, value: /master-stream.wav.
2023/04/29 21:11:31 [harbor:4] HTTP Arg: title, value: Reborn (feat. Romuald).
2023/04/29 21:11:31 [harbor:4] HTTP Arg: artist, value: Kavinsky.
2023/04/29 21:11:31 [harbor:4] HTTP Arg: song, value: Kavinsky - Reborn (feat. Romuald).
2023/04/29 21:11:31 [harbor:4] HTTP Arg: charset, value: UTF-8.
2023/04/29 21:11:31 [harbor:4] HTTP Arg: mode, value: updinfo.
2023/04/29 21:11:31 [harbor:4] HTTP Arg: date, value: 2022.
2023/04/29 21:11:31 [harbor:4] HTTP Arg: album, value: Reborn.
2023/04/29 21:11:31 [harbor:4] Request to update metadata for mount /master-stream.wav on port 9000
2023/04/29 21:11:31 [harbor:4] Client logged in.
2023/04/29 21:11:31 [input_harbor_master_stream:3] New metadata chunk Kavinsky -- Kavinsky - Reborn (feat. Romuald).
2023/04/29 21:15:13 [harbor:4] New client on port 9000: xxx.xxx.xxx.xxx

And it goes on and on...

It still receives the metadata from new songs...

...
2023/04/29 21:41:39 [harbor:4] New client on port 9000: xxx.xxx.xxx.xxx
2023/04/29 21:41:39 [harbor:4] Method: GET, uri: /admin/metadata?mode=updinfo&mount=/master-stream.wav&charset=UTF-8&genre=Alternative&title=Forever&artist=Orax&song=Orax%20%2D%20Forever&date=2012%2D12%2D18&album=Betray, protocol: HTTP/1.0
2023/04/29 21:41:39 [harbor:4] Header: Host, value: server.com:9000.
2023/04/29 21:41:39 [harbor:4] Header: ice-name, value: /master-stream.wav.
2023/04/29 21:41:39 [harbor:4] Header: ice-public, value: 1.
2023/04/29 21:41:39 [harbor:4] Header: User-Agent, value: Liquidsoap/2.2.0+git@2a3bf62e1 (Unix; OCaml 4.14.0).
2023/04/29 21:41:39 [harbor:4] Header: ice-audio-info, value: channels=2;samplerate=44100.
2023/04/29 21:41:39 [harbor:4] HTTP GET request on /admin/metadata.
2023/04/29 21:41:39 [harbor:4] HTTP Arg: genre, value: Alternative.
2023/04/29 21:41:39 [harbor:4] HTTP Arg: mount, value: /master-stream.wav.
2023/04/29 21:41:39 [harbor:4] HTTP Arg: title, value: Forever.
2023/04/29 21:41:39 [harbor:4] HTTP Arg: artist, value: Orax.
2023/04/29 21:41:39 [harbor:4] HTTP Arg: song, value: Orax - Forever.
2023/04/29 21:41:39 [harbor:4] HTTP Arg: charset, value: UTF-8.
2023/04/29 21:41:39 [harbor:4] HTTP Arg: mode, value: updinfo.
2023/04/29 21:41:39 [harbor:4] HTTP Arg: date, value: 2012-12-18.
2023/04/29 21:41:39 [harbor:4] HTTP Arg: album, value: Betray.
2023/04/29 21:41:39 [harbor:4] Request to update metadata for mount /master-stream.wav on port 9000
2023/04/29 21:41:39 [harbor:4] Client logged in.
2023/04/29 21:41:39 [input_harbor_master_stream:3] New metadata chunk Orax -- Orax - Forever.
2023/04/29 21:43:49 [decoder:4] Decoding "/home/user/default.wav" ended: Ffmpeg_decoder.End_of_file.
2023/04/29 21:43:49 [decoder:4] Raised at Ffmpeg_decoder.mk_decoder.(fun).f in file "decoder/ffmpeg_decoder.ml", line 698, characters 12-29
2023/04/29 21:43:49 [decoder:4] Called from Decoder.mk_decoder.fill in file "decoder/decoder.ml", line 506, characters 10-31
2023/04/29 21:43:49 [decoder:4]
2023/04/29 21:43:50 [security_single:4] Finished with "/home/user/default.wav".
2023/04/29 21:43:50 [security_single:3] Prepared "/home/user/default.wav" (RID 0).
2023/04/29 21:45:53 [harbor:4] New client on port 9000: xxx.xxx.xxx.xxx
2023/04/29 21:45:53 [harbor:4] Method: GET, uri: /admin/metadata?mode=updinfo&mount=/master-stream.wav&charset=UTF-8&genre=IDM%2FModern%20Classical%2FAmbient&title=Memento&artist=Ocoeur&song=Ocoeur%20%2D%20Memento&date=2013&album=Memento, protocol: HTTP/1.0
2023/04/29 21:45:53 [harbor:4] Header: Host, value: server.com:9000.
2023/04/29 21:45:53 [harbor:4] Header: ice-name, value: /master-stream.wav.
2023/04/29 21:45:53 [harbor:4] Header: ice-public, value: 1.
2023/04/29 21:45:53 [harbor:4] Header: User-Agent, value: Liquidsoap/2.2.0+git@2a3bf62e1 (Unix; OCaml 4.14.0).
2023/04/29 21:45:53 [harbor:4] Header: ice-audio-info, value: channels=2;samplerate=44100.
2023/04/29 21:45:53 [harbor:4] HTTP GET request on /admin/metadata.
2023/04/29 21:45:53 [harbor:4] HTTP Arg: genre, value: IDM/Modern Classical/Ambient.
2023/04/29 21:45:53 [harbor:4] HTTP Arg: mount, value: /master-stream.wav.
2023/04/29 21:45:53 [harbor:4] HTTP Arg: title, value: Memento.
2023/04/29 21:45:53 [harbor:4] HTTP Arg: artist, value: Ocoeur.
2023/04/29 21:45:53 [harbor:4] HTTP Arg: song, value: Ocoeur - Memento.
2023/04/29 21:45:53 [harbor:4] HTTP Arg: charset, value: UTF-8.
2023/04/29 21:45:53 [harbor:4] HTTP Arg: mode, value: updinfo.
2023/04/29 21:45:53 [harbor:4] HTTP Arg: date, value: 2013.
2023/04/29 21:45:53 [harbor:4] HTTP Arg: album, value: Memento.
2023/04/29 21:45:53 [harbor:4] Request to update metadata for mount /master-stream.wav on port 9000
2023/04/29 21:45:53 [harbor:4] Client logged in.
2023/04/29 21:45:53 [input_harbor_master_stream:3] New metadata chunk Ocoeur -- Ocoeur - Memento.
...

Just for reference, here is the liquidsoap script in my home that sends data to the input.harbor on the server (there are no errors on that side):

#!/usr/bin/liquidsoap

# Log dir
log.file.path.set("/home/user/radio.log")

# Music
playlist_ambient   = playlist(id="radio_ambient"  , "/home/user/radio_ambient.pls")
playlist_chillout  = playlist(id="radio_chillout" , "/home/user/radio_chillout.pls")
playlist_dnb       = playlist(id="radio_dnb"      , "/home/user/radio_dnb.pls")
playlist_dub       = playlist(id="radio_dub"      , "/home/user/radio_dub.pls")
playlist_dubstep   = playlist(id="radio_dubstep"  , "/home/user/radio_dubstep.pls")
playlist_electro   = playlist(id="radio_electro"  , "/home/user/radio_electro.pls")
playlist_futurepop = playlist(id="radio_futurepop", "/home/user/radio_futurepop.pls")
playlist_idm       = playlist(id="radio_idm"      , "/home/user/radio_idm.pls")
playlist_nightcity = playlist(id="radio_nightcity", "/home/user/radio_nightcity.pls")
playlist_synthwave = playlist(id="radio_synthwave", "/home/user/radio_synthwave.pls")
playlist_mix = random(
    id="playlist_mix",
    weights = [3, 15, 18, 2, 1, 6, 21, 2, 3, 75],
    [
        playlist_ambient,
        playlist_chillout,
        playlist_dnb,
        playlist_dub,
        playlist_dubstep,
        playlist_electro,
        playlist_futurepop,
        playlist_idm,
        playlist_nightcity,
        playlist_synthwave
    ]
)

# If something goes wrong, we'll play this
security = single(
    id="security_single",
    "/home/user/default.flac"
)

# Start building the feed with music
radio = blank.skip(
    id="blank_skipper",
    playlist_mix
)

# And finally the security
radio = fallback(
    id="radio_fallback",
    track_sensitive = false,
    [radio, security]
)

output.icecast(
    id="output_icecast_radio",
    %wav(
        stereo=true,
        channels=2,
        samplesize=16,
        header=true
    ),
    host="server.com",
    port=9000,
    password="hackme",
    mount="/master-stream.wav",
    send_icy_metadata=true,
    radio
)

I have a 2 Gbit/s down / 800 Mbit/s up optical fiber internet connection at home so we can rule out insufficient bandwidth issues.

Expected behavior Ideally, should not have that error. But when it does, it should resume playing the input.harbor source when it's available again.

Version details

Install method Installed by downloading the .deb packages manually for Debian Bullseye

gabsoftware commented 1 year ago

I tried to migrate to 2.2.0 but same error.

toots commented 1 year ago

Hi and thanks for reporting. I have a couple of suggestions to enhance the script but, to respond to your original issue, you shouldn't be using wav as the transport format. The WAV format has a global header that is sent only once and never repeated so, when the connection restarts, the output is not sending the way header and, so, the harbor input fails to decode data.

If you want to send lossless data, I would recommend %ogg(%flac), which should work fine for this use-case.