Page 1 of 1

Gmrender does not release audio interface

Posted: Tue Mar 05, 2019 4:29 am
by bamyasi

Every time I play a stream via gmrender (UPnP renderer) it won't release the hardware audio interface after it's done playing. So in order to make another client work (e.g., raspotify) I have to login to DietPi and manually restart gmrender service first. Is there any way to prevent such behavior? Raspotify does not have this problem, I can switch from it to gmrender seamlessly. But not the other way round -- the moment I use gmrender it grabs the interface and nothing else can use it until gmrender is restarted.

My system is Allo USBridge / Sparky SBC / DietPi v6.21.1


Re: Gmrender does not release audio interface

Posted: Wed Mar 06, 2019 8:20 pm
by WilburWalsh
I just checked my combination of Gmrender and Shairport Sync, and found that Gmrender does not release the ALSA device, if I just pause the UPnP Stream. If I stop the stream, the audio device is released and can be accessed by Shairport Sync. I use 8player to send Audio from my Plex DLNA server to the Gmrender device. So I suppose Gmrender works as expected.
In contrast, the transisition from Shairport to Gmrender most of the times only works when I disconnect Airplay completely.

If there is no other way to get your system to run as desired, you might check out the ALSA dmix plugin, as explained here for example: ... ltaneously

Re: Gmrender does not release audio interface

Posted: Mon Mar 11, 2019 12:37 am
by bamyasi
Hi WilburWalsh,

This might be by design but then it is a bad design, and that's my point actually.

None of the mobile player apps I am using have a "true" stop button anymore. All they have are pause buttons. I mostly use HiFi Cast and BubbleUPnP for streaming to DLNA renders from my Android phones and Nexus 7 tablet. If you select DietPi gmediarender as a playback device from either of these apps this device will stay selected even after you exit the app. And if you try raspotify playback after that it will fail. You need to explicitly switch back to local device in UPnP player in order to ensure gmrender releases audio device on the server.

On the contrary, when I play from Spotify app via raspotify render on DietPi server, it also does not have stop button, however, when I push pause button and exit the app it will release interface on the server automatically. No need to manually switching to local device playback. Moreover, it would still remember last device used and restart playback on this device next time I run it. But it wiil not attempt to grab audio interface until I actuilly click on the play button. As a result, I can have Spotify app happily sitting paused in the background and still start BubbleUPnP and stream from it to gnrender, all without any extra effort. That's what I call proper design.

Unfortunately, this does not work the other way round since gmrender never releases audio interface once it has grabbed it. Even if I restart my phone to make sure no copies of BubbleUPnP is running in the background anymore, the audio interface on the server is still locked. Only gmrender service restart will make it release server interface. I call this a bug, or poor design if you prefer. I do not see how one can argue this might be a reasonable behavior.


Re: Gmrender does not release audio interface

Posted: Mon Mar 11, 2019 1:14 am
by MichaIng
I agree a proper design should release the audio interface once playback stops. But perhaps it was simply not intended so far to use different sound sources why this was never implemented. We could try to ask for this feature by opening a GitHub issue:
However the dev is not very active and PRs + issues stay unanswered for a long time.

Switching sound source between spotifyd and shairport-sync btw seems to work fine:
(On Sparky SBC it throws kernel errors, but aside that works well.)

Re: Gmrender does not release audio interface

Posted: Fri Mar 15, 2019 6:33 pm
by bamyasi
Apparently, BubbleUPnP author reads DietPi forums. My phone has received a BubbleUPnP update yesterday and one of the features added was an option to enable genuine "stop" button right on the "now playing" screen. I have tried it and it worked like a charm. So I can now switch playback between BubbleUPnP/gmrender and Spotify/raspotify seamlessly without audio interface lockups. Nice!

Re: Gmrender does not release audio interface

Posted: Sat Mar 16, 2019 11:25 pm
by MichaIng
Ahhh that is very great news. Thanks for reporting this!

Hmm so it is up to the clients to close connections or at least they can force GMRender to release the audio device :?. Good to know.