update to match current method

master
Jay 2 years ago
parent b901c01e3a
commit f1363805b8

@ -31,16 +31,21 @@ This would be a lot easier if mplayer supported stdout; **but it doesn't**. So i
```
#!/bin/bash
# This is more reliable than trying to run ices in systemd/openrc/sysvinit.
if [ `ps -aux | grep -c "/path/to/ices/conf.xml"` -lt 2 ]; then
/usr/bin/ices2 /path/to/ices/conf.xml
fi
PIPE="/tmp/asterisk-cmoh-pipe.$$"
mknod $PIPE p
# This method uses mplayer in to a named pipe. It worked great on Ubuntu; not so well on my Alpine build.
#PIPE="/tmp/asterisk-cmoh-pipe.$$"
#mknod $PIPE p
#mplayer http://server:port/mountpoint.ogg -softvol -really-quiet -quiet -ao pcm:file=$PIPE -af resample=8000,channels=1,format=mulaw,volume=-6:0 2>/dev/null | cat $PIPE 2>/dev/null
# This uses ogg123 and sox. When I did this with a playlist, the CPU usage sucked on Ubuntu. I never tried it with icecast streams.
# mplayer on Alpine had a system load average of 2.6 on the quad-core machine. ogg123/sox/icecast on Alpine averages .06 load.
ogg123 -q -d au -f - http://127.0.0.1:8000/mountpoint.ogg | sox -r 16000 -t au - -r 8000 -c 1 -t raw - 2>/dev/null
mplayer http://server:port/mountpoint.ogg -softvol -really-quiet -quiet -ao pcm:file=$PIPE -af resample=8000,channels=1,format=mulaw,volume=-6:0 2>/dev/null | cat $PIPE 2>/dev/null
```
#### Translating it in to a step-by-step list:
@ -57,6 +62,7 @@ The previous version borrowed heavily from the "it works" method. A couple thing
- changed to -softvol for no apparent reason
- added if statement to handle checking of ices2
- removed the statement to delete the pipe as it wasn't needed
- mplayer was ditched on alpine for ogg123/sox
The addition of the if statement solved a problem of making sure ices2 is feeding my icecast. I attempted to do this in systemd and it just failed. I may have figured out why, but doing it inside the script doesn't hurt and is easier than mucking around with systemd.
@ -67,7 +73,9 @@ Oh...sure...you can...***but holy cow***.
## Classic Hold Version 2: Less Complex, ***More Headache***
***This entire thing winds up using entirely too much CPU. It's not just more than the above method, it's entirely too much for the task (in my opinion). The above method uses less than 1% CPU per stream; the below method uses about 15% per stream.***
***This method is not really recommended at this time. Under Ubuntu, the performance was horrible. However I've recently switched to running Asterisk on Alpine, where mplayer's performance was horrid***
***But the similar ogg123/sox method with icecast works well. At some point I'll try with a direct playlist and see what happens.***
Let me start by saying this: getting this to work started out as medium-hard; before going full fledged pull-my-hair-out. This is because there's a *number* of additional steps we have to do that are much more involved than setting up and configuring icecast and ices2. Most of these steps weren't documented and I had to piece them together. This was on top of the fact that debugging on a headless machine for sound problems posed limitations. I had to test things on a local VM before attempting to implement them on the remote machine.

Loading…
Cancel
Save