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.42k stars 130 forks source link

liquidsoap crashes when using rotate #1690

Closed stifutkin closed 3 years ago

stifutkin commented 3 years ago

Hello When I use rotate(weights = [1, 1], [beep, play_list]) liquidsoap plays one track only once and crashes.

wd = "/home/book/stream"

set("init.daemon",true)
set("init.daemon.pidfile", false)

set("decoder.debug",true)

set("decoder.file_decoders",["MAD","META","OGG","AIFF","WAV"])

set("log.file",true)
set("log.stdout",true)
set("log.file.append",false)
set("log.file.path","#{wd}/__config/test1.log")
set("log.level", 4)

set("server.telnet",false)
set("server.telnet.port",1201)
set("server.telnet.bind_addr","0.0.0.0")

play_list = playlist(reload=0, reload_mode="rounds", mode="random", "/home/book/stream/__beep1")
beep = playlist(reload=0, reload_mode="rounds", mode="random", "/home/book/stream/__beep2")

radio = rotate(weights = [1, 1],[beep, play_list])

output.icecast(fallible=true, %mp3(bitrate=64, samplerate=44100, id3v2=true), mount="test", host="test.ru", port=8000, password="test", encoding="UTF-8", icy_metadata="true", radio)

Then

2021/06/10 19:46:45 >>LOG START
2021/06/10 19:46:45 [main:3] Liquidsoap 1.4.4
2021/06/10 19:46:45 [main:3] Using: bytes=[distributed with OCaml 4.02 or above] pcre=7.4.6 sedlex=2.3 menhirLib=20210419 dtools=0.4.2 duppy=0.9.0 cry=0.6.5 mm=0.5.1 xmlplaylist=0.1.5 lastfm=0.3.3 ogg=0.5.2 vorbis=0.7.1 opus=0.1.3 speex=0.2.2 mad=0.4.5 flac=0.1.7 flac.ogg=0.1.7 dynlink=[distributed with Ocaml] lame=0.3.4 shine=0.2.1 gstreamer=0.3.1 frei0r=0.1.2 fdkaac=0.3.2 theora=0.3.1 gavl=0.1.6 ffmpeg=0.4.3 bjack=0.1.6 alsa=0.2.3 ao=0.2.3 samplerate=0.1.5 taglib=0.3.6 ssl=0.5.9 magic=0.7.3 camomile=1.0.2 inotify=2.3 faad=0.4.0 soundtouch=0.1.9 portaudio=0.2.2 pulseaudio=0.1.4 ladspa=0.1.5 dssi=0.1.2 lo=0.1.2
2021/06/10 19:46:45 [gstreamer.loader:3] Loaded GStreamer 1.14.5 0
2021/06/10 19:46:45 [frame:3] Using 44100Hz audio, 25Hz video, 44100Hz master.
2021/06/10 19:46:45 [frame:3] Frame size must be a multiple of 1764 ticks = 1764 audio samples = 1 video samples.
2021/06/10 19:46:45 [frame:3] Targetting 'frame.duration': 0.04s = 1764 audio samples = 1764 ticks.
2021/06/10 19:46:45 [frame:3] Frames last 0.04s = 1764 audio samples = 1 video samples = 1764 ticks.
2021/06/10 19:46:45 [sandbox:3] Sandboxing disabled
2021/06/10 19:46:45 [video.converter:3] Using preferred video converter: gavl.
2021/06/10 19:46:45 [threads:4] Created thread "gstreamer_main_loop" (1 total).
2021/06/10 19:46:45 [audio.converter:3] Using samplerate converter: ffmpeg.
2021/06/10 19:46:45 [threads:4] Created thread "generic queue #1" (1 total).
2021/06/10 19:46:45 [threads:4] Created thread "generic queue #2" (2 total).
2021/06/10 19:46:45 [threads:4] Created thread "non-blocking queue #1" (3 total).
2021/06/10 19:46:45 [threads:4] Created thread "non-blocking queue #2" (4 total).
2021/06/10 19:46:45 [clock:4] Currently 1 clocks allocated.
2021/06/10 19:46:45 [clock.wallclock_main:4] Starting 1 sources...
2021/06/10 19:46:45 [source:4] Source output.icecast_9275 gets up.
2021/06/10 19:46:45 [source:4] Source rotate_9273 gets up.
2021/06/10 19:46:45 [source:4] Source playlist_9271 gets up.
2021/06/10 19:46:45 [__beep2:3] Loading playlist...
2021/06/10 19:46:45 [__beep2:3] Playlist is a directory.
2021/06/10 19:46:45 [__beep2:3] Successfully loaded a playlist of 2 tracks.
2021/06/10 19:46:45 [__beep2:4] Content kind is {audio=2;video=0;midi=0}.
2021/06/10 19:46:45 [__beep2:4] Activations changed: static=[], dynamic=[rotate_9273:test:test].
2021/06/10 19:46:45 [source:4] Source playlist_9269 gets up.
2021/06/10 19:46:45 [__beep1:3] Loading playlist...
2021/06/10 19:46:45 [__beep1:3] Playlist is a directory.
2021/06/10 19:46:45 [__beep1:3] Successfully loaded a playlist of 2 tracks.
2021/06/10 19:46:45 [__beep1:4] Content kind is {audio=2;video=0;midi=0}.
2021/06/10 19:46:45 [__beep1:4] Activations changed: static=[], dynamic=[rotate_9273:test:test].
2021/06/10 19:46:45 [rotate_9273:4] Activations changed: static=[test:test], dynamic=[].
2021/06/10 19:46:45 [test:4] Activations changed: static=[test], dynamic=[].
2021/06/10 19:46:45 [test:4] Enabling caching mode: active source.
2021/06/10 19:46:45 [threads:4] Created thread "wallclock_main" (2 total).
2021/06/10 19:46:45 [clock:4] Main phase starts.
2021/06/10 19:46:45 [clock.wallclock_main:3] Streaming loop starts, synchronized with wallclock.
2021/06/10 19:46:45 [decoder:4] Trying method "MAD" for "/home/book/stream/__beep1/2.mp3"...
2021/06/10 19:46:45 [decoder.mad:4] Libmad recognizes "/home/book/stream/__beep1/2.mp3" as mpeg audio (layer III, 320kbps, 44100Hz, 2 channels).
2021/06/10 19:46:45 [decoder:3] Method "MAD" accepted "/home/book/stream/__beep1/2.mp3".
2021/06/10 19:46:45 [decoder:4] Trying method "MAD" for "/home/book/stream/__beep2/4.mp3"...
2021/06/10 19:46:45 [decoder.mad:4] Libmad recognizes "/home/book/stream/__beep2/4.mp3" as mpeg audio (layer III, 320kbps, 44100Hz, 2 channels).
2021/06/10 19:46:45 [decoder:3] Method "MAD" accepted "/home/book/stream/__beep2/4.mp3".
2021/06/10 19:46:45 [metadata.flac:4] Invalid MIME type for "/home/book/stream/__beep1/2.mp3": audio/mpeg!
2021/06/10 19:46:45 [metadata.flac:4] Invalid file extension for "/home/book/stream/__beep1/2.mp3"!
2021/06/10 19:46:45 [metadata.mp4:4] Invalid MIME type for "/home/book/stream/__beep1/2.mp3": audio/mpeg!
2021/06/10 19:46:45 [metadata.mp4:4] Invalid file extension for "/home/book/stream/__beep1/2.mp3"!
2021/06/10 19:46:45 [decoder.ogg:4] Invalid MIME type for "/home/book/stream/__beep1/2.mp3": audio/mpeg!
2021/06/10 19:46:45 [decoder.ogg:4] Invalid file extension for "/home/book/stream/__beep1/2.mp3"!
2021/06/10 19:46:45 [metadata.flac:4] Invalid MIME type for "/home/book/stream/__beep2/4.mp3": audio/mpeg!
2021/06/10 19:46:45 [metadata.flac:4] Invalid file extension for "/home/book/stream/__beep2/4.mp3"!
2021/06/10 19:46:45 [metadata.mp4:4] Invalid MIME type for "/home/book/stream/__beep2/4.mp3": audio/mpeg!
2021/06/10 19:46:45 [metadata.mp4:4] Invalid file extension for "/home/book/stream/__beep2/4.mp3"!
2021/06/10 19:46:45 [decoder.gstreamer:4] Invalid MIME type for "/home/book/stream/__beep1/2.mp3": audio/mpeg!
2021/06/10 19:46:45 [decoder.ogg:4] Invalid MIME type for "/home/book/stream/__beep2/4.mp3": audio/mpeg!
2021/06/10 19:46:45 [decoder.ogg:4] Invalid file extension for "/home/book/stream/__beep2/4.mp3"!
2021/06/10 19:46:45 [decoder.gstreamer:4] Invalid file extension for "/home/book/stream/__beep1/2.mp3"!
2021/06/10 19:46:45 [__beep1:4] Remaining: 0.0s, queued: 0.0s, adding: 30.0s (RID 2)
2021/06/10 19:46:45 [decoder:4] Trying method "MAD" for "/home/book/stream/__beep1/1.mp3"...
2021/06/10 19:46:45 [__beep1:4] Remaining: 0.0s, queued: 30.0s, taking: 30.0s
2021/06/10 19:46:45 [decoder.gstreamer:4] Invalid MIME type for "/home/book/stream/__beep2/4.mp3": audio/mpeg!
2021/06/10 19:46:45 [decoder.gstreamer:4] Invalid file extension for "/home/book/stream/__beep2/4.mp3"!
2021/06/10 19:46:45 [decoder.mad:4] Libmad recognizes "/home/book/stream/__beep1/1.mp3" as mpeg audio (layer III, 320kbps, 44100Hz, 2 channels).
2021/06/10 19:46:45 [decoder:3] Method "MAD" accepted "/home/book/stream/__beep1/1.mp3".
2021/06/10 19:46:45 [__beep2:4] Remaining: 0.0s, queued: 0.0s, adding: 30.0s (RID 3)
2021/06/10 19:46:45 [__beep1:3] Prepared "/home/book/stream/__beep1/2.mp3" (RID 2).
2021/06/10 19:46:45 [test:3] Connecting mount test for source@vl108.ru...
2021/06/10 19:46:45 [decoder:4] Trying method "MAD" for "/home/book/stream/__beep2/3.mp3"...
2021/06/10 19:46:46 [metadata.flac:4] Invalid MIME type for "/home/book/stream/__beep1/1.mp3": audio/mpeg!
2021/06/10 19:46:46 [metadata.flac:4] Invalid file extension for "/home/book/stream/__beep1/1.mp3"!
2021/06/10 19:46:46 [decoder.mad:4] Libmad recognizes "/home/book/stream/__beep2/3.mp3" as mpeg audio (layer III, 320kbps, 44100Hz, 2 channels).
2021/06/10 19:46:46 [decoder:3] Method "MAD" accepted "/home/book/stream/__beep2/3.mp3".
2021/06/10 19:46:46 [metadata.mp4:4] Invalid MIME type for "/home/book/stream/__beep1/1.mp3": audio/mpeg!
2021/06/10 19:46:46 [metadata.mp4:4] Invalid file extension for "/home/book/stream/__beep1/1.mp3"!
2021/06/10 19:46:46 [decoder.ogg:4] Invalid MIME type for "/home/book/stream/__beep1/1.mp3": audio/mpeg!
2021/06/10 19:46:46 [decoder.ogg:4] Invalid file extension for "/home/book/stream/__beep1/1.mp3"!
2021/06/10 19:46:46 [metadata.flac:4] Invalid MIME type for "/home/book/stream/__beep2/3.mp3": audio/mpeg!
2021/06/10 19:46:46 [metadata.flac:4] Invalid file extension for "/home/book/stream/__beep2/3.mp3"!
2021/06/10 19:46:46 [test:3] Connection setup was successful.
2021/06/10 19:46:46 [rotate_9273:3] Switch to __beep1.
2021/06/10 19:46:46 [__beep1:4] Activations changed: static=[rotate_9273:test:test], dynamic=[rotate_9273:test:test].
2021/06/10 19:46:46 [metadata.mp4:4] Invalid MIME type for "/home/book/stream/__beep2/3.mp3": audio/mpeg!
2021/06/10 19:46:46 [metadata.mp4:4] Invalid file extension for "/home/book/stream/__beep2/3.mp3"!
2021/06/10 19:46:46 [decoder.ogg:4] Invalid MIME type for "/home/book/stream/__beep2/3.mp3": audio/mpeg!
2021/06/10 19:46:46 [decoder.ogg:4] Invalid file extension for "/home/book/stream/__beep2/3.mp3"!
2021/06/10 19:46:46 [decoder.gstreamer:4] Invalid MIME type for "/home/book/stream/__beep1/1.mp3": audio/mpeg!
2021/06/10 19:46:46 [decoder.gstreamer:4] Invalid file extension for "/home/book/stream/__beep1/1.mp3"!
2021/06/10 19:46:46 [__beep1:4] Remaining: -0.0s, queued: 0.0s, adding: 30.0s (RID 4)
2021/06/10 19:46:46 [decoder.gstreamer:4] Invalid MIME type for "/home/book/stream/__beep2/3.mp3": audio/mpeg!
2021/06/10 19:46:46 [decoder.gstreamer:4] Invalid file extension for "/home/book/stream/__beep2/3.mp3"!
2021/06/10 19:46:46 [__beep2:4] Remaining: 0.0s, queued: 30.0s, adding: 30.0s (RID 5)
2021/06/10 19:49:33 [decoder:4] Trying method "MAD" for "/home/book/stream/__beep1/1.mp3"...
2021/06/10 19:49:33 [decoder.mad:4] Libmad recognizes "/home/book/stream/__beep1/1.mp3" as mpeg audio (layer III, 320kbps, 44100Hz, 2 channels).
2021/06/10 19:49:33 [decoder:3] Method "MAD" accepted "/home/book/stream/__beep1/1.mp3".
2021/06/10 19:49:33 [metadata.flac:4] Invalid MIME type for "/home/book/stream/__beep1/1.mp3": audio/mpeg!
2021/06/10 19:49:33 [metadata.flac:4] Invalid file extension for "/home/book/stream/__beep1/1.mp3"!
2021/06/10 19:49:33 [metadata.mp4:4] Invalid MIME type for "/home/book/stream/__beep1/1.mp3": audio/mpeg!
2021/06/10 19:49:33 [metadata.mp4:4] Invalid file extension for "/home/book/stream/__beep1/1.mp3"!
2021/06/10 19:49:33 [decoder.ogg:4] Invalid MIME type for "/home/book/stream/__beep1/1.mp3": audio/mpeg!
2021/06/10 19:49:33 [decoder.ogg:4] Invalid file extension for "/home/book/stream/__beep1/1.mp3"!
2021/06/10 19:49:33 [decoder.gstreamer:4] Invalid MIME type for "/home/book/stream/__beep1/1.mp3": audio/mpeg!
2021/06/10 19:49:33 [decoder.gstreamer:4] Invalid file extension for "/home/book/stream/__beep1/1.mp3"!
2021/06/10 19:49:33 [__beep1:4] Remaining: 9.8s, queued: 30.0s, adding: 30.0s (RID 6)
2021/06/10 19:49:43 [decoder:4] Decoding "/home/book/stream/__beep1/2.mp3" ended: Mad.End_of_stream.
2021/06/10 19:49:43 [clock.wallclock_main:2] Source test failed while streaming: Mad.End_of_stream!
2021/06/10 19:49:43 [clock.wallclock_main:3] Raised by primitive operation at file "decoder/mad_decoder.ml", line 55, characters 15-42
2021/06/10 19:49:43 [clock.wallclock_main:3] Called from file "decoder/mad_decoder.ml", line 123, characters 20-31
2021/06/10 19:49:43 [clock.wallclock_main:3] Called from file "decoder/decoder.ml", line 341, characters 12-30
2021/06/10 19:49:43 [clock.wallclock_main:3] Re-raised at file "decoder/decoder.ml", line 346, characters 33-40
2021/06/10 19:49:43 [clock.wallclock_main:3] Called from file "sources/request_source.ml", line 103, characters 37-61
2021/06/10 19:49:43 [clock.wallclock_main:3] Called from file "tools/tutils.ml", line 89, characters 14-17
2021/06/10 19:49:43 [clock.wallclock_main:3] Re-raised at file "tools/tutils.ml", line 94, characters 4-11
2021/06/10 19:49:43 [clock.wallclock_main:3] Called from file "tools/tutils.ml", line 89, characters 14-17
2021/06/10 19:49:43 [clock.wallclock_main:3] Re-raised at file "tools/tutils.ml", line 94, characters 4-11
2021/06/10 19:49:43 [clock.wallclock_main:3] Called from file "sources/request_source.ml", line 147, characters 8-40
2021/06/10 19:49:43 [clock.wallclock_main:3] Called from file "sources/request_source.ml", line 435, characters 6-24
2021/06/10 19:49:43 [clock.wallclock_main:3] Called from file "source.ml", line 531, characters 10-24
2021/06/10 19:49:43 [clock.wallclock_main:3] Called from file "operators/switch.ml", line 220, characters 14-19
2021/06/10 19:49:43 [clock.wallclock_main:3] Called from file "source.ml", line 531, characters 10-24
2021/06/10 19:49:43 [clock.wallclock_main:3] Called from file "outputs/output.ml", line 178, characters 10-20
2021/06/10 19:49:43 [clock.wallclock_main:3] Called from file "clock.ml", line 168, characters 14-22
2021/06/10 19:49:43 [test:4] Activations changed: static=[], dynamic=[].
2021/06/10 19:49:43 [source:4] Source test gets down.
2021/06/10 19:49:43 [test:3] Closing connection...
2021/06/10 19:49:43 [rotate_9273:4] Activations changed: static=[], dynamic=[].
2021/06/10 19:49:43 [source:4] Source rotate_9273 gets down.
2021/06/10 19:49:43 [__beep2:4] Activations changed: static=[], dynamic=[].
2021/06/10 19:49:43 [source:4] Source __beep2 gets down.
2021/06/10 19:49:43 [__beep2:4] Waiting for feeding task to stop...
2021/06/10 19:49:43 [__beep2:4] Cleaning up request queue...
2021/06/10 19:49:43 [__beep1:4] Activations changed: static=[rotate_9273:test:test], dynamic=[].
2021/06/10 19:49:43 [__beep1:4] Activations changed: static=[], dynamic=[].
2021/06/10 19:49:43 [source:4] Source __beep1 gets down.
2021/06/10 19:49:43 [__beep1:4] Waiting for feeding task to stop...
2021/06/10 19:49:43 [__beep1:4] Finished with "/home/book/stream/__beep1/2.mp3".
2021/06/10 19:49:43 [__beep1:4] Cleaning up request queue...
2021/06/10 19:49:43 [clock.wallclock_main:3] Streaming loop stopped.
2021/06/10 19:49:43 [threads:4] Thread "wallclock_main" terminated (1 remaining).
2021/06/10 19:49:43 [main:3] Shutdown started!
2021/06/10 19:49:43 [main:3] Waiting for main threads to terminate...
2021/06/10 19:49:43 [threads:4] Waiting for thread gstreamer_main_loop to shutdown
2021/06/10 19:49:43 [threads:4] Thread "gstreamer_main_loop" terminated (0 remaining).
2021/06/10 19:49:43 [main:3] Threads terminated.
2021/06/10 19:49:43 [threads:3] Shutting down scheduler...
2021/06/10 19:49:43 [threads:3] Scheduler shut down.
2021/06/10 19:49:43 [threads:3] Waiting for queue threads to terminate...
2021/06/10 19:49:43 [threads:4] Waiting for thread generic queue #1 to shutdown
2021/06/10 19:49:43 [threads:4] Thread "generic queue #2" terminated (3 remaining).
2021/06/10 19:49:43 [threads:4] Thread "non-blocking queue #2" terminated (2 remaining).
2021/06/10 19:49:43 [threads:4] Thread "non-blocking queue #1" terminated (1 remaining).
2021/06/10 19:49:43 [threads:4] Thread "generic queue #1" terminated (0 remaining).
2021/06/10 19:49:43 [threads:3] Queues shut down
2021/06/10 19:49:43 [main:3] Cleaning downloaded files...
2021/06/10 19:49:43 [main:3] Freeing memory...
2021/06/10 19:49:43 >>LOG END
smimram commented 3 years ago

Which verion of Liquidsoap are you using?

stifutkin commented 3 years ago

Liquidsoap 1.4.4

But this configuration works perfectly:

play_list = playlist(reload=0, reload_mode="rounds", mode="random", "/home/book/stream/__beep1") output.icecast(fallible=true, %mp3(bitrate=64, samplerate=44100, id3v2=true), mount="test", host="test.ru", port=8000, password="test", encoding="UTF-8", icy_metadata="true", play_list )

(without rotate())

toots commented 3 years ago

Hi!

You should remove this line:

set("decoder.debug",true)

It is designed to let exceptions during decoding surface and crash the script so we can debug where they are coming from..