None
closed
nobody
None
2018-03-16
2018-02-16
jk
No

When using the Windows Media Player (WMP) for streaming a playlist to a upmpdcli media renderer with the MPD repeat mode set to "on" instead of the playlist only a single song is played repeatedly.

WMP does not support the OpenHome playlist service, but uses the UPnP SetAVTransportURI service to send a new songs URI after the TransportState has changed from PLAYING to STOPPED. This is never the case if the repeat mode is enabled on the media renderer as MPD immediately restarts the song.

Unfortunately, the repeat button in the WMP does not reflect the repeat state of the media renderer. So, if for example in BubbleUPnP the repeat mode was enabled, and WMP is used later, playing a whole playlist fails as only a single track is played repeatedly.

I circumvented this by enabling the consume mode in MPD if SetAVTransportURI is used. This way it does not matter if repeat mode is enabled, too. After MPD has played the song from the URI, the song is removed from the playlist and the TransportState switches to STOPPED making the WMP to send the next songs URI.

diff --git a/src/avtransport.cxx b/src/avtransport.cxx
index 15452ca..0e70779 100644
--- a/src/avtransport.cxx
+++ b/src/avtransport.cxx
@@ -631,6 +631,7 @@ int UpMpdAVTransport::playcontrol(const SoapIncoming& sc, SoapOutgoing& data, in
         LOGERR("UpMPd::playcontrol: bad control " << what << endl);
         return UPNP_E_INVALID_PARAM;
     }
+    m_dev->m_mpdcli->consume(true);

     bool ok = true;
     switch (mpds.state) {

What do you think?

Discussion

  • medoc
    medoc
    2018-02-17

    I think that a better approach would be to reset the repeat mode in setAVTransportURI(), this is more directly what we want and repeat does not make sense if we are used by an AVTransport Control Point (which will handle playlist modes by itself, the Renderer only sees the current track and maybe the next).

    Could you try to add

    m_dev->m_mpdcli->repeat(false);
    

    To setAVTransportURI()

    and just have setPlayMode() in the same file do nothing (return 0), and see if this works for you ?

    I had not thought things through when implementing setPlayMode(), I was just dumbly translating the UPnP doc, but actually, it only makes sense when playing a multi-track media like a CD, so it should do nothing in upmpdcli.

     
    • jk
      jk
      2018-02-18

      I've tested your suggestion with WMP and it works as expected! Also successfully tested with BubbleUPnP with setting "openhome = 0" in updmpdcli.conf.

      If the AVTransport Control Point is responsible for managing the playlist, then we should turn-off all MPD playlist modes (random/shuffle, repeat/single, consume) when setAVTransportURI is called, right?

       
  • medoc
    medoc
    2018-02-18

    Yes, but I try to reduce perturbation to mpd to the minimum as a matter of principle, so I just added turning off 'random' and 'repeat'. I don't think that 'consume' is a problem for avtransport (it is for playlist, which turns it off). 'Single' is going to prevent gapless transitions, but the assumption would be that if the user set 'single' with an mpd client, maybe they have a reason for it. Maybe I should turn shuffle off too ?

     
    • jk
      jk
      2018-02-19

      I'm fine with only turning the repeat mode off. Shuffle shouldn't be a problem as there should only be one song in the playlist when using setAVTransportURI.

       
  • medoc
    medoc
    2018-02-20

    Yes, actually shuffle is not a play mode, it's an action on the playlist, so my last phrase was irrelevant. So I'll just turn off repeat and random (there are 2 tracks in the playlist when using setnextavtransporturi for gapless playback).

     
  • jk
    jk
    2018-02-20

    Great, thanks!

     
  • medoc
    medoc
    2018-03-16

    • status: open --> closed
    • milestone: -->
     
  • medoc
    medoc
    2018-03-16

    we're done here :)

     

Cancel   Add attachment