Author Topic: UPnP 2025 - Continuation of the original UPnP/DLNA plugin  (Read 34827 times)

simbun

  • Jr. Member
  • **
  • Posts: 39
Changes
- Changed the order of the mimetypes so if the device supports it, the non x version will be returned first. eg) audio/flac instead of audio/x-flac. Hopefully this doesn't break systems that previously worked, if need be I will make it a configurable option instead.

I didn't realise you were going to change the advertised mime-type given the problem was just the file extension, although with RFC 9639 audio/flac is now the official standard anyway.

This seems to have fixed the WiiM problem, and Sonos and Volumio seem unaffected so hopefully it won't cause any issues.

BoringName

  • Sr. Member
  • ****
  • Posts: 916
My point wasn't really about foobar/foo_upnp it was about the current implementation. You seem to be assuming that other renderers are at fault given that foo_upnp works, which we now know it doesn't.

I tried Volumio, Sonos, WiiM and foo_upnp (I also tried Audiophile Renderer but that appears broken with all of them) and none are gapless/seamless from MusicBee but all are with Hi-Fi Cast and mconnect (I always assume BubbleUPnP will work).

Apart from the small pop I'd say foobar does work as gapless. Obviously the pop shouldn't be there but there is no gap. I get the exact same result using bubbleUPnP as the renderer. So I think in terms of being gapless, it's working. Its just the small pop I need to try and sort out.

If you consider that not working it does make me wonder how your other devices function. Do they all have that small pop or is there an actual gap between tracks and how large is it?

Given that external control points work, could it be something to do with the way you're serving the file? As a test, can you use the URL that's served to external control points?

The plugin doesn't really handle serving the file. The stream is created using functions from MusicBeeBass.dll and the BASS library. It's those processes that handle sending the data. The plugin handles everything else except the actual stream data. That's why I said fixing that pop might not be possible for me.

The problem is the plugin is setting the SetNextAVTransportURI successfully, that means the device has everything it needs to cache the next track and transition to it without a gap. Foobar and BubbleUpNP are doing it without an actual gap, just the pop sound. If a device ends up with an actual gap (not just the pop sound) that means either the device didn't pre-cache the next track or it tried to and the plugin either declined (I don't see that in the logs) or took too long to serve it up which could or could not be the plugins fault. It's hard to diagnose when there are so many variables to consider.

One variable is do all your devices have an actual gap or is it just the pop sound?

I didn't realise you were going to change the advertised mime-type given the problem was just the file extension, although with RFC 9639 audio/flac is now the official standard anyway.

This seems to have fixed the WiiM problem, and Sonos and Volumio seem unaffected so hopefully it won't cause any issues.

I didn't change the advertised mimetypes that are supported. Eg) The plugin should still advertise it supports audio/flac and audio/x-flac. When a stream is created, the plugin searches for the applicable mimetype and returns the first one that matches and is supported by the renderer. All I did was change the order so it would match to audio/flac before it matched to audio/x-flac.

The actual problem is WiiM is including audio/x-flac in it's supported mimetypes when it doesn't seem to support it. If it didn't the plugin would have skipped x-flac and returned audio/flac without me having to change anything.

BoringName

  • Sr. Member
  • ****
  • Posts: 916
I just tested with 1.5.2 and it's NOT gapless from MusicBee (files on a NAS) to MXN10 - but it is from Bubble UPNP (Android) + MinimServer (NAS) and also from Symfonium (Android) + Emby (NAS).

Did you try with foobar yet?

Just as a curiosity, how did you fix the last track loop issue? I tested an Eversolo streamer recently that had this issue, it would be great if they solved it.

It was a specific issue with musicbee. Musicbee provides a notification when it is finished the playing tracks list. I just set it to stop when that notification triggered. The issue I initially had was the settings I had for the "playing tracks" element were preventing that notification from triggering so I didn't know it existed until I went looking for it and solved my settings problem.

BoringName

  • Sr. Member
  • ****
  • Posts: 916
Done that (with v1.5.2.) Played for a few seconds and then once again crashed mpd.

So it crashed quicker than last time, I believe you said it nearly got through the whole song last time?

Why do you transcode to wav/pcm anyhow?

It's just how the plugin was setup when I took it over. I'll add a flac option. That might require users to add a flac encoder in the File Converters settings, I can't remember if it's there by default. It may have been made for compatibility reasons. The plugin is over 10 years old, less stuff probably supported flac back then and PCM would have been widely supported I would think. Obviously it's causing a lot of problems now.

My guess is that the 2nd song starts playing and then gets its playback position reset to the start, leading to the short repeated section and the choppy transition.

That's great work. I know what's causing that to occur now. Thanks. Not sure I would have figured that out on my own, at least not for long time.

Another idea for an option of the plugin:
You could add a checkbox for "never transcode/force original" so that people could leave options such as smooth fading and replay gain enabled for normal players and could still play via upnp without transcoding.

I'll add that in.

BoringName

  • Sr. Member
  • ****
  • Posts: 916
The pop is gone. Foobar and bubbleUPnP now play a continuous tone with no gaps/pops.

There is a chance this will also fix delays with other devices. I noticed playback was stopping with native flac streams after the first track with BubbleUPnP but since making the fix they play through fine.

Thanks again Casual Tea.

I'll add those other options and push out another version in a day or two.

Casual Tea

  • Jr. Member
  • **
  • Posts: 23
The pop is gone. Foobar and bubbleUPnP now play a continuous tone with no gaps/pops.
..
I'll add those other options and push out another version in a day or two.
Lovely!

So it crashed quicker than last time, I believe you said it nearly got through the whole song last time?
Yeah it crashes after 5ish seconds.

I redid the test with debug level logging active in mpd to see why it crashes:
MPD debug log:
Code
Mar 05 16:16 : client: [1] process command "addid "http://192.168.1.5:49382/encode/BBE0A499E270767A-2147483463.L16" "0""
Mar 05 16:16 : client: [1] command returned 0
Mar 05 16:16 : client: [1] process command "addtagid "2" "Artist" "Laswell, Greg, Greg Laswell""
Mar 05 16:16 : client: [1] command returned 0
Mar 05 16:16 : client: [1] process command "addtagid "2" "Album" "Covers [EP]""
Mar 05 16:16 : client: [1] command returned 0
Mar 05 16:16 : client: [1] process command "addtagid "2" "Title" "The Killing Moon""
Mar 05 16:16 : client: [1] command returned 0
Mar 05 16:16 : client: [1] process command "addtagid "2" "Track" "1""
Mar 05 16:16 : client: [1] command returned 0
Mar 05 16:16 : client: [1] process command "addtagid "2" "Comment" "client=upmpdcli;""
Mar 05 16:16 : client: [1] command returned 0
Mar 05 16:16 : client: [1] process command "status"
Mar 05 16:16 : client: [1] command returned 0
Mar 05 16:16 : client: [1] process command "stop"
Mar 05 16:16 : client: [1] command returned 0
Mar 05 16:16 : client: [1] process command "play"
Mar 05 16:16 : playlist: play 0:"http://192.168.1.5:49382/encode/BBE0A499E270767A-2147483463.L16"
Mar 05 16:16 : client: [1] command returned 0
Mar 05 16:16 : client: [1] process command "status"
Mar 05 16:16 : client: [1] command returned 0
Mar 05 16:16 : client: [1] process command "currentsong"
Mar 05 16:16 : client: [1] command returned 0
Mar 05 16:16 : client: [1] process command "playlistinfo "1""
Mar 05 16:16 : client: [1] command returned 0
Mar 05 16:16 : decoder_thread: probing plugin pcm
Mar 05 16:16 : decoder: audio_format=44100:16:2, seekable=true
Mar 05 16:16 : alsa_output: opened hw:CARD=sndrpihifiberry,DEV=0 type=HW
Mar 05 16:16 : alsa_output: buffer: size=4..65536 time=90..1486078
Mar 05 16:16 : alsa_output: period: size=2..32768 time=45..743039
Mar 05 16:16 : alsa_output: default period_time = buffer_time/4 = 500000/4 = 125000
Mar 05 16:16 : alsa_output: format=S24_LE (Signed 24 bit Little Endian)
Mar 05 16:16 : alsa_output: buffer_size=22050 period_size=4410
Mar 05 16:16 : output: opened "Hifiberry DAC Plus Pro" (alsa) audio_format=44100:24:2
Mar 05 16:16 : output: converting in=44100:16:2 -> f=44100:24:2 -> out=44100:24:2
Mar 05 16:16 : client: [0] process command "idle playlist player mixer options"
Mar 05 16:16 : client: [0] command returned 1
Mar 05 16:16 : client: [1] process command "status"
Mar 05 16:16 : client: [1] command returned 0
Mar 05 16:16 : client: [1] process command "currentsong"
Mar 05 16:16 : client: [1] command returned 0
Mar 05 16:16 : client: [1] process command "playlistinfo "1""
Mar 05 16:16 : client: [1] command returned 0
Mar 05 16:16 : client: [1] process command "status"
Mar 05 16:16 : client: [1] command returned 0
Mar 05 16:16 : client: [1] process command "currentsong"
Mar 05 16:16 : client: [1] command returned 0
Mar 05 16:16 : client: [1] process command "playlistinfo "1""
Mar 05 16:16 : client: [1] command returned 0
Mar 05 16:16 : client: [1] process command "playlistinfo"
Mar 05 16:16 : client: [1] command returned 0
Mar 05 16:16 : client: [0] process command "idle playlist player mixer options"
Mar 05 16:16 : client: [0] command returned 1
Mar 05 16:16 : client: [1] process command "status"
Mar 05 16:16 : client: [1] command returned 0
Mar 05 16:16 : client: [1] process command "currentsong"
Mar 05 16:16 : client: [1] command returned 0
Mar 05 16:16 : client: [1] process command "playlistinfo "1""
Mar 05 16:16 : client: [1] command returned 0
Mar 05 16:16 : client: [1] process command "status"
Mar 05 16:16 : client: [1] command returned 0
Mar 05 16:16 : client: [1] process command "currentsong"
Mar 05 16:16 : client: [1] command returned 0
Mar 05 16:16 : client: [1] process command "playlistinfo "1""
Mar 05 16:16 : client: [1] command returned 0
Mar 05 16:16 : client: [1] process command "status"
Mar 05 16:16 : alsa_output: Decoder is too slow; playing silence to avoid xrun
Mar 05 16:16 : alsa_output: Decoder is too slow; playing silence to avoid xrun
Mar 05 16:16 : alsa_output: Decoder is too slow; playing silence to avoid xrun

Plugin log of the same time-frame:
Code
9371453; 152 ForcedEncode - Stream is being encoded to apply Replaygain/DSP settings.
9371456; 153 Play - Z:\M4\Laswell, Greg\Covers [EP]\01 The Killing Moon.flac (http://192.168.1.5:49382/encode/BBE0A499E270767A-2147483463.L16)
9371493; 154 Profile - Generic Device, useragent=Music Player Daemon 0.23.12
9371497; 155 Profile - Generic Device, useragent=Music Player Daemon 0.23.12
9371500; 156 GetEncodedFile[8] 192.168.1.5 - GET Z:\M4\Laswell, Greg\Covers [EP]\01 The Killing Moon.flac to 192.168.1.13; mime=audio/L16;rate=44100;channels=2,rate=44100,channels=2
9372669; 157 SetNextAVTransportURI - No track to queue
9372741; 158 SetNextAVTransportURI - No track to queue
9372813; 159 SetNextAVTransportURI - No track to queue
9373159; 160 SetNextAVTransportURI - No track to queue
9373665; 161 SetNextAVTransportURI - No track to queue
9374173; 162 SetNextAVTransportURI - No track to queue
9374675; 163 SetNextAVTransportURI - No track to queue
9375177; 164 SetNextAVTransportURI - No track to queue
9375341; 165 GetEncodedFile[8] - exit=0, playtime=3837
9379471; 166 PostSoapRequest - 500,send=POST /uuid-677a63db-6686-01d7-34a0-b827eb0b7fae/ctl-urn-schemas-upnp-org-service-AVTransport-1 HTTP/1.1
Host: 192.168.1.13:49152
User-Agent: MusicBee UPnP Plugin
Content-Type: text/xml; charset="utf-8"
SOAPAction: "urn:schemas-upnp-org:service:AVTransport:1#Pause"
Content-Length: 290

<?xml version="1.0" encoding="UTF-8"?><s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><u:Pause xmlns:u="urn:schemas-upnp-org:service:AVTransport:1"><InstanceID>0</InstanceID></u:Pause></s:Body></s:Envelope>
9379496; 168 SoapRequest:Pause:urn:schemas-upnp-org:service:AVTransport:1:InstanceID=0 - <?xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<s:Fault>
<faultcode>s:Client</faultcode>
<faultstring>UPnPError</faultstring>
<detail>
<UPnPError xmlns="urn:schemas-upnp-org:control-1-0">
<errorCode>501</errorCode>
<errorDescription>Action Failed</errorDescription>
</UPnPError>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>

9379471; 167 SetNextAVTransportURI - No track to queue
9379511; 169 Pause - status=500

In the plugin I have set 16bit, no RAW PCM and sample rate same as source.
Repeating the same test with the bit depth set to 24bit, the only output is noise and then that also crashes after 5ish seconds.

Plugin log:
Code
11083325; 285 Profile - Generic Device, useragent=|Linux/6.1.21-v8+ UPnP/1.1 Portable SDK for UPnP devices/6.2.0
11083328; 286 Profile - Generic Device, useragent=|Linux/6.1.21-v8+ UPnP/1.1 Portable SDK for UPnP devices/6.2.0
11083347; 287 Activate - MaltePi3B-UPnP/AV:http-get:*:audio/L16:DLNA.ORG_PN=LPCM,http-get:*:application/flac:*,http-get:*:application/x-flac:*,http-get:*:application/ogg:*,http-get:*:application/vnd.apple.mpegurl:*,http-get:*:application/x-mpegurl:*,http-get:*:audio/flac:*,http-get:*:audio/x-flac:*,http-get:*:audio/aac:*,http-get:*:audio/x-aiff:*,http-get:*:audio/aif:*,http-get:*:audio/aiff:*,http-get:*:audio/dff:*,http-get:*:audio/x-dff:*,http-get:*:audio/dsd:*,http-get:*:audio/x-dsd:*,http-get:*:audio/dsf:*,http-get:*:audio/x-dsf:*,http-get:*:audio/m4a:*,http-get:*:audio/x-m4a:*,http-get:*:audio/matroska:*,http-get:*:audio/x-matroska:*,http-get:*:audio/mp1:*,http-get:*:audio/mp3:*,http-get:*:audio/mp4:*,http-get:*:audio/mpeg:*,http-get:*:audio/x-mpeg:*,http-get:*:audio/ogg:*,http-get:*:audio/vorbis:*,http-get:*:audio/x-ape:*,http-get:*:audio/ape:*,http-get:*:audio/x-monkeys-audio:*,http-get:*:audio/wav:*,http-get:*:audio/x-wav:*,http-get:*:audio/wave:*,http-get:*:audio/x-ms-wma:*,http-get:*:audio/x-ogg:*,http-get:*:audio/x-scpls:*,http-get:*:audio/x-vorbis+ogg:*,http-get:*:audio/x-vorbis:*,http-get:*:audio/x-wavpack:*,http-get:*:video/mp4:*
11085260; 288 ForcedEncode - Stream is being encoded to apply Replaygain/DSP settings.
11085263; 289 Play - Z:\M4\Laswell, Greg\Covers [EP]\01 The Killing Moon.flac (http://192.168.1.5:49382/encode/BBE0A499E270767A-2147483363.L24)
11085300; 290 Profile - Generic Device, useragent=Music Player Daemon 0.23.12
11085303; 291 Profile - Generic Device, useragent=Music Player Daemon 0.23.12
11085307; 292 GetEncodedFile[12] 192.168.1.5 - GET Z:\M4\Laswell, Greg\Covers [EP]\01 The Killing Moon.flac to 192.168.1.13; mime=audio/L24;rate=44100;channels=2,rate=44100,channels=2
11085464; 293 StateTimer - Playing,old=Stopped
11085467; 294 SetNextAVTransportURI - No track to queue
11085478; 295 SetNextAVTransportURI - No track to queue
11086029; 296 SetNextAVTransportURI - No track to queue
11086530; 297 SetNextAVTransportURI - No track to queue
11087043; 298 SetNextAVTransportURI - No track to queue
11087543; 299 SetNextAVTransportURI - No track to queue
11088043; 300 SetNextAVTransportURI - No track to queue
11088559; 301 SetNextAVTransportURI - No track to queue
11089062; 302 SetNextAVTransportURI - No track to queue
11089565; 303 SetNextAVTransportURI - No track to queue
11090075; 304 SetNextAVTransportURI - No track to queue
11090585; 305 SetNextAVTransportURI - No track to queue
11091091; 306 SetNextAVTransportURI - No track to queue
11091332; 307 GetEncodedFile[12] - exit=0, playtime=6021
11091518; 308 SetNextAVTransportURI - No track to queue
11092019; 309 SetNextAVTransportURI - No track to queue
11096343; 310 SetNextAVTransportURI - No track to queue
11096343; 311 PostSoapRequest - 500,send=POST /uuid-677a63db-6686-01d7-34a0-b827eb0b7fae/ctl-urn-schemas-upnp-org-service-AVTransport-1 HTTP/1.1
Host: 192.168.1.13:49152
User-Agent: MusicBee UPnP Plugin
Content-Type: text/xml; charset="utf-8"
SOAPAction: "urn:schemas-upnp-org:service:AVTransport:1#Pause"
Content-Length: 290

<?xml version="1.0" encoding="UTF-8"?><s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><u:Pause xmlns:u="urn:schemas-upnp-org:service:AVTransport:1"><InstanceID>0</InstanceID></u:Pause></s:Body></s:Envelope>
11096360; 312 SetNextAVTransportURI - No track to queue
11096375; 313 SoapRequest:Pause:urn:schemas-upnp-org:service:AVTransport:1:InstanceID=0 - <?xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<s:Fault>
<faultcode>s:Client</faultcode>
<faultstring>UPnPError</faultstring>
<detail>
<UPnPError xmlns="urn:schemas-upnp-org:control-1-0">
<errorCode>501</errorCode>
<errorDescription>Action Failed</errorDescription>
</UPnPError>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>

11096395; 314 Pause - status=500

Mpd log:
Code
Mar 05 16:45 : client: [2] process command "addid "http://192.168.1.5:49382/encode/BBE0A499E270767A-2147483363.L24" "0""
Mar 05 16:45 : client: [2] command returned 0
Mar 05 16:45 : client: [2] process command "addtagid "1" "Artist" "Laswell, Greg, Greg Laswell""
Mar 05 16:45 : client: [2] command returned 0
Mar 05 16:45 : client: [2] process command "addtagid "1" "Album" "Covers [EP]""
Mar 05 16:45 : client: [2] command returned 0
Mar 05 16:45 : client: [2] process command "addtagid "1" "Title" "The Killing Moon""
Mar 05 16:45 : client: [2] command returned 0
Mar 05 16:45 : client: [2] process command "addtagid "1" "Track" "1""
Mar 05 16:45 : client: [2] command returned 0
Mar 05 16:45 : client: [2] process command "addtagid "1" "Comment" "client=upmpdcli;""
Mar 05 16:45 : client: [2] command returned 0
Mar 05 16:45 : client: [2] process command "status"
Mar 05 16:45 : client: [2] command returned 0
Mar 05 16:45 : client: [2] process command "stop"
Mar 05 16:45 : client: [2] command returned 0
Mar 05 16:45 : client: [2] process command "play"
Mar 05 16:45 : playlist: play 0:"http://192.168.1.5:49382/encode/BBE0A499E270767A-2147483363.L24"
Mar 05 16:45 : client: [2] command returned 0
Mar 05 16:45 : client: [2] process command "status"
Mar 05 16:45 : client: [2] command returned 0
Mar 05 16:45 : client: [2] process command "currentsong"
Mar 05 16:45 : client: [2] command returned 0
Mar 05 16:45 : client: [2] process command "playlistinfo "1""
Mar 05 16:45 : client: [2] command returned 0
Mar 05 16:45 : decoder_thread: probing plugin pcm
Mar 05 16:45 : decoder: audio_format=44100:24:2, seekable=true
Mar 05 16:45 : alsa_output: opened hw:CARD=sndrpihifiberry,DEV=0 type=HW
Mar 05 16:45 : alsa_output: buffer: size=4..65536 time=90..1486078
Mar 05 16:45 : alsa_output: period: size=2..32768 time=45..743039
Mar 05 16:45 : alsa_output: default period_time = buffer_time/4 = 500000/4 = 125000
Mar 05 16:45 : alsa_output: format=S24_LE (Signed 24 bit Little Endian)
Mar 05 16:45 : alsa_output: buffer_size=22050 period_size=4410
Mar 05 16:45 : output: opened "Hifiberry DAC Plus Pro" (alsa) audio_format=44100:24:2
Mar 05 16:45 : client: [1] process command "idle playlist player mixer options"
Mar 05 16:45 : client: [1] command returned 1
Mar 05 16:45 : client: [2] process command "status"
Mar 05 16:45 : client: [2] command returned 0
Mar 05 16:45 : client: [2] process command "currentsong"
Mar 05 16:45 : client: [2] command returned 0
Mar 05 16:45 : client: [2] process command "playlistinfo "1""
Mar 05 16:45 : client: [2] command returned 0
Mar 05 16:45 : client: [2] process command "status"
Mar 05 16:45 : client: [2] command returned 0
Mar 05 16:45 : client: [2] process command "currentsong"
Mar 05 16:45 : client: [2] command returned 0
Mar 05 16:45 : client: [2] process command "playlistinfo "1""
Mar 05 16:45 : client: [2] command returned 0
Mar 05 16:45 : client: [2] process command "playlistinfo"
Mar 05 16:45 : client: [2] command returned 0
Mar 05 16:45 : client: [1] process command "idle playlist player mixer options"
Mar 05 16:45 : client: [1] command returned 1
Mar 05 16:45 : client: [2] process command "status"
Mar 05 16:45 : client: [2] command returned 0
Mar 05 16:45 : client: [2] process command "currentsong"
Mar 05 16:45 : client: [2] command returned 0
Mar 05 16:45 : client: [2] process command "playlistinfo "1""
Mar 05 16:45 : client: [2] command returned 0
Mar 05 16:45 : client: [2] process command "status"
Mar 05 16:45 : client: [2] command returned 0
Mar 05 16:45 : client: [2] process command "currentsong"
Mar 05 16:45 : client: [2] command returned 0
Mar 05 16:45 : client: [2] process command "playlistinfo "1""
Mar 05 16:45 : client: [2] command returned 0
Mar 05 16:45 : client: [2] process command "status"
Mar 05 16:45 : client: [2] command returned 0
Mar 05 16:45 : client: [2] process command "currentsong"
Mar 05 16:45 : client: [2] command returned 0
Mar 05 16:45 : client: [2] process command "playlistinfo "1""
Mar 05 16:45 : client: [2] command returned 0
Mar 05 16:45 : client: [2] process command "status"
Mar 05 16:45 : client: [2] command returned 0
Mar 05 16:45 : client: [2] process command "currentsong"
Mar 05 16:45 : client: [2] command returned 0
Mar 05 16:45 : client: [2] process command "playlistinfo "1""
Mar 05 16:45 : client: [2] command returned 0
Mar 05 16:45 : client: [2] process command "status"
Mar 05 16:45 : client: [2] command returned 0
Mar 05 16:45 : client: [2] process command "currentsong"
Mar 05 16:45 : client: [2] command returned 0
Mar 05 16:45 : client: [2] process command "playlistinfo "1""
Mar 05 16:45 : client: [2] command returned 0
Mar 05 16:45 : client: [2] process command "status"
Mar 05 16:45 : alsa_output: Decoder is too slow; playing silence to avoid xrun
Mar 05 16:45 : alsa_output: Decoder is too slow; playing silence to avoid xrun
Mar 05 16:45 : alsa_output: Decoder is too slow; playing silence to avoid xrun
Mar 05 16:45 : alsa_output: Decoder is too slow; playing silence to avoid xrun
Looks like there's something wrong with the PCM encoding. Otherwise the mpd logs look exactly like if I cast from Symfonium.
Last Edit: March 05, 2025, 03:48:38 PM by Casual Tea

BoringName

  • Sr. Member
  • ****
  • Posts: 916
Mar 05 16:16 : alsa_output: format=S24_LE (Signed 24 bit Little Endian)
Mar 05 16:16 : output: converting in=44100:16:2 -> f=44100:24:2 -> out=44100:24:2

That looks like your setup is taking the 16 bit PCM stream and converting it to 24 bit Little Endian.

The PCM stream created by the plugin is Big Endian unless it's a WAV and then it's Little Endian. The "do not use RAW PCM" forces the plugin to not use WAV. Effectively forcing it to Big Endian. (WAV is also a PCM stream but has a 44 byte header)

I expect that's why you get noise when set to 24 bit because I don't see the "converting" line in the 24 bit log. It's not converting the stream so it's sending your device a Big Endian stream when it usually receives Little Endian.

I could add an option to force Little Endian for PCM streams. I suspect the Endianess might be why some Marantz devices get white noise.

BoringName

  • Sr. Member
  • ****
  • Posts: 916
New version mb_Upnp2025_1.6

Changes
- Fixed an issue that caused a pop with gapless streaming.
- New transcode output format option "Flac". Users may need to add the flac encoder in musicbee's file converter section, I can't remember if it's installed by default. The plugin uses the std. Compression option.
- New option "force native stream". The plugin will ignore all transcode/DSP/Replaygain settings and stream the file natively. Due to native streams seemingly having less issues and some users having trouble setting profiles, I have defaulted this option to true. This "should" allow the plugin to work for more people out of the box.
- New option "force little endian for PCM streams". Wave are already little endian but L16/L24 streams are big endian. This forces them to be little endian which might fix white noise issues. "do not use Raw PCM" should probably be checked when using this setting as the plugin will default to Wave for PCM streams if the device supports it.

As the "force native stream" setting conflicts with "force transcoding" you may need to re-check "force transcoding" if you were using it before upgrading.

In my testing, encoded streams start with a small noise which effects gapless playback. This is different to the previous issue as playing just a single track will start with the noise. I haven't found a cause for this yet. Native streams are not effected by this issue.

The force little endian setting seems to vary across renderers. Foobar plays big endian PCM streams  but produces a screeching noise with little endian. BubbleUPnP has no problems playing both big and little endian PCM streams.

RRoyce

  • Newbie
  • *
  • Posts: 9
The "force little endian" option in version 1.6 fixes the issue with Marantz PM7000n. Now plays fine in normal and gapless modes. Good work!

BoringName

  • Sr. Member
  • ****
  • Posts: 916
The "force little endian" option in version 1.6 fixes the issue with Marantz PM7000n. Now plays fine in normal and gapless modes. Good work!

Nice.

Be interested to know if it works with the "force native stream" option. The endianness issue is limited to PCM streams which should only be necessary if your device doesn't support whatever file format your library is stored in.

simbun

  • Jr. Member
  • **
  • Posts: 39
The pop is gone. Foobar and bubbleUPnP now play a continuous tone with no gaps/pops.

That's great news.

I tested the new plugin with WiiM Pro, Sonos Play 1 and Volumio, using 18 tracks each of 10 seconds in length (of the tone I supplied earlier) and applied ReplayGain to every other track.

My first test was with 'Force Native Stream' enabled, and all 3 devices produced a consistent tone across all track transitions.

I then disabled 'Force Native Stream' and enabled 'Normalise volume of tracks with replaygain tags', and all 3 devices were gapless, with volume shifts in alternate tracks as expected. Tracks with ReplayGain tags were transcoded to 'audio/wav'.

Playback was flawless, the only issues I saw were:
- When casting to WiiM the seek bar didn't update during the first track.
- The seek bar in general seemed a little behind the track and drifted over time (seen with all devices). Towards the end of the test, track transition was occuring at 8 seconds.

A very good result!

Casual Tea

  • Jr. Member
  • **
  • Posts: 23
"do not use RAW PCM" + "PCM - 16" bit still crashes mpd after a couple of seconds. This time (on a different pi) with a new error:
This pi is a Pi zero 2 W with a HiFiBerry DAC+ Zero. The one I had tested on so far was a Pi 3B with a HiFiBerry DAC+ Pro (I wanted to rule out the hardware).
Code
Mar 06 17:54 : exception: CURL failed: transfer closed with 34696704 bytes remaining to read
Mar 06 17:54 : decoder_thread: probing plugin pcm
Mar 06 17:54 : decoder: audio_format=44100:16:2, seekable=true
Mar 06 17:54 : client: [12] process command "status"
Mar 06 17:54 : client: [12] command returned 0
Mar 06 17:54 : client: [12] process command "currentsong"
Mar 06 17:54 : client: [12] command returned 0
Mar 06 17:54 : client: [12] process command "playlistinfo "1""
Mar 06 17:54 : client: [12] command returned 0
Mar 06 17:54 : client: [12] process command "status"
Mar 06 17:54 : client: [12] command returned 0
Mar 06 17:54 : client: [12] process command "currentsong"
Mar 06 17:54 : client: [12] command returned 0
Mar 06 17:54 : client: [12] process command "playlistinfo "1""
Mar 06 17:54 : client: [12] command returned 0
Mar 06 17:54 : client: [12] process command "status"
Mar 06 17:54 : client: [12] command returned 0
Mar 06 17:54 : client: [12] process command "currentsong"
Mar 06 17:54 : client: [12] command returned 0
Mar 06 17:54 : client: [12] process command "playlistinfo "1""
Mar 06 17:54 : client: [12] command returned 0
Mar 06 17:54 : client: [12] process command "status"
Mar 06 17:54 : client: [12] command returned 0
Mar 06 17:54 : client: [12] process command "currentsong"
Mar 06 17:54 : client: [12] command returned 0
Mar 06 17:54 : client: [12] process command "playlistinfo "1""
Mar 06 17:54 : client: [12] command returned 0
Mar 06 17:54 : client: [12] process command "status"
Mar 06 17:54 : alsa_output: Decoder is too slow; playing silence to avoid xrun

Setting "force little endian for PCM streams" and "PCM - 24 bit" still yields noise for a few seconds and then crashes mpd.
Plugin log:
Code
796971; 95 ForcedEncode - Stream is being encoded to apply Replaygain/DSP settings.
796975; 96 Play - Z:\M4\Pixies\You’re So Impatient [Single]\02 Que Sera Sera.flac (http://192.168.1.5:49382/encode/5B95923D2C4EC020-2147483617.L24)
797235; 97 StateTimer - Playing,old=Stopped
797245; 98 Profile - Generic Device, useragent=Music Player Daemon 0.23.12
797255; 100 Profile - Generic Device, useragent=Music Player Daemon 0.23.12
797262; 101 GetEncodedFile[15] 192.168.1.5 - GET Z:\M4\Pixies\You’re So Impatient [Single]\02 Que Sera Sera.flac to 192.168.1.30; mime=audio/L24;rate=44100;channels=2,rate=44100,channels=2
797252; 99 ForcedEncode - Stream is being encoded to apply Replaygain/DSP settings.
797751; 102 SetNextAVTransportURI - Success - http://192.168.1.5:49382/encode/3ADE7E64C55A1DC90.L24
802559; 103 GetEncodedFile[15] - exit=0, playtime=5286
817075; 104 PostSoapRequest - 500,send=POST /uuid-d42bb9f2-5808-dbd2-61e3-2ccf67a5792c/ctl-urn-schemas-upnp-org-service-AVTransport-1 HTTP/1.1
Host: 192.168.1.30:49152
User-Agent: MusicBee UPnP Plugin
Content-Type: text/xml; charset="utf-8"
SOAPAction: "urn:schemas-upnp-org:service:AVTransport:1#Pause"
Content-Length: 290

<?xml version="1.0" encoding="UTF-8"?><s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><u:Pause xmlns:u="urn:schemas-upnp-org:service:AVTransport:1"><InstanceID>0</InstanceID></u:Pause></s:Body></s:Envelope>
817080; 105 SoapRequest:Pause:urn:schemas-upnp-org:service:AVTransport:1:InstanceID=0 - <?xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<s:Fault>
<faultcode>s:Client</faultcode>
<faultstring>UPnPError</faultstring>
<detail>
<UPnPError xmlns="urn:schemas-upnp-org:control-1-0">
<errorCode>501</errorCode>
<errorDescription>Action Failed</errorDescription>
</UPnPError>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>

817083; 106 Pause - status=500
mpd log:
Code
Mar 06 17:58 : client: [6] process command "addid "http://192.168.1.5:49382/encode/5B95923D2C4EC020-2147483617.L24" "0""
Mar 06 17:58 : client: [6] command returned 0
Mar 06 17:58 : client: [6] process command "addtagid "3" "Artist" "Pixies""
Mar 06 17:58 : client: [6] command returned 0
Mar 06 17:58 : client: [6] process command "addtagid "3" "Album" "You're So Impatient [Single]""
Mar 06 17:58 : client: [6] command returned 0
Mar 06 17:58 : client: [6] process command "addtagid "3" "Title" "Que Sera Sera""
Mar 06 17:58 : client: [6] command returned 0
Mar 06 17:58 : client: [6] process command "addtagid "3" "Track" "2""
Mar 06 17:58 : client: [6] command returned 0
Mar 06 17:58 : client: [6] process command "addtagid "3" "Comment" "client=upmpdcli;""
Mar 06 17:58 : client: [6] command returned 0
Mar 06 17:58 : client: [6] process command "status"
Mar 06 17:58 : client: [6] command returned 0
Mar 06 17:58 : client: [6] process command "status"
Mar 06 17:58 : client: [6] command returned 0
Mar 06 17:58 : client: [6] process command "stop"
Mar 06 17:58 : client: [6] command returned 0
Mar 06 17:58 : client: [6] process command "playlistinfo"
Mar 06 17:58 : client: [6] command returned 0
Mar 06 17:58 : client: [6] process command "play"
Mar 06 17:58 : playlist: play 0:"http://192.168.1.5:49382/encode/5B95923D2C4EC020-2147483617.L24"
Mar 06 17:58 : client: [6] command returned 0
Mar 06 17:58 : client: [6] process command "status"
Mar 06 17:58 : client: [6] command returned 0
Mar 06 17:58 : client: [6] process command "currentsong"
Mar 06 17:58 : client: [6] command returned 0
Mar 06 17:58 : client: [6] process command "playlistinfo "1""
Mar 06 17:58 : client: [6] command returned 0
Mar 06 17:58 : decoder_thread: probing plugin pcm
Mar 06 17:58 : decoder: audio_format=44100:24:2, seekable=true
Mar 06 17:58 : alsa_output: opened hw:CARD=sndrpihifiberry,DEV=0 type=HW
Mar 06 17:58 : alsa_output: buffer: size=64..65536 time=1451..1486078
Mar 06 17:58 : alsa_output: period: size=32..32768 time=725..743039
Mar 06 17:58 : alsa_output: default period_time = buffer_time/4 = 500000/4 = 125000
Mar 06 17:58 : alsa_output: format=S24_LE (Signed 24 bit Little Endian)
Mar 06 17:58 : alsa_output: buffer_size=22050 period_size=4410
Mar 06 17:58 : output: opened "Hifiberry DAC" (alsa) audio_format=44100:24:2
Mar 06 17:58 : alsa_output: Decoder is too slow; playing silence to avoid xrun
Using flac as the encoder also plays the first song for a couple seconds and then crashes mpd. According to the log it instantly tried to play the 2nd queued track before getting stuck. Changing the flac encoder to the latest version also yielded no difference.

Plugin log:
Code
1543441; 155 ForcedEncode - Stream is being encoded to apply Replaygain/DSP settings.
1543444; 156 Play - Z:\M4\Great Lake Swimmers\In Pieces- An Acoustic Retrospective\16 Riverine.flac (http://192.168.1.5:49382/encode/9B671606869A561C-2147483565.flac)
1543489; 157 Profile - Generic Device, useragent=Music Player Daemon 0.23.12
1543493; 158 Profile - Generic Device, useragent=Music Player Daemon 0.23.12
1543496; 159 GetEncodedFile[23] 192.168.1.5 - GET Z:\M4\Great Lake Swimmers\In Pieces- An Acoustic Retrospective\16 Riverine.flac to 192.168.1.30; mime=audio/flac,rate=44100,channels=2
1543846; 160 StateTimer - Playing,old=Paused
1543862; 161 ForcedEncode - Stream is being encoded to apply Replaygain/DSP settings.
1544967; 162 SetNextAVTransportURI - Success - http://192.168.1.5:49382/encode/BBE0A499E270767A0.flac
1545841; 163 GetEncodedFile[23] - exit=0, playtime=2340
1622567; 164 PostSoapRequest - 500,send=POST /uuid-d42bb9f2-5808-dbd2-61e3-2ccf67a5792c/ctl-urn-schemas-upnp-org-service-AVTransport-1 HTTP/1.1
Host: 192.168.1.30:49152
User-Agent: MusicBee UPnP Plugin
Content-Type: text/xml; charset="utf-8"
SOAPAction: "urn:schemas-upnp-org:service:AVTransport:1#Pause"
Content-Length: 290

<?xml version="1.0" encoding="UTF-8"?><s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><u:Pause xmlns:u="urn:schemas-upnp-org:service:AVTransport:1"><InstanceID>0</InstanceID></u:Pause></s:Body></s:Envelope>
1622584; 165 SoapRequest:Pause:urn:schemas-upnp-org:service:AVTransport:1:InstanceID=0 - <?xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<s:Fault>
<faultcode>s:Client</faultcode>
<faultstring>UPnPError</faultstring>
<detail>
<UPnPError xmlns="urn:schemas-upnp-org:control-1-0">
<errorCode>501</errorCode>
<errorDescription>Action Failed</errorDescription>
</UPnPError>
</detail>
</s:Fault>
</s:Body>
</s:Envelope>

1622587; 166 Pause - status=500

mpd log:
Code
Mar 06 18:11 : player: played "http://192.168.1.5:49382/files/867779E74D38F64Ap.flac"
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "status"
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "playlistinfo"
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "clear"
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "repeat "0""
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "random "0""
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "single "0""
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "consume "0""
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "addid "http://192.168.1.5:49382/encode/9B671606869A561C-2147483565.flac" "0""
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "addtagid "3" "Artist" "Great Lake Swimmers""
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "addtagid "3" "Album" "In Pieces: An Acoustic Retrospective""
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "addtagid "3" "Title" "Riverine""
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "addtagid "3" "Track" "16""
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "addtagid "3" "Comment" "client=upmpdcli;""
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "status"
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "stop"
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "play"
Mar 06 18:11 : playlist: play 0:"http://192.168.1.5:49382/encode/9B671606869A561C-2147483565.flac"
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "status"
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "currentsong"
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "playlistinfo "1""
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : decoder_thread: probing plugin flac
Mar 06 18:11 : decoder: audio_format=44100:16:2, seekable=true
Mar 06 18:11 : alsa_output: opened hw:CARD=sndrpihifiberry,DEV=0 type=HW
Mar 06 18:11 : alsa_output: buffer: size=64..65536 time=1451..1486078
Mar 06 18:11 : alsa_output: period: size=32..32768 time=725..743039
Mar 06 18:11 : alsa_output: default period_time = buffer_time/4 = 500000/4 = 125000
Mar 06 18:11 : alsa_output: format=S24_LE (Signed 24 bit Little Endian)
Mar 06 18:11 : alsa_output: buffer_size=22050 period_size=4410
Mar 06 18:11 : output: opened "Hifiberry DAC" (alsa) audio_format=44100:24:2
Mar 06 18:11 : output: converting in=44100:16:2 -> f=44100:24:2 -> out=44100:24:2
Mar 06 18:11 : client: [8] process command "repeat "0""
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "random "0""
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "single "0""
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "consume "0""
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "addid "http://192.168.1.5:49382/encode/BBE0A499E270767A0.flac" "1""
Mar 06 18:11 : playlist: queue song 1:"http://192.168.1.5:49382/encode/BBE0A499E270767A0.flac"
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "addtagid "4" "Artist" "Laswell, Greg, Greg Laswell""
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "addtagid "4" "Album" "Covers [EP]""
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "addtagid "4" "Title" "The Killing Moon""
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "addtagid "4" "Track" "1""
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "addtagid "4" "Comment" "client=upmpdcli;""
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "status"
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "currentsong"
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "playlistinfo "1""
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [7] process command "idle playlist player mixer options"
Mar 06 18:11 : client: [7] command returned 1
Mar 06 18:11 : client: [8] process command "status"
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "currentsong"
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "playlistinfo "1""
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "status"
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "currentsong"
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "playlistinfo "1""
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "playlistinfo"
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [7] process command "idle playlist player mixer options"
Mar 06 18:11 : client: [7] command returned 1
Mar 06 18:11 : client: [8] process command "status"
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "currentsong"
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "playlistinfo "1""
Mar 06 18:11 : client: [8] command returned 0
Mar 06 18:11 : client: [8] process command "status"
Mar 06 18:11 : alsa_output: Decoder is too slow; playing silence to avoid xrun

After some googling I tried increasing the buffer time and period time of the audio device as suggested here, but this did not resolve the issue. Someone else in the same thread thinks it's a general problem with the curl implementation of mpd.
So I guess the problem might lie there instead of in the plugin.

Setting "force native stream (global setting)" leads to gapless playback with no crashes so far. Although, as simbun has noted, MusicBee is not in sync with the playback progress on the upnp player, which is obvious when you have synced lyrics displayed while playing. In my case it lags behind the music 0,5-1 seconds and so far does not seem to drift over time (at least over the course of 2 test songs 3min each).

Btw. at least for me, the removal of the NextAVTransportURI when the "Upcoming Tracks" are edited in MusicBee doesn't work yet. I queued 2 tracks and instantly removed the second one from the queue. The upnp player still starts playing it when the first track ends while MusicBee is stuck "playing" without a wavebar and still has the 1st song active.
Last Edit: March 06, 2025, 06:04:37 PM by Casual Tea

RRoyce

  • Newbie
  • *
  • Posts: 9
RE. the Marantz PM7000n, enabling "force native" (all other options unchecked) results in a pop-up window stating "Unable to start playback". Library is mostly 16 bit flac, some mp3, both obviously supported by the Marantz.

jean.valjean

  • Jr. Member
  • **
  • Posts: 29
Good evening,

Plug'in 1.6

“Force little endian for PCM streams” works for 16bits files but not 24bits (slow motion track).
Title and author appear but not format

“Force native stream” noise

output format flac and 24bits don't work

24-bit files work with “output as a continuous stream”.

Loss of HEOS and device remote control (noise).

BoringName

  • Sr. Member
  • ****
  • Posts: 916
A very good result!

It seems 1.6 is kicking goals!. I'll take a look at the sync issue, I think I can improve on that.