[Pending] - Late dynamic refreshrate changer or fps detection without mediainfo

Discussion in 'Submit: code patches (MediaPortal/TV-Server/etc.)' started by disaster123, June 23, 2011.

  1. disaster123
    • Premium Supporter

    disaster123 MP Donator

    Joined:
    May 14, 2008
    Messages:
    3,546
    Likes Received:
    417
    Ratings:
    +431 / 2
    Home Country:
    Germany Germany
    Hello,

    at the moment the current MP implementation of the dynamic refreshrate changer is based on the output of mediainfo. But this does not work for streams. (for example Onlinevideos).

    I made a patch using some new functions owlroost implemented for me in V84 of his great directshowhelper.dll (THANKS owlroost).

    So how does it work?
    1.) check if the FPS is known by mediainfo
    2.) if not - start a seperate thread which waits until the video is played
    3.) get fps from running video and check if we need to change the fps according to your dynamic refreshrate settings
    4.) wait again and recheck the fps (sometimes the first check is not correct - it depends on stream and type)

    This patch is for the current MP SVN or MP 1.2 beta. To use it you also NEED owlroost directshowhelper.dll in ver. V84. You can get it from here: https://forum.team-mediaportal.com/...ty-development-81148/index113.html#post749721 or use my provided binary package for MP 1.2 beta.



    Greets Stefan
     

    Attached Files:

    • Like Like x 5
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. disaster123
    • Premium Supporter

    disaster123 MP Donator

    Joined:
    May 14, 2008
    Messages:
    3,546
    Likes Received:
    417
    Ratings:
    +431 / 2
    Home Country:
    Germany Germany
    AW: Late dynamic refreshrate changer or fps detection without mediainfo

    I can provide binaries for MP 1.2 beta - if anybody could tell me which SVN version it was.
     
  4. Owlsroost
    • Team MediaPortal

    Owlsroost Development Group

    Joined:
    October 28, 2008
    Messages:
    5,537
    Likes Received:
    2,829
    Location:
    Cambridge
    Ratings:
    +4,131 / 1
    Home Country:
    United Kingdom United Kingdom
    Show System Specs
  5. Holzi
    • Team MediaPortal

    Holzi Super Moderator

    Joined:
    April 21, 2010
    Messages:
    7,928
    Likes Received:
    1,591
    Gender:
    Male
    Location:
    Ba-Wü
    Ratings:
    +2,228 / 8
    Home Country:
    Germany Germany
    Show System Specs
    AW: Late dynamic refreshrate changer or fps detection without mediainfo

    A binary to test would be nice!
     
  6. disaster123
    • Premium Supporter

    disaster123 MP Donator

    Joined:
    May 14, 2008
    Messages:
    3,546
    Likes Received:
    417
    Ratings:
    +431 / 2
    Home Country:
    Germany Germany
    AW: Late dynamic refreshrate changer or fps detection without mediainfo

    Binary package added to 1st post.
     
  7. disaster123
    • Premium Supporter

    disaster123 MP Donator

    Joined:
    May 14, 2008
    Messages:
    3,546
    Likes Received:
    417
    Ratings:
    +431 / 2
    Home Country:
    Germany Germany
    AW: Late dynamic refreshrate changer or fps detection without mediainfo

    Updated Binary and patch.

    Added a 2time verify - some online stuff seems to be very hard to detect it. So it loops now at least for 2 times to verify that the refreshrate is constant and correct.
     
  8. gibman
    • Premium Supporter

    gibman Retired Team Member

    Joined:
    October 4, 2006
    Messages:
    2,998
    Likes Received:
    1,321
    Occupation:
    Developer
    Location:
    Aarhus
    Ratings:
    +1,372 / 0
    Home Country:
    Denmark Denmark
    on quick inspection of the code I couldn't help but notice a lot of thread.sleep calls.

    it should be possible to use some manual reset events instead.
    eg. waiting for the graph .. if it doesn't provide a mechanism for "IsGraphReady".. then we should probably look into this rather than rely on thread.sleeps.

    /gibman
     
  9. tourettes
    • Premium Supporter

    tourettes Retired Team Member

    Joined:
    January 7, 2005
    Messages:
    17,301
    Likes Received:
    4,595
    Ratings:
    +4,810 / 3
    Code (Text):
    1. if (Math.Abs(fps - newfps) > 1 && VMR9Util.g_vmr9 != null)
    What happens if the 1st detection is 24.000Hz and the 2nd 23.976Hz? Wont we end up in the wrong refresh rate? Also I would prefer that dshowhelper side would be able to provide more exact estimates / guesses about the fps since the code on C# side is really ugly :)

    Also like gibman states, sleeps should be replaced with events.

    Code (Text):
    1. while (--maxretries > 0);
    will only test 99 times, not 100 like intended (althou it wont make any real difference) :)

    Code (Text):
    1.  
    2.     public static void DelayedRefreshrateChanger(string strFile, MediaPortal.Player.g_Player.MediaType type)
    3.  
    Exception handling should be added, a thread that doesn't have such will take whole C# application down to desktop if some code that gets run in the thread will throw an exception.
     
  10. Owlsroost
    • Team MediaPortal

    Owlsroost Development Group

    Joined:
    October 28, 2008
    Messages:
    5,537
    Likes Received:
    2,829
    Location:
    Cambridge
    Ratings:
    +4,131 / 1
    Home Country:
    United Kingdom United Kingdom
    Show System Specs
    It's actually hard for the dshowhelper code to work out which is the 'best' estimate - I've seen situations where the fps estimates derived from the EVR mixer, the sample durations and the inter-sample time differences are all different, so how does it guess which one is the 'correct' fps ? :)

    I'll try and improve the 'best estimate' algorithm - maybe a bit of 'majority voting' logic would help ;)

    Tony
     
  11. disaster123
    • Premium Supporter

    disaster123 MP Donator

    Joined:
    May 14, 2008
    Messages:
    3,546
    Likes Received:
    417
    Ratings:
    +431 / 2
    Home Country:
    Germany Germany
    AW: Late dynamic refreshrate changer or fps detection without mediainfo

    OK i'll try to make my code better. Some questions before i can start:
    1.) i wasn't able to find something like IsGraphReady or another way to determine if the graph is started and playing? Can someone help with an idea?
    2.) should i put a try and catch around the whole stuff in the thread functions? Or only while calling external stuff?

    tourettes
    What is the problem here? Are there tv's which can display 24.000Hz and 23.976Hz? I thought all TVs can only display 24hz - so the nearest one would be 24hz and 25hz and i check for a difference smaller than 0.1.
     
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!