Gapless playback for UPnP Renderer (and other improvements)

Discussion in 'MediaPortal 1 Plugins' started by Marcus Venturi, April 20, 2015.

  1. Marcus Venturi
    • Super User

    Marcus Venturi Super User

    Joined:
    March 23, 2012
    Messages:
    614
    Likes Received:
    516
    Gender:
    Male
    Ratings:
    +745 / 1
    Home Country:
    Germany Germany
    Show System Specs
    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
     

    Attached Files:

    Last edited: April 20, 2015
    • Like Like x 8
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. Marcus Venturi
    • Super User

    Marcus Venturi Super User

    Joined:
    March 23, 2012
    Messages:
    614
    Likes Received:
    516
    Gender:
    Male
    Ratings:
    +745 / 1
    Home Country:
    Germany Germany
    Show System Specs
    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: April 20, 2015
    • Like Like x 3
    • Informative Informative x 2
  4. FreakyJ
    • Team MediaPortal

    FreakyJ Development Group

    Joined:
    July 25, 2010
    Messages:
    4,021
    Likes Received:
    839
    Gender:
    Male
    Ratings:
    +1,424 / 1
    Home Country:
    Germany Germany
    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^^
     
  5. Marcus Venturi
    • Super User

    Marcus Venturi Super User

    Joined:
    March 23, 2012
    Messages:
    614
    Likes Received:
    516
    Gender:
    Male
    Ratings:
    +745 / 1
    Home Country:
    Germany Germany
    Show System Specs
    Here it is. :)

    You should just need to adjust the references to the MePo DLLs.
     

    Attached Files:

    • Like Like x 2
    • Thank You! Thank You! x 1
  6. powermarcel10
    • Premium Supporter

    powermarcel10 Retired Team Member

    Joined:
    November 30, 2010
    Messages:
    2,839
    Likes Received:
    789
    Gender:
    Male
    Occupation:
    Callcenter Agent
    Location:
    Groningen
    Ratings:
    +1,028 / 4
    Home Country:
    Netherlands Netherlands
    Show System Specs
    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!
     
  7. Rick164
    • Super User

    Rick164 Super User

    Joined:
    January 7, 2006
    Messages:
    1,335
    Likes Received:
    918
    Ratings:
    +1,359 / 0
    Home Country:
    Netherlands Netherlands
    Show System Specs
    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 :)
     
  8. Marcus Venturi
    • Super User

    Marcus Venturi Super User

    Joined:
    March 23, 2012
    Messages:
    614
    Likes Received:
    516
    Gender:
    Male
    Ratings:
    +745 / 1
    Home Country:
    Germany Germany
    Show System Specs
  9. powermarcel10
    • Premium Supporter

    powermarcel10 Retired Team Member

    Joined:
    November 30, 2010
    Messages:
    2,839
    Likes Received:
    789
    Gender:
    Male
    Occupation:
    Callcenter Agent
    Location:
    Groningen
    Ratings:
    +1,028 / 4
    Home Country:
    Netherlands Netherlands
    Show System Specs
  10. Marcus Venturi
    • Super User

    Marcus Venturi Super User

    Joined:
    March 23, 2012
    Messages:
    614
    Likes Received:
    516
    Gender:
    Male
    Ratings:
    +745 / 1
    Home Country:
    Germany Germany
    Show System Specs
    That's my goal, but it depends on how fast it is possible to fix the remainig hickups between 2 songs.
     
    • Like Like x 1
  11. powermarcel10
    • Premium Supporter

    powermarcel10 Retired Team Member

    Joined:
    November 30, 2010
    Messages:
    2,839
    Likes Received:
    789
    Gender:
    Male
    Occupation:
    Callcenter Agent
    Location:
    Groningen
    Ratings:
    +1,028 / 4
    Home Country:
    Netherlands Netherlands
    Show System Specs
    Allright, sounds good to me! Is video and pictures allready working? Maybe not with your app, but I mean especially with the plugin? :)
     
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!