Problem when using fifo audio output

Don’t really know where to ask for this one so I’ll start here. I’m using Mopidy to feed a Snapcast server. This involved setting Mopidy’s audio output to a fifo like so:

output = audioresample ! audio/x-raw,rate=44100,channels=2,format=S16LE,quality=10 ! audioconvert ! wavenc ! filesink location=/tmp/snapfifo

(That’s not the way the snapcast docs say to do it. That didn’t work either. This is the correct order as suggested by the gstreamer docs)

The issue is when Mopidy comes to the end of the last track in the tracklist. Instead of stopping it just gets stuck - playback progress repeatedly reports somewhere between 0 and 0.125 seconds.

A bit of debugging revealed that mopidy/core/ is never getting an ‘end of stream’ message from Gstreamer. A little more debugging revealed it’s getting a Gstreamer error instead:

ERROR    [MainThread] GStreamer error: Error while seeking in file "/tmp/snapfifo".

And the same, simultaneously, from snapserver

snapserver[7919]: 2019-12-31 10-46-40 [Err] (PipeStream) Exception: end of file

It works fine with mpd so I suspect it’s a Gstreamer thing but I’ve no idea how to debug this any further.

I think you’ve ended up where everyone who has looked into this problem has landed so far.

I’m using this hack to make it work:

Works with Mopidy 3.

That said, it would be interesting to get to the bottom of it… Have you noticed if it makes any difference what the source of the files being played is? I’ve tried local and YouTube, and the behavior seem to be the same.

Yeah I pretty much came up with the same hack myself :slight_smile: The source of the files makes no difference, I’ve tried Spotify, Youtube (thanks to your fork :slight_smile: ), Local, File, Soundcloud, and Stream.

There’s a new experimental tCP sink for snapcast that can be used instead of the FIFO sink. Currently you’ll have to build snapserver yourself but there’s some info here. I built it and it’s working.