Casting albums to UPnP plays songs twice

Issue description:

My mode of operation is casting to Upmpdcli (headless Ubuntu 22.04) from Symfonium with Jellyfin as the media provider. For the purpose of this issue, I play/queue whole albums.

Starting from version 7.2.0, (most) titles in the playlist play twice in a row, although they are only queued once. I did not observe this in version 7.1.0. It does not matter if I enable/disable gapless playback, or the alternative UPnP mode. I tried all four combinations of the two settings.


Upload description: elagil

I queued a whole album. Afterwards, I started logging close to the end of one of the titles (some seconds remaining). Then, the title repeats (although only queued once). After that, I stopped logging some seconds into the repeated title.

Additional information:

 I have an album with a very short (30 s) first title. This one does not play twice - as the only title of the album. 

Side note: Symfonium also randomly starts playback after an idle period on my UPnP renderer, when previously paused. I don’t know if that is related somehow.

Reproduction steps:

 1) Queue whole album
2) Wait for a title to finish
3) Title plays again
4) Next title plays 

Media provider:




For the logs to contains everything you need to not be casting, enable logs then connect to upnp renderer and reproduce.

All I can see is

 Error creating Cds
java.lang.IllegalArgumentException: Malformed item
	at hm.a.<init>(SourceFile:25)
	at qq.z.o0(Unknown Source:2)
	at qq.z.o1(Unknown Source:67)
	at re.z.E(Unknown Source:1359)
	at re.i.x(Unknown Source:11)
	at ys.a.k(Unknown Source:5)
	at Source:109)
	at Source:27)
	at Source:2)
	at Source:91)

So Upmpdcli returns invalid data that is probably the cause, proper logs would show what to report to the dev that is active.

Ok, I see.

Trying to reproduce the exact issue as you described, I did not succeed yet. I will retry a few more times.
However, I get a different issue that is somewhat similar to the first one.

Steps I took:

  • Local playback enabled, as advised
  • enable debug
  • Select casting to UPnP
  • Play song A from album
  • Seek until close to the end of the song A (here, -16 s)
  • Wait for next song B
  • Song B indeed plays
  • disable debug

So, the correct next song plays, but Symfonium displays information of song A again. Switching back from casting to local playback, Symfonium plays song A, instead of song B that was playing via UPnP.

Logs are found under elagil1.

Thank you in advance!

So yes this is an Upmpdcli bug that needs to be reported to him.

They do not return the mandatory ID in the CurrentURI answer of GetMediaInfoResponse but strangely correctly returns it in NextURIMetaData

You can tell him that Symfonium sends :

<s:Envelope xmlns:s="" s:encodingStyle=""><s:Body><u:SetAVTransportURI xmlns:u="urn:schemas-upnp-org:service:AVTransport:1"><InstanceID>0</InstanceID><CurrentURI>https://xxxxx:443/Audio/7122a96aa553d4e4feb97eb756e0bb71/stream.flac?static=true&amp;dlnaheaders=true&amp;api_key=REDACTED</CurrentURI><CurrentURIMetaData>&lt;DIDL-Lite xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/" xmlns:dlna="urn:schemas-dlna-org:metadata-1-0/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:sec="" xmlns:dc=""&gt;&lt;item restricted="1" id="9ede03cf-38ed-4ed1-9fb7-4771b8c0a26a" parentID="0"&gt;&lt;upnp:album&gt;Day Breaks&lt;/upnp:album&gt;&lt;upnp:class&gt;object.item.audioItem.musicTrack&lt;/upnp:class&gt;&lt;upnp:genre&gt;Contemporary Jazz&lt;/upnp:genre&gt;&lt;upnp:artist&gt;Norah Jones&lt;/upnp:artist&gt;&lt;res duration="00:03:41" protocolInfo="http-get:*:audio/flac:DLNA.ORG_PN=FLAC;DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01500000000000000000000000000000" size="23137911"&gt;https://xxxxx:443/Audio/7122a96aa553d4e4feb97eb756e0bb71/stream.flac?static=true&amp;amp;dlnaheaders=true&amp;amp;api_key=REDACTED&lt;/res&gt;&lt;upnp:originalTrackNumber&gt;3&lt;/upnp:originalTrackNumber&gt;&lt;upnp:albumArtURI&gt;;/upnp:albumArtURI&gt;&lt;dc:title&gt;Flipside&lt;/dc:title&gt;&lt;/item&gt;&lt;/DIDL-Lite&gt;</CurrentURIMetaData></u:SetAVTransportURI></s:Body></s:Envelope>

But then he answers:

<?xml version="1.0"?>
<s:Envelope xmlns:s="" s:encodingStyle="">
<u:GetMediaInfoResponse xmlns:u="urn:schemas-upnp-org:service:AVTransport:1">
<CurrentURIMetaData>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;&lt;DIDL-Lite xmlns:dc=&quot;; xmlns:upnp=&quot;urn:schemas-upnp-org:metadata-1-0/upnp/&quot; xmlns=&quot;urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/&quot; xmlns:dlna=&quot;urn:schemas-dlna-org:metadata-1-0/&quot;&gt;&lt;item restricted=&quot;1&quot; searchable=&quot;0&quot;&gt;&lt;dc:title&gt;Flipside&lt;/dc:title&gt;&lt;orig&gt;mpd&lt;/orig&gt;&lt;upnp:class&gt;object.item.audioItem.musicTrack&lt;/upnp:class&gt;&lt;upnp:album&gt;Day Breaks&lt;/upnp:album&gt;&lt;upnp:originalTrackNumber&gt;3&lt;/upnp:originalTrackNumber&gt;&lt;res bitrate=&quot;653000&quot; sampleFrequency=&quot;44100&quot; bitsPerSample=&quot;16&quot; nrAudioChannels=&quot;2&quot;&gt;https://xxxxx:443/Audio/7122a96aa553d4e4feb97eb756e0bb71/stream.flac?static=true&amp;amp;dlnaheaders=true&amp;amp;api_key=REDACTED&lt;/res&gt;&lt;upnp:genre&gt;Contemporary Jazz&lt;/upnp:genre&gt;&lt;dc:creator&gt;Norah Jones&lt;/dc:creator&gt;&lt;upnp:artist&gt;Norah Jones&lt;/upnp:artist&gt;&lt;/item&gt;&lt;/DIDL-Lite&gt;</CurrentURIMetaData>
<NextURIMetaData>&lt;DIDL-Lite xmlns=&quot;urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/&quot; xmlns:dlna=&quot;urn:schemas-dlna-org:metadata-1-0/&quot; xmlns:upnp=&quot;urn:schemas-upnp-org:metadata-1-0/upnp/&quot; xmlns:sec=&quot;; xmlns:dc=&quot;;&gt;&lt;item restricted=&quot;1&quot; id=&quot;2382a7db-e3ff-42f5-ad6a-8ad08ed077ba&quot; parentID=&quot;0&quot;&gt;&lt;upnp:album&gt;Day Breaks&lt;/upnp:album&gt;&lt;upnp:class&gt;object.item.audioItem.musicTrack&lt;/upnp:class&gt;&lt;upnp:genre&gt;Contemporary Jazz&lt;/upnp:genre&gt;&lt;upnp:artist&gt;Norah Jones&lt;/upnp:artist&gt;&lt;res duration=&quot;00:03:53&quot; protocolInfo=&quot;http-get:*:audio/flac:DLNA.ORG_PN=FLAC;DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01500000000000000000000000000000&quot; size=&quot;20410056&quot;&gt;https://xxxxx:443/Audio/2517b741582a4d638280b0f889202c10/stream.flac?static=true&amp;amp;dlnaheaders=true&amp;amp;api_key=REDACTED&lt;/res&gt;&lt;upnp:originalTrackNumber&gt;4&lt;/upnp:originalTrackNumber&gt;&lt;upnp:albumArtURI&gt;;/upnp:albumArtURI&gt;&lt;dc:title&gt;It’s a Wonderful Time for Love&lt;/dc:title&gt;&lt;/item&gt;&lt;/DIDL-Lite&gt;</NextURIMetaData>

So no Id for CurrentURIMetaData this breaks UPnP contract. Even if he loose the ID I send he must return one.

Thanks for the insight, I will report to the author of that application then.

I could also replicate the original issue now with the logs elagil2. I guess it would be the same cause.

Yes since you enable upnpgapless and Symfonium can’t read the media playing it can’t know what to do.

Disabling gapless (and restarting the app/ stop casting then casting again something you probably did not do) should workaround that.

But if he fixes gapless will work.

I see. Yes, I missed reconnecting to the renderer or restarting the application after switching off gapless playback.

Apparently, there were some recent updates to Upmpdcli and libupnp. I will try those first and see if a fix is included. If not, I will raise this issue.

I will report back, if there is an update.

The dev from upmpdcli is very responsive and fixes issues quickly. You can open a ticket through his page, did that a couple of times.


upmpdcli developer here. I just uploaded a log (under my user name: medoc), demonstrating an issue with the detection of track changes using a looped playlist of 2 short tracks, played on gmediarender so that I should not be suspect of upmpdcli favoritism (the same bug is there with upmpdcli too). What happens is that at the end of the second track, the playing does switch back to the first, but the playing indicator and progress bar stays on the second. There are also minor glitches during the first to second track transition.

More generally, according to the UPnP standard (UPnP-av-AVTransport-v1-Service-20020625.pdf) a renderer is under no obligation to return the original data in any form of CurrentURIMetadata or variants (NextURIMetadata, Current/NextTrackMetadata). It can very well return"NOT_IMPLEMENTED" for this data, or data extracted from the stream itself.

The only foolproof indicator of what is currently playing is the URI.

Also by the way, upmpdcli will actually return the original data in general. The only exception that I’m aware of is that if it was just restarted, it will synthetize metadata from the mpd playlist, and this has none of the UPnP Media Server details of course. If it then receives a play action (without a SetURI first), the metadata emitted will be like what you got in the originally uploaded log, and I guess that it is what happened. Tthis is probably a red herring because, if an album is loaded in a running upmpdcli, then a track set to play, you will receive only your original metadata, not the one from mpd.


The issue reported here was different and based on the missing ID value that is mandatory in UPnP if you return an item.
You can return NOT_IMPLEMENTED or you need to return a valid object and in that case the ID is mandatory as per the spec.

The issue in the logs is different and tied to looping on 2 tracks, there’s a workaround for some devices issues with starting media and repeat one and since you loop again to the starting media this triggers so ignore the change. I’ll fix, I just forget to reset a flag when a change of song was done and so that workaround became not necessary.