LMS-Community / slimserver

Server for Squeezebox and compatible players. This server is also called Lyrion Music Server.
https://lyrion.org
Other
1.12k stars 282 forks source link

AirMusic Android App fails to stream to UPnP/DLNA Media Interface Plugin #753

Closed streumix closed 2 years ago

streumix commented 2 years ago

AirMusic allows to stream Android system audio via DLNA (or Airplay), which works without rooting the device on Android 10+. This is great, as this (currently)unique app allows not only to stream local media files, but audio of any app.

But sadly it is having issues playing on the LMS UPnP/DLNA Media Interface plugin from Andy. The DLNA Renderer is found, but when trying to stream, it throws an error not able to establish a connection.

This error can be replicated by installing the free demo version of the AirMusic app on an Android phone (e.g. from Play Store). Just be aware that you need at leat Android 10 or the phone has to be rooted to get it work.

Is there someone maintaining this plugin and a chance that this incompatibility get's fixed? Maybe it's an issue inside AirMusic with their DLNA implementation (which works with rontier Silicon/UNDOK based HiFi Hardware ). But I'm the DLNA protocol expert to determine the bad guy.

Thanks, Toby

philippe44 commented 2 years ago

The UPnP bridge is doing things the other way around: meeting UPnP devices being used from LMS. Seems you want Andy's plugin for your need but that has not been maintained in years

streumix commented 2 years ago

Sorry, I've already corrected myself. I'm using UPnP Media Interface for this purpose. And after activating debug logging, I was able to determine the root cause: The plugin doesn't support the LPCM MIME-Type / codec requested by AirMusic.

[22-02-01 10:39:53.3958] Slim::Plugin::UPnP::SOAPServer::processControl (139) Invoking Slim::Plugin::UPnP::MediaRenderer::AVTransport->SetAVTransportURI( { CurrentURI => "http://192.168.178.31:41861/AirMusic.LPCM", CurrentURIMetaData => "Live AudioAirMusic Trial Google Pixel 3object.item.audioItem.musicTrackAirMusic Trial Google Pixel 3AirMusic Trial Google Pixel 3http://192.168.178.31:41861/AirMusic.jpeghttp://192.168.178.31:41861/AirMusic.LPCM", InstanceID => 0, } ) [22-02-01 10:39:53.3996] Slim::Plugin::UPnP::SOAPServer::processControl (155) SOAPServer: Slim::Plugin::UPnP::MediaRenderer::AVTransport->SetAVTransportURI returned error: [[714, "Illegal MIME-type"]] [22-02-01 10:39:53.4063] Slim::Plugin::UPnP::SOAPServer::fault (230) UPnP fault: 714 / Illegal MIME-type [22-02-01 10:39:53.4070] Slim::Plugin::UPnP::SOAPServer::fault (231) Result: s:ClientUPnPError714Illegal MIME-type

Any chance to get this added?

streumix commented 2 years ago

Just looked at the code, and there are a lot of L16 PCM formats supported, right? So there must be some sort of incompatibility in handshake. Either UPnP Media Interface or AirMusic. Or are there LPCM variants Air Music might be using and not supported by UPnP Media Interface ?

streumix commented 2 years ago

And to finish up, I'd like to further comment that there's a fundamental issue with the types.conf file entry for LPCM and/or service function Music::Info::mimeToType(). According to RFC2586 MIME type header for LPCM has sub type L16 with an required parameter rate and some futher optional parameters. Therefore, AirMusic is sending MIME type audio/L16;rate=44100;channels=2, which is correct. But when using this extracted type with Music::Info::mimeToType(), it cannot be found, as LMS supplied MIME type configuration file types.conf lists only MIME type audio/L16 without all variants defined by the parameters.

IMHO, either types.conf needs to list all variants of LPCM explicitely, or Music::Info::mimeToType() has to strip off any parameters, which are separated from the leading sub-type by a semi-colon, before mapping MIME type string to type return value.

Fixing UPnP Media interface plugin it may be an option to split parameters from sub-type and use only the leading sub-type as an argument to Music::Info::mimeToType(). (AVTransport.pm @ line 712+). This does work (verified), as rate and channels of MIME type string seem to be redundant; at least for counterpart AirMuisc. There are still proper elements bitrate and AudioChannels on the res block. But as this doesn't make Music::Info::mimeToType() work properly, it's preferred to fix the inconsistency for any MIME type with parameters like LPCM in Music::Info::mimeToType() or types.conf, isn't it?

Reards, Toby

philippe44 commented 2 years ago

AFAIK, problem is that there is nobody to maintain the UPnP/DLNA interface and it's not very widely used (and this protocol is a real pain anyway). Unless somebody else wants to step in, you'll probably have to submit a PR yourself