Gapless playback for UPnP Renderer (and other improvements) (1 Viewer)

Marcus Venturi

Super User
  • Team MediaPortal
  • Super User
  • March 23, 2012
    614
    745
    52
    Germany Germany
    Country flag
    I'm working since 2 years on a UPnP Controller for ANDROID, which should be very simple to use.

    As MediaPortal user my first goal is to have perfect playback together with the MediaPortal UPnP Renderer plugin developed from @hierl_w.

    https://forum.team-mediaportal.com/threads/working-on-new-mp-upnp-renderer-process-plugin.104959/#post835560

    As the UPnP Renderer does not support gapless playback or crossfade so far, I started to implement this.
    For this purpose I took the source code provided by @Dragy in the forum.

    I modified my ANDROID client, the UPnP Renderer and a few things in the BASS engine. (I implemented the SetNextAVTransportURI action in my client as well as in the UPnP Renderer).

    Everything works but not 100% perfect, because there are still small gaps (hickup) between the tracks.

    This is where I need the help of the other developers.
    I think of @hwahrmann or any other dev that has worked on the BASS engine and has knowledge of this.

    My changes are here:

    https://github.com/MediaPortal/MediaPortal-1/compare/master...UnlimitedStack:EXP_UPNP_RENDERER_FIXES

    This branch contains all fixes I made to improve the UPnP renderer playback. They are not only BASS related.

    As there is no repository for the latest MP_UPnPRenderer changes, I attached my modified version of the plugin. I could also provide the code.

    I added support for generating a fixed Unique Device Name. This can help if there are more than one MediaPortal instances running on the same network:

    upload_2015-4-20_15-38-23.png


    And of course the support for gapless playback:

    upload_2015-4-20_15-44-24.png


    To have a contoller for testing / debugging gapless playback, I attached an APK of my client.
    It can be manually installed on ANDROID. It is necessary to enable installation of apps from other sources than the Play Store. The app itself can be installed with Apk Installer.

    https://play.google.com/store/apps/details?id=com.graphilos.apkinst&hl=de

    After starting the app you see this:

    upload_2015-4-20_15-39-43.png


    Just tap on the gear on the left bottom, then you can select Server and Renderer:

    upload_2015-4-20_15-40-19.png


    Close the dialog with (X) and tap on the "Power On" symbol.that should appear if Server and Renderer are selected and available.

    upload_2015-4-20_15-40-57.png


    Then browse to a music album for testing:

    upload_2015-4-20_15-41-43.png


    Tap on a song to start playing.

    There is a control panel for playback. Just tap on the arrow-down symbol in the top right corner:

    upload_2015-4-20_15-42-26.png


    Now you can test gapless playback.

    My goal is to find out the reason for the remaining hickup(s).

    A big THANK YOU goes to @hierl_w, @Dragy and all the others that kept this plugin alive :)

    :) Let's hope somebody can help me...

    ATTENTION: As mentioned above, you have to build your own version of MediaPortal with this branch included:

    https://github.com/MediaPortal/MediaPortal-1/compare/master...UnlimitedStack:EXP_UPNP_RENDERER_FIXES

    Otherwise it won't work!!!

    UPDATE: Added new APK with bug fix
     

    Attachments

    Last edited:

    Marcus Venturi

    Super User
  • Team MediaPortal
  • Super User
  • March 23, 2012
    614
    745
    52
    Germany Germany
    Country flag
    A few details about the implementation of the UPnP gapless playback.

    Normally in UPnP the controller - is responsible for controlling how the renderer plays the files.

    The controller calls the UPnP action "SetAVTransportURI" to tell the renderer which song to play and then starts playback with the "Play" action. The renderer just takes the song from the given URI and plays it.

    When the song is finished the controller calls the action "SetAVTransportURI" again and starts playback again with the "Play" action.

    This concept makes gapless playback impossible.

    But there is also an UPnP action called "SetNextAVTransportURI".

    This tells the renderer which song to play after the current song has ended.
    In this case the renderer is responsible for playing the next song and not the controller.

    Now the client has only to call the action "SetAVTransportURI" for the first song and then the action "Play".
    Before a song ends the client calls the action "SetNextAVTransportURI" to keep the renderer playing.

    This allows the renderer to play gapless (if he is capable) between the current and the next song, that's all the magic.

    And this is the reason why most controller / renderer combinations are not able to play music gapless, because either the controller or the renderer does not implement the "SetNextAVTransportURI" action.

    My ANDROID client checks if the renderer supports the "SetNextAVTransportURI" action. If yes, it is used to allow gapless playback.
     
    Last edited:

    FreakyJ

    Development Group
  • Team MediaPortal
  • July 25, 2010
    4,024
    1,420
    Germany Germany
    Country flag
    Really nice!
    Could you publish your src for the renderer? I'm working on a renderer for MP2 and I guess it is very easy to implement the last step. Indeed I already have support for SetNextAVTransportURI it just doesn't get checked^^
     

    powermarcel10

    Retired Team Member
  • Premium Supporter
  • November 30, 2010
    2,839
    898
    32
    Groningen
    Netherlands Netherlands
    Hi Marcus, really nice work! Is there no way to release this just as a plugin without changing anything to the MP core? Or will the core things being changed for MP 1.12. I really like to try this!
     

    Rick164

    Super User
  • Team MediaPortal
  • Super User
  • January 7, 2006
    1,335
    1,005
    Netherlands Netherlands
    Country flag
    Very nice!

    Tried the previous releases from @Dragy but maybe due to MePo changes it doesn't work right anymore at least with the Sony Walkman client, here's hoping this one works perfectly ;)
    Would be great if we can try this out without having to compile that MePo branch but gonna give it a go :)
     

    powermarcel10

    Retired Team Member
  • Premium Supporter
  • November 30, 2010
    2,839
    898
    32
    Groningen
    Netherlands Netherlands

    Marcus Venturi

    Super User
  • Team MediaPortal
  • Super User
  • March 23, 2012
    614
    745
    52
    Germany Germany
    Country flag
    That's my goal, but it depends on how fast it is possible to fix the remainig hickups between 2 songs.
     

    Users Who Are Viewing This Thread (Users: 0, Guests: 1)

    OP Similar threads Forum Replies Date
    S Resume Playback Annoyance Newcomers Forum 4
    K Flickering live TV playback Newcomers Forum 3
    J [solved] Blu-ray disc playback does not work. Bugreports 13
    morpheus_xx [WiP] OnlineVideos: New browser based playback support using WebDriver, new Amazon siteutil MediaPortal 2 6
    doskabouter [Help Me!] Playback of iTunes Movie Trailers Developer Discussions 0
    I Video Playback Stuttering General Support 45
    horned_reaper [solved] Music playback hangs General Support 58
    bta489 [solved] System goes to Standby during Amazon Prime Playback OnlineVideos 2
    A 1.24.0 1.24 Kills 3D MVC playback on MadVr 1.24 Pre Release 66
    Z [solved] DVD playback is super glitchy General 2
    A Working server, no video playback on client General 5
    L MP Playback Freezes When Unpausing from Minimized Screen General Support 6
    Cowboy Playback Problem with CTD or sometimes BSOD watch/edit Videos 0
    Glith Sound stops working after first playback 1.21 88
    G Mediaportal2 supported formats General 1
    W Playback stuttering after upgrade from MP1 on Windows 7 to MP2 on Windows 10 General 2
    joecrow Refresh rate not returned to default after 3D playback 1.21 Pre Release 0
    bta489 [solved] Stuttering playback of edited recordings watch/edit Videos 2
    A TV playback intermittently stops on clients Television (MyTV frontend and TV-Server) 4
    T frequent black screen no audio on playback NOT from beginning Watch / Listen Media 0
    M Music playback stops after certain files 1.19 0
    J Bluray playback: How to revert back to Select Play Mode after stopping playback? Watch / Listen Media 2
    joecrow BD Playback with External Player (Unnecessary Menu) 1.19 5
    osre Audio issues with MKV Playback in MP2.1.3 General 5
    joecrow MP 1.19 BD Playback with External Player (Unnecessary Menu) General Support 0
    Similar threads

























    Top Bottom