PDA

View Full Version : Cannot sync between Squeezebox and Linux Softsqueeze



Ian Payton
2005-02-05, 02:21
Hi,

I cannot properly sync my Squeezebox with Softsqueeze (running on a
separate Linux box to the server).

I am running SlimServer 5.4.0 on a Mandrake Linux 9.2 server,
Softsqueeze 1.16 with jre-1.5.0_01-fcs and mp3plugin.jar installed on a
Mandrake Linux 10.1 client machine, and firmware version 40 on the
Squeezebox. The Squeezebox and Softsqueeze client machine are wired
devices, but both on the other end of separate wireless ethernet bridges.

This set-up worked fine and synchronised perfectly (after the first
song) using slimp3slave on the client Linux box (using
madplay-0.15.2b-1mdk). I just fancied the graphical interface, so I
installed Softsqueeze in its place.

The Softsqueeze machine consistently plays about 0.5-1.0 seconds behind
the Squeezebox, and stays like that from track to track.

Any suggestions about what I might try, or what logs I might take to
help diagnose/resolve the problem?

Thanks
Ian

John Gorst
2005-02-06, 10:10
Ian Payton wrote:
> Hi,
>
> I cannot properly sync my Squeezebox with Softsqueeze (running on a
> separate Linux box to the server).
>
> I am running SlimServer 5.4.0 on a Mandrake Linux 9.2 server,
> Softsqueeze 1.16 with jre-1.5.0_01-fcs and mp3plugin.jar installed on a
> Mandrake Linux 10.1 client machine, and firmware version 40 on the
> Squeezebox. The Squeezebox and Softsqueeze client machine are wired
> devices, but both on the other end of separate wireless ethernet bridges.
>
> This set-up worked fine and synchronised perfectly (after the first
> song) using slimp3slave on the client Linux box (using
> madplay-0.15.2b-1mdk). I just fancied the graphical interface, so I
> installed Softsqueeze in its place.
>
> The Softsqueeze machine consistently plays about 0.5-1.0 seconds behind
> the Squeezebox, and stays like that from track to track.
>
> Any suggestions about what I might try, or what logs I might take to
> help diagnose/resolve the problem?

I have the same problem here - do it is nothing you have done.

Do you notice that if you skip trascks on softsqueeze (r when starting
to play) it can take a long time to start (5seconds) with 100% cpu
useage in that time?

Could we add a 'sound delay' to softsqueeze for individually tuning
synching?

Cheers

rtitmuss
2005-02-19, 14:00
Ian,

Sorry for the slow reply.

What audio mixer are you using with Softsqueeze (look in the Softsqueeze
preferences). The 'Java Sound Audio Engine' has a significant delay,
about 0.5 seconds. To get sync working on Linux you need to be using an
ALSA device driver.

Regards,
Richard


Ian Payton wrote:

> Hi,
>
> I cannot properly sync my Squeezebox with Softsqueeze (running on a
> separate Linux box to the server).
>
> I am running SlimServer 5.4.0 on a Mandrake Linux 9.2 server,
> Softsqueeze 1.16 with jre-1.5.0_01-fcs and mp3plugin.jar installed on
> a Mandrake Linux 10.1 client machine, and firmware version 40 on the
> Squeezebox. The Squeezebox and Softsqueeze client machine are wired
> devices, but both on the other end of separate wireless ethernet bridges.
>
> This set-up worked fine and synchronised perfectly (after the first
> song) using slimp3slave on the client Linux box (using
> madplay-0.15.2b-1mdk). I just fancied the graphical interface, so I
> installed Softsqueeze in its place.
>
> The Softsqueeze machine consistently plays about 0.5-1.0 seconds
> behind the Squeezebox, and stays like that from track to track.
>
> Any suggestions about what I might try, or what logs I might take to
> help diagnose/resolve the problem?
>
> Thanks
> Ian
>

Ian Payton
2005-02-20, 02:52
Richard

Richard Titmuss wrote:
> Sorry for the slow reply.

No problem. Thanks for helping.

> What audio mixer are you using with Softsqueeze (look in the Softsqueeze
> preferences). The 'Java Sound Audio Engine' has a significant delay,
> about 0.5 seconds. To get sync working on Linux you need to be using an
> ALSA device driver.

OK, I've changed this and the behaviour is now different (not fixed, but
different in a potentially interesting way... see further below).

I *was* using the Java Sound Audio Engine. Now I'm using a mixer from
the drop-down list in Softsqueeze called:
"AudioPCI [plughw:0,0]"
which I believe relates to an ALSA device. At least, running "amixer
info" returns the following:
Card default 'AudioPCI'/'Ensoniq AudioPCI ENS1371 at 0xdc80, irq 10'
Mixer name : 'TriTech id 3'
Components : 'AC97a'
Softsqueeze also has "AudioPCI [plughw:0,1]" available as a mixer. I
don't know what this refers to, but there doesn't seem to be any
difference between them (?). I only have one sound card in the system.

Anyway, the behaviour is now *different*.

At the beginning of each track, the Squeezebox and Softsqueeze are
synchronised (within a very small fraction of a second of each other).
However, within a few seconds of each track (10-15s), the Softsqueeze
has an audio drop-out for half a second or so. At this point, they lose
sync and remain that way until the end of the track. At the beginning
of the next track the same thing happens: in sync for 10-15 seconds (or
so) then half a second of silence from Softsqueeze and a consequent loss
of sync.

This happened in 9 out of 10 tracks. Occasionally Softsqueeze wouldn't
suffer the drop-out, and they would stay in sync for the whole track. I
was displaying buffer fullness on the Softsqueeze, and also running
"top" in a separate terminal window. During the drop-outs the buffer
remained firmly at 100%, and there weren't any processes using more than
a couple of percent of CPU time.

This feels like some sort of progress.Any ideas what I should
investigate next?

Here's my set-up again:

>> I am running SlimServer 5.4.0 on a Mandrake Linux 9.2 server,
>> Softsqueeze 1.16 with jre-1.5.0_01-fcs and mp3plugin.jar installed on
>> a Mandrake Linux 10.1 client machine, and firmware version 40 on the
>> Squeezebox. The Squeezebox and Softsqueeze client machine are wired
>> devices, but both on the other end of separate wireless ethernet
>> bridges.

For what it's worth, here also is my prefs file from Softsqueeze, in
case you can see anything else worth tweaking:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map SYSTEM "http://java.sun.com/dtd/preferences.dtd">
<map MAP_XML_VERSION="1.0">
<entry key="alwaysontop" value="false"/>
<entry key="audio.lineBufferSize" value="128000"/>
<entry key="audio.mixer" value="AudioPCI [plughw:0,0]"/>
<entry key="audio.mp3decoder" value="Java MP3 Plugin"/>
<entry key="displayemulation" value="Graphics"/>
<entry key="has.mp3plugin" value="true"/>
<entry key="httpport" value="9000"/>
<entry key="macaddress" value="9f:2c:a4:1b:68:d0"/>
<entry key="savedir" value="/home/fds"/>
<entry key="savestream" value="false"/>
<entry key="serverversion" value="5.4"/>
<entry key="skins" value="slim"/>
<entry key="slim.v_slim.full" value="false"/>
<entry key="slim.v_slim.main" value="true"/>
<entry key="slim.v_slim.search" value="false"/>
<entry key="slim.v_slim.slimremote" value="false"/>
<entry key="slim.v_slim.slimremote2" value="true"/>
<entry key="slimport" value="3483"/>
<entry key="slimserver" value="ssvr"/>
<entry key="sshforwardports" value=""/>
<entry key="sshpassword" value=""/>
<entry key="sshport" value="22"/>
<entry key="sshprivatekey" value=""/>
<entry key="sshtunnel" value="false"/>
<entry key="sshusername" value=""/>
<entry key="version" value="1"/>
</map>

Regards
Ian

Ian Payton
2005-02-27, 10:07
I've now found what my problem is with syncing Softsqueeze on Linux,
with my Squeezebox (although I'm not sure I can fix it). It's to do
with Java doing garbage collection towards the beginning of each track.
Read on for the full story...

To recap on the set-up, I am running SlimServer 5.4.0 on a Mandrake
Linux 9.2 server, Softsqueeze 1.16 with jre-1.5.0_01-fcs and
mp3plugin.jar installed on a Mandrake Linux 10.1 client machine, and a
Squeezebox.

On Softsqueeze, I'm using an ALSA sound driver, and the tracks start in
sync with my Squeezebox. The problem is that there's usually a
half-second drop-out towards the beginning of the track on Softsqueeze
which knocks it out of sync with my Squeezebox for the rest of that
track... then the same thing happens on the next track, etc.

To look at the Java performance, I ran SoftSqueeze like this:
java -verbose:gc -jar SoftSqueeze.jar

This outputs debug information about the garbage collection. The
half-second drop-outs in the audio coincide directly with when Java does
a "Full GC". The Java debug even reports that the "Full GC" took half a
second (bingo!). Running the incremental garbage collector instead
helps (using -Xincgc on the java command-line starting SoftSqueeze - see
the man page for "java"), but it seems like the performance on my Linux
client machine is so marginal for doing this that java still doesn't
have the time to do *all* the garbage collection in the background, and
still does a bigger garbage collection from time to time, resulting in a
(much smaller) audio drop-out and consequent loss of sync.

Good old java. This also explains why I get perfect sync using
slimp3slave, which doesn't have the garbage collection issues that Java
does. So, how to fix this?

I'm at a dead end with this now, because it's down to the performance on
my Linux box... unless something can be done in SoftSqueeze to force
garbage collection between tracks (not sure if this is even possible).
Left to its own devices, Java always does the "Full GC" about ten
seconds into each track.

Anyway, I thought people would be interested to know.

Ian

John Gorst
2005-02-27, 10:26
Ian Payton wrote:

> I'm at a dead end with this now, because it's down to the performance on
> my Linux box... unless something can be done in SoftSqueeze to force
> garbage collection between tracks (not sure if this is even possible).
> Left to its own devices, Java always does the "Full GC" about ten
> seconds into each track.
>
> Anyway, I thought people would be interested to know.

I (used to) run softsqueeze on mandrake 10 on a celeron 633 with good
performance and fairly good sync and did not see the issue that you see.
And that was with runnign an x desktop and slimserver on the same machine!

What cpu is your machine?

The only performance issue I saw was inbetween tracks witht he cpu
useage spiking to 100% and long pauses - but richard is working on this
one and ha isolated it to certain soundcards on linux.

Marc Sherman
2005-02-27, 10:56
Ian Payton wrote:
>
> This outputs debug information about the garbage collection. The
> half-second drop-outs in the audio coincide directly with when Java does
> a "Full GC". The Java debug even reports that the "Full GC" took half a
> second (bingo!). Running the incremental garbage collector instead
> helps (using -Xincgc on the java command-line starting SoftSqueeze - see
> the man page for "java"), but it seems like the performance on my Linux
> client machine is so marginal for doing this that java still doesn't
> have the time to do *all* the garbage collection in the background, and
> still does a bigger garbage collection from time to time, resulting in a
> (much smaller) audio drop-out and consequent loss of sync.
>
> Good old java. This also explains why I get perfect sync using
> slimp3slave, which doesn't have the garbage collection issues that Java
> does. So, how to fix this?

You might want to try the concurrent garbage collector.
http://java.sun.com/developer/technicalArticles/Programming/turbo/

- Marc

Ian Payton
2005-02-27, 11:57
John Gorst wrote:
> Ian Payton wrote:
>
>> I'm at a dead end with this now, because it's down to the performance
>> on my Linux box...

> I (used to) run softsqueeze on mandrake 10 on a celeron 633 with good
> performance and fairly good sync and did not see the issue that you see.
> And that was with runnign an x desktop and slimserver on the same machine!
>
> What cpu is your machine?

It's at P2/400 machine with 128MB of memory that I got for 30 off eBay.
I'm running nothing else but the X server, twm and SoftSqueeze (it's
hidden behind a sofa, with the display on a TV via my video card's
TV-Out and a hand-held mouse-trackball affair to control it.
Wife-friendly and cheaper than a second Squeezebox).

Anyway, 'top' shows that I'm *just* running everything in physical
memory (no swap being used). The slimserver's on another machine. I
have been perplexed why the CPU usage has been 70%-80% with SoftSqueeze
running, though.

So, given your comments, I started hunting around again found a lot of
firewall entries in the syslog for blocked incoming UDP traffic on port
34443. I unblocked this port, and the CPU usage has come down to an
average of about 20%, and the drop-out problems appear to have gone. I
can only think that the firewall activity was significant, and having
the impact on the machine performance (?).

I don't know enough about the protocol to know why SoftSqueeze still
works without getting the data that was destined for it on this port.
Perhaps someone can enlighten me.

I still get a CPU usage peak between tracks which *sometimes* results in
knocking the SoftSqueeze out of sync. I still need to look into that
- and someone else posted an alternative GC setting for java that I
might try. (could it be related to the soundcard problem?)

Anyway, thanks for prompting me to have another dig around.

Ian

Ian Payton
2005-02-27, 12:08
Marc Sherman wrote:
> Ian Payton wrote:
>
>> The half-second drop-outs in the audio coincide directly with when Java
>> does a "Full GC". The Java debug even reports that the "Full GC" took
>> half a second (bingo!).

> You might want to try the concurrent garbage collector.
> http://java.sun.com/developer/technicalArticles/Programming/turbo/

Thanks very much. I've fixed a lot of the performance issue in other
ways (see my other post in this thread), but I may still have a GC
issue. I need to investigate, but at least this gives me a new
direction to go in if GC still turns out to be an issue.

Cheers.
Ian

rtitmuss
2005-02-27, 14:14
Ian Payton wrote:

> I'm at a dead end with this now, because it's down to the performance
> on my Linux box... unless something can be done in SoftSqueeze to
> force garbage collection between tracks (not sure if this is even
> possible). Left to its own devices, Java always does the "Full GC"
> about ten seconds into each track.
>
> Anyway, I thought people would be interested to know.

Nice work. I never thought GC would be a problem with Softsqueeze, but
it does seem to make sense. I will do some memory profiling and see if I
can reduce this problem.

A couple of things you could try to see if they make a difference:
- Don't display the now playing playlist or music search windows.
- Try a different mp3 decoder (for example if your using java layer try
the Java MP3 Plugin, or visa versa).
- Increase the Java heap size using '-Xms=128M -Xmx=128M', this may
reduce the number of full GC's required.

Regards,
Richard