karlheyes / icecast-kh

KH branch of icecast
GNU General Public License v2.0
298 stars 106 forks source link

Option to retry relay source without dropping listeners #312

Open mylselgan opened 4 years ago

mylselgan commented 4 years ago

Hello,

I am currently using this

<relay>
  <server>myhostname</server>
  <port>8000</port>
  <mount>/my_stream</mount>
</relay>

To relay a Icecast server. The relay source (myhostname:8000) is prone to fail but available again in 2 to 3 seconds. When the source fails the relay drops all listeners and reconnects again to the source in two minutes.

Is there any option to retry the relay source few seconds without dropping the listeners?

I tried with fallback mount and found it very difficult to match the audio format as it is a AACP output.

karlheyes commented 4 years ago

the relay will retry immediately on timeout but a 2-3 seconds restart will need a fallback configured. You could always use the on-connect to take sample if you don't know the format of the stream beforehand and take a sample for the fallback. Yes it's repeat but might help if you do not have a fallback to use readily. A timeout type error could be compensated with a larger source-timeout but not if the source disconnects normally.

karl.

mylselgan commented 4 years ago

Ok, When I try the fallback it is not working. I found the following error in log

fserve/find_fh /fallbacks/fallback128.m4a (4) not found in cache

I have double checked the existence of the file, access permissions I am able to play the fallback URL when the stream is up like http://my-ip:8016/fallbacks/fallback128.m4a

but the icecast totally terminates itself when the relay source fails. 2]+ Killed icecast -c 8016/ice.xml

My xml config is

<icecast>
<location>Austria</location>
<admin>info@xiph.org</admin>
<limits>
<clients>5000</clients>
<sources>10</sources>
<client-timeout>30</client-timeout>
<header-timeout>15</header-timeout>
<source-timeout>10</source-timeout>
</limits>
<listen-socket>
<port>8016</port>
</listen-socket>
<authentication>
<source-password>hackme</source-password>
<relay-password>hackme</relay-password>
<admin-user>admin</admin-user>
<admin-password>hackme</admin-password>
</authentication>
<hostname>localhost</hostname>
<relay>
    <server>localhost</server>
    <port>8012</port>
    <mount>/1</mount>
    <local-mount>/1</local-mount>
    <relay-shoutcast-metadata>0</relay-shoutcast-metadata>
</relay>

<mount>
        <mount-name>/1</mount-name>
        <limit-rate>128k</limit-rate>
        <bitrate>128</bitrate>
        <fallback-mount>/fallbacks/fallback128.m4a</fallback-mount>
        <fallback-override>1</fallback-override>
        <fallback-when-full>1</fallback-when-full>
</mount>

<paths>
<basedir>/usr/local/share/icecast</basedir>
<logdir>/home/radio/log/</logdir>
<webroot>/usr/local/share/icecast/web/</webroot>
<adminroot>/usr/local/share/icecast/admin/</adminroot>
<deny-ip>/home/radio/icecast/deny-ip.txt</deny-ip>
<alias source="/" dest="/custom.xsl"/></paths>

    <logging>
        <accesslog>8016access.log</accesslog>
        <errorlog>8016error.log</errorlog>
        <loglevel>4</loglevel> <!-- 4 Debug, 3 Info, 2 Warn, 1 Error -->
        <logsize>10000</logsize> <!-- Max size of a logfile -->
    </logging>
</icecast>