Gmrender does not release audio interface Topic is solved

Having issues with your DietPi installation, or, found a bug? Post it here.
Post Reply
bamyasi
Posts: 17
Joined: Tue Jan 29, 2019 1:26 am

Gmrender does not release audio interface

Post by bamyasi » Tue Mar 05, 2019 3:29 am

Hi,

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

--Bamyasi

WilburWalsh
Posts: 12
Joined: Sat Dec 22, 2018 12:33 pm

Re: Gmrender does not release audio interface

Post by WilburWalsh » Wed Mar 06, 2019 7:20 pm

Hi,
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: https://stackoverflow.com/questions/143 ... ltaneously

bamyasi
Posts: 17
Joined: Tue Jan 29, 2019 1:26 am

Re: Gmrender does not release audio interface

Post by bamyasi » Sun Mar 10, 2019 11:37 pm

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.

--bamyasi

User avatar
MichaIng
Legend
Posts: 1256
Joined: Sat Nov 18, 2017 5:21 pm

Re: Gmrender does not release audio interface

Post by MichaIng » Mon Mar 11, 2019 12:14 am

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: https://github.com/hzeller/gmrender-resurrect
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: https://github.com/MichaIng/DietPi/issues/2610
(On Sparky SBC it throws kernel errors, but aside that works well.)

bamyasi
Posts: 17
Joined: Tue Jan 29, 2019 1:26 am

Re: Gmrender does not release audio interface

Post by bamyasi » Fri Mar 15, 2019 5:33 pm

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!

User avatar
MichaIng
Legend
Posts: 1256
Joined: Sat Nov 18, 2017 5:21 pm

Re: Gmrender does not release audio interface

Post by MichaIng » Sat Mar 16, 2019 10:25 pm

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.

Post Reply