Icecast Audio from source coming through all mount points

836 Views Asked by At

I have an Icecast2 server with 6 mounts being served an intermittent .ogg audio stream by Ices2. When the stream is not being sent by Ices2 it has a fallback mount to a silence.ogg that keeps the stream going until Ices2 connects again to the mount.

The problem is that regardless which mount point I connect to I receive the stream from all the other Ices2 feeds.

Here is my icecast.xml:

<icecast>
<location>Toronto</location>
<admin>[email protected]</admin>

<limits>
    <clients>100</clients>
    <sources>10</sources>
    <queue-size>524288</queue-size>
    <client-timeout>30</client-timeout>
    <header-timeout>15</header-timeout>
    <source-timeout>100</source-timeout>
     <burst-size>65535</burst-size>
</limits>

<authentication>
    <!-- Sources log in with username 'source' -->
    <source-password>hackme</source-password>
    <!-- Relays log in username 'relay' -->
    <relay-password>hackme</relay-password>

    <!-- Admin logs in with the username given below -->
    <admin-user>admin</admin-user>
    <admin-password>changeMe</admin-password>
</authentication>

<hostname>sound.example.com</hostname>

<!-- You may have multiple <listener> elements -->
<listen-socket>
    <port>8000</port>
    <ssl>1</ssl>
</listen-socket>
<listen-socket>
    <port>8001</port>
</listen-socket>

<relays-on-demand>0</relays-on-demand>

<mount> 
    <mount-name>/mount1.ogg</mount-name> 
    <max-listeners>5</max-listeners> 
    <max-listener-duration>36000</max-listener-duration> 
    <burst-size>65536</burst-size>
    <fallback-mount>/silent.ogg</fallback-mount>
        <fallback-override>1</fallback-override>
        <fallback-when-full>1</fallback-when-full>  
        <public>0</public>    
</mount> 
<mount> 
     <mount-name>/mount2.ogg</mount-name> 
    <max-listeners>5</max-listeners> 
    <max-listener-duration>36000</max-listener-duration> 
    <burst-size>65536</burst-size>      
    <fallback-mount>/silent.ogg</fallback-mount>
        <fallback-override>1</fallback-override>
        <fallback-when-full>1</fallback-when-full>      
        <public>0</public>    
</mount> 
<mount> 
    <mount-name>/mount3.ogg</mount-name> 
    <max-listeners>5</max-listeners> 
    <max-listener-duration>36000</max-listener-duration> 
    <burst-size>65536</burst-size>      
    <fallback-mount>/silent.ogg</fallback-mount>
        <fallback-override>1</fallback-override>
        <fallback-when-full>1</fallback-when-full>      
        <public>0</public>    
</mount> 
<mount> 
    <mount-name>/mount4.ogg</mount-name> 
    <max-listeners>5</max-listeners> 
    <max-listener-duration>36000</max-listener-duration> 
    <burst-size>65536</burst-size>      
    <fallback-mount>/silent.ogg</fallback-mount>
        <fallback-override>1</fallback-override>
        <fallback-when-full>1</fallback-when-full>      
        <public>0</public>    
</mount> 
<mount> 
    <mount-name>/mount5.ogg</mount-name> 
    <max-listeners>5</max-listeners> 
    <max-listener-duration>36000</max-listener-duration> 
    <burst-size>65536</burst-size>      
    <fallback-mount>/silent.ogg</fallback-mount>
        <fallback-override>1</fallback-override>
        <fallback-when-full>1</fallback-when-full>      
        <public>0</public>    
</mount>     

<fileserve>1</fileserve>

<paths>
    <!-- basedir is only used if chroot is enabled -->
    <basedir>/usr/share/icecast2</basedir>

    <!-- Note that if <chroot> is turned on below, these paths must both
         be relative to the new root, not the original root -->
    <logdir>/var/log/icecast2</logdir>
    <webroot>/usr/share/icecast2/web</webroot>
    <adminroot>/usr/share/icecast2/admin</adminroot>
    <ssl-certificate>/etc/icecast2/fullchain.pem</ssl-certificate>

    <alias source="/" destination="/status.xsl"/>
</paths>

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

<security>
    <chroot>0</chroot>

</security>

1

There are 1 best solutions below

2
On

All mounts fall back to the same stream (or is that a file?): /silent.ogg

As all mount points also have override enabled the resulting behaviour will probably not be what was intended.

In Icecast all clients are stateless in context of the mount point. This means once a listener is transferred from /mountX.ogg to /silent.ogg there is no notion whatsoever about the original mountpoint that would influence subsequent behaviour. This means that if now /mountY.ogg would come online, that it would grab all current clients of /silent.ogg due to override.

One way to detangle such a setup is to have non-intersecting chains of fallbacks. e.g. /mountX.ogg to /silentX.ogg, etc.

sidenote: fallback to file is only recommended for very brief periods and the file must have high bitrate. Else you'll end up with the listener client being fed a lot of silence, as there is no real rate limiting. This can lead to the player buffering up minutes or hours of silence.