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 130 forks source link

"Successfully loaded a playlist" but play fallback always #472

Closed simahawk closed 7 years ago

simahawk commented 7 years ago

I have a test playlist w/ just 1 file that is the same I use for fallback. Playlist seems to be loaded but then it plays only the fallback. Fallback's stream sounds good which means that the source is not fallible... I wonder why it playlist fails then.

Playlist file

# cat /radio/test.m3u 
/radio/tracks/bassi_maestro/background/sic.mp3

Liq file

#!/usr/bin/env liquidsoap

set("log.file.path", "/tmp/stream.log")

myplaylist = playlist(mode="normal", getenv("PLAYLIST"))

ice_out = output.icecast(
  url="http://myradio.com/"
)
out.icecast = ice_out(
    host=getenv("ICECAST_HOST"),
    port=int_of_string(getenv("ICECAST_PORT")),
    password=getenv("ICECAST_SOURCE_PASSWORD")
)

def stream_it(encoder, ~mount, input)
  out.icecast(encoder, mount=mount, input)
end

security = single(id="default-fallback", "/radio/tracks/bassi_maestro/background/sic.mp3")
myplaylist = fallback([myplaylist, security])

stream_it(%mp3(bitrate=256), mount=getenv("MOUNT_NAME"), myplaylist)

Log

# docker run --rm --name=foo1 -e ICECAST_SOURCE_PASSWORD=XXX -e ICECAST_HOST=XXX -e ICECAST_PORT=XXX -e PLAYLIST=/radio/test.m3u -e MOUNT_NAME=foo1 -v /radio:/radio -v /etc/localtime:/etc/localtime:ro savonet/liquidsoap-full su opam -c "liquidsoap -v /radio/liquids/minimal.liq"
[WARNING] Running as root is not recommended
2017/08/14 15:17:12 >>> LOG START
2017/08/14 15:17:12 [main:3] Liquidsoap 1.3.1 (git://github.com/savonet/liquidsoap.git@c3f167735b4c7bb7ab3502e3579246d13aa48c67:20170610:134030)
2017/08/14 15:17:12 [main:3] Using: bytes=[distributed with OCaml 4.02 or above] pcre=7.2.3 dtools=0.3.3 duppy=0.6.0 duppy.syntax=0.6.0 cry=0.5.0 mm=0.3.0 xmlplaylist=0.1.4 lastfm=0.3.1 ogg=0.5.1 vorbis=0.7.0 opus=0.1.2 speex=0.2.1 mad=0.4.5 flac=0.1.2 flac.ogg=0.1.2 dynlink=[distributed with Ocaml] lame=0.3.3 shine=0.2.1 gstreamer=0.2.3 frei0r=0.1.1 fdkaac=0.2.1 theora=0.3.1 gavl=0.1.6 ffmpeg=0.1.2 bjack=0.1.5 alsa=0.2.3 ao=0.2.1 samplerate=0.1.4 taglib=0.3.3 ssl=0.5.3 magic=0.7.3 camomile=0.8.5 inotify=2.3 yojson=1.3.3 faad=0.3.3 soundtouch=0.1.8 portaudio=0.2.1 pulseaudio=0.1.3 ladspa=0.1.5 dssi=0.1.2 sdl=0.9.1 camlimages=4.2.0 lo=0.1.1 gd=1.0a5
2017/08/14 15:17:12 [gstreamer.loader:3] Loaded GStreamer 1.10.4 0
2017/08/14 15:17:12 [frame:3] Using 44100Hz audio, 25Hz video, 44100Hz master.
2017/08/14 15:17:12 [frame:3] Frame size must be a multiple of 1764 ticks = 1764 audio samples = 1 video samples.
2017/08/14 15:17:12 [frame:3] Targetting 'frame.duration': 0.04s = 1764 audio samples = 1764 ticks.
2017/08/14 15:17:12 [frame:3] Frames last 0.04s = 1764 audio samples = 1 video samples = 1764 ticks.
2017/08/14 15:17:12 [decoder:3] Method "MAD" accepted "/radio/tracks/bassi_maestro/background/sic.mp3".
2017/08/14 15:17:12 [threads:3] Created thread "generic queue #1".
2017/08/14 15:17:12 [threads:3] Created thread "generic queue #2".
2017/08/14 15:17:12 [threads:3] Created thread "non-blocking queue #1".
2017/08/14 15:17:12 [threads:3] Created thread "non-blocking queue #2".
2017/08/14 15:17:12 [test(dot)m3u:3] Loading playlist...
2017/08/14 15:17:12 [test(dot)m3u:3] No mime type specified, trying autodetection.
2017/08/14 15:17:12 [test(dot)m3u:3] Playlist treated as format application/x-mpegURL
2017/08/14 15:17:12 [test(dot)m3u:3] Successfully loaded a playlist of 1 tracks.
2017/08/14 15:17:12 [default-fallback:3] "/radio/tracks/bassi_maestro/background/sic.mp3" is static, resolving once for all...
2017/08/14 15:17:12 [default-fallback:3] Prepared "/radio/tracks/bassi_maestro/background/sic.mp3" (RID 0).
2017/08/14 15:17:12 [foo1:3] Connecting mount foo1 for source@xxx.com...
2017/08/14 15:17:12 [decoder:3] Method "MAD" accepted "/radio/tracks/bassi_maestro/background/sic.mp3".
2017/08/14 15:17:12 [foo1:3] Connection setup was successful.
2017/08/14 15:17:12 [threads:3] Created thread "wallclock_main" (1 total).
2017/08/14 15:17:12 [clock.wallclock_main:3] Streaming loop starts, synchronized with wallclock.
2017/08/14 15:17:12 [fallback_7783:3] Switch to default-fallback.
simahawk commented 7 years ago

If I use mksafe instead of fallback it works:

myplaylist = mksafe(playlist(mode="normal", getenv("PLAYLIST")))

Am I missing some setting bit for fallback?

toots commented 7 years ago

Well, mksafe is a wrapper around fallback:

def mksafe(~id="mksafe",s)
  fallback(id=id,track_sensitive=false,[s,blank(id="safe_blank")])
end

How long is your security single?

simahawk commented 7 years ago

5 minutes (4,6M).

toots commented 7 years ago

Yeah so what happen is that without the track_sensitive=false, the fallback waits for the security track to end before switching back to the main source.. So 5min at a time..