MP 1.3.x dshowhelper development (1 Viewer)

Owlsroost

Retired Team Member
  • Premium Supporter
  • October 28, 2008
    5,540
    5,038
    Cambridge
    Home Country
    United Kingdom United Kingdom
    This thread is a response to the requests I've received to produce a dshowhelper version for MP 1.3.x which includes some of the features from the later versions in the old development thread at https://forum.team-mediaportal.com/...nter-dshowhelper-community-development.81148/

    dshowhelper versions from this thread will not work in older versions of MP (before 1.3.0)

    The modifications only affect the EVR functionality - if you are using VMR9 (for Win XP) it will behave the same as the standard MP version.

    Sources are at https://github.com/MediaPortal/Medi...DWM_mod/mediaportal/Core.cpp/DirectShowHelper

    Feedback welcome :)

    Tony
     
    Last edited:

    Owlsroost

    Retired Team Member
  • Premium Supporter
  • October 28, 2008
    5,540
    5,038
    Cambridge
    Home Country
    United Kingdom United Kingdom
    For reference, the default settings for the registry values in "HKEY_CURRENT_USER\Software\Team MediaPortal\EVR Presenter" are:

    EnableDWMQueuedMode = 0​
    EnableMMCSSforDWM = 0​
    EnableMMCSSforSchedulerThread = 1​
    NumDWMBuffers = 3​
    EnableDWMAudioDelayComp = 0​
    SampleQueueSize = 5​
    WorkerThreadMmcssPriority = 1​
    TimerThreadMmcssPriority = 0​
    SchedulerThreadMmcssPriority = 2​
    ForceFirstFrame = 0​
    LowResVSyncCorrectionTiming = 0​
    FPSLimitFrameRate = 0​
    FPSLimitHeightThresh = 700​
    FPSLimitWidthThresh = 1200​
    EnableLateDWMInit = 0​
    Enable24HzDWM = 1​
    EnableDWMInitSleep = 1​


    Release v663b:
    • DWM 'queued' mode support added (like the older 'part_DWM' versions)
    • Sample queue management changed to fix occasional frame 'flashback' problems
    • High-hysteresis frame drop/repeat logic added to produce cleaner frame drops and repeats
    • Thread locking converted/reverted to hard locks as an experiment ('PauseThread' etc removed)
    • Potential deadlock situation when flushing worked around
    • Registry key added - 'HKEY_CURRENT_USER\Software\Team MediaPortal\EVR Presenter\EnableDWMQueuedMode - if this is '1' DWM queued mode is enabled, if '0' it is disabled (it is disabled in the standard dshowhelper).
    Release v666:
    • Converted to use Unicode for Windows API interfaces
    • Fixed a bug so the registry settings are now applied correctly
    • Added new Registry setting - 'HKEY_CURRENT_USER\Software\Team MediaPortal\EVR Presenter\NumDWMBuffers' - sets number of DWM buffers used, range is 3-7, default is 3. Only used when DWM queued mode is enabled.
    • Added automatic audio delay compensation for DWM buffering delay when MP Audio Renderer is used
    Release v667:
    • Fixed a bug with Unicode strings in logging
    • High-hysteresis frame drop/repeat logic enabled when MP Audio Renderer is in use.
    • Added new Registry setting - 'HKEY_CURRENT_USER\Software\Team MediaPortal\EVR Presenter\EnableDWMAudioDelayComp' - when '1' automatic audio delay compensation for DWM buffering delay is enabled (when MP Audio Renderer is used). Default is '0' (not enabled)
    • Internal sample queue length increased to 5
    • 'NumDWMBuffers' registry setting range is now 3-8
    • Sample dropping in ScheduleSample() disabled until pre-buffering is complete.
    Release v669:
    • Added new Registry setting - 'HKEY_CURRENT_USER\Software\Team MediaPortal\EVR Presenter\SampleQueueSize' - sets the input video sample queue length - range is 3 to 9, default is '5'
    • Added new Registry settings to control the (MMCSS) thread priorities: "TimerThreadMmcssPriority", "WorkerThreadMmcssPriority", "SchedulerThreadMmcssPriority"

      Possible values are 0 to 3:

      3 = AVRT_PRIORITY_CRITICAL
      2 = AVRT_PRIORITY_HIGH (default for Scheduler thread)
      1 = AVRT_PRIORITY_NORMAL (default for Worker thread)
      0 = AVRT_PRIORITY_LOW (default for Timer thread)
    • Default for 'EnableDWMQueuedMode' is now '0' (disabled) so that it behaves like the standard dshowhelper when first installed.
    Release v671:
    • Changes to fix hangs/crashes with AMD GPU (probably caused by calling DwmFlush() when shutdown)
    Release v672:
    • DwmInit() and DwmReset() delays now use Sleep()
    Release v675:
    • More changes to internal thread locking to fix hangs/crashes (small update from v674). Delays removed from DwmInit() and DwmReset() methods (experimental).
    Release v676:
    • Timer thread reworked to use WaitableTimers (might lower CPU usage a little)
    • 'LowResVSyncCorrectionTiming' registry option added (might lower CPU usage a little, but creates bumpy graph lines)
    • Some deadlock hazards worked around
    • Minor logging bug in DWM (Aero) detection code fixed.
    Release v677:

    Controllable FPS rate limiter added - can be used for low-performance systems to reduce rendering load, by discarding 50% of frames when video FPS and frame size exceeds thresholds. Controlled by registry values:

    FPSLimitFrameRate (FPS limit, default = 0, FPS limiter disabled)
    FPSLimitHeightThresh (default = 700)
    FPSLimitWidthThresh (default = 1200)

    e.g. if FPSLimitFrameRate = 40 AND FPSLimitHeightThresh = 700 AND FPSLimitWidthThresh = 1200 then all video with FPS higher than 40 and frame size greater than 1200 x 700 will have 50% of the frames dropped to reduce the GPU rendering load.

    Release v678:

    Identical to v677, except that the Scheduler thread locking is now 'soft' instead of 'hard' - this makes it behave like the thread locking inside the standard MP 1.2.3/1.3.0 dshowhelper. I'm not sure if the v677 or v678 approach is better, so I'm interested in feedback before deciding which way to go for the future. Hopefully you won't notice any difference in performance or stability :) (I can't, but then I can't reproduce some of the lockup/hang problems other people have reported in the past either).

    Release v679:
    • Version info added to dll (so it shows up in Windows file 'Properties' dialog).
    • DWM queued mode initialisation moved later in the start-of-play sequence, to minimise the temporary black screen effect.
    Release v684:
    • Reverted Scheduler thread locking back to 'hard'.
    • 'EnableLateDWMInit' registry option added - default is '0' (early initialisation, like v677 and earlier). DWM queued mode initialisation is done as late as possible in the start-of-play sequence when '1'
    • 'Enable24HzDWM' registry option added - default is '1' (enabled), uses normal DWM queued mode operation in 24 Hz display refresh situation. This is an experiment - feedback welcome, since this has caused problems in the past, but seems to help on my system now.
    • 'EnableDWMInitSleep' registry option added - default is '1' (enabled), adds small delay after DWM queued mode initialisation to help with 24 Hz display refresh situation (mostly). Another experiment...
     
    Last edited:

    legnod

    MP Donator
  • Premium Supporter
  • September 24, 2011
    1,115
    323
    Stuttgart
    Home Country
    Germany Germany
    Great work Owlsroost,
    working fine so far! Only 1 of 200k frames has been dropped while watching Live-TV!
     

    powermarcel10

    Retired Team Member
  • Premium Supporter
  • November 30, 2010
    2,839
    898
    35
    Groningen
    Home Country
    Netherlands Netherlands
    Hello guys, I'm affraid I have a stupid question, but can't get the answer anywhere..

    What does dshowhelper exactly?

    Best regards!
     

    Pat Clark

    Portal Pro
    April 25, 2012
    264
    34
    Wisconsin
    Home Country
    United States of America United States of America
    Works as well as the former version, unless "repeats" are something new. The sum of drops and repeats in the new version exceeds drops in former version when drops are happening.

    As you may recall, my system is right on the edge when viewing 720p/60 signal. If I run task manager, there is a regular spacing of drops/repeats, presumably as task manager refreshes. When not running task manager, both versions report no drops or repeats.

    Viewing 1080i/60 with no deinterlacing, both versions are perfect, with or without task manager.

    Question: is there buffering after rendering? It seems that there is enough time overall to render perfectly, except for the occasional long render. A small buffer (.5 second?) might smooth it out entirely.
     

    red5goahead

    MP Donator
  • Premium Supporter
  • November 24, 2007
    695
    144
    Italy, North West
    Home Country
    Italy Italy
    Just yesterday I've uninstall the 1.2.2 and installed the 1.3.0 alpha. Actually It work very well that renderer with reclock (with timestretching active because I tried a cinema fps tv series episode as usual on my tv with refresh of 50 Hz )
    With mp audio renderer there are some problem with Xonar and exclusive mode (not even driven mode).
     

    Owlsroost

    Retired Team Member
  • Premium Supporter
  • October 28, 2008
    5,540
    5,038
    Cambridge
    Home Country
    United Kingdom United Kingdom
    Hello guys, I'm affraid I have a stupid question, but can't get the answer anywhere..

    What does dshowhelper exactly?

    Best regards!

    It's basically the interface between the EVR (Vista/Win7/Win8) 'renderer' in the DirectShow filtergraph and MP's render engine. It's only used when playing video, and it decides when each video frame is displayed - it compares the timestamp on each frame with the filtergraph 'clock' and drops frames which are late or holds/delays frames which are too early (this is when the 'repeat' frame count is incremented).

    (It is also used for VMR9 but that part of it hasn't changed for a long time - all of the recent updates are for the EVR side only)

    Tony
     

    cruse

    MP Donator
  • Premium Supporter
  • November 7, 2007
    166
    41
    Home Country
    Germany Germany
    Just wanted to let you know this dshowhelper is the bee's knees, pushing my borderline hardware (9400 GT) over the performance edge it desperately needs. Watching 1080i since half an hour with DWM 1 without one dropped frame, was a matter of seconds before with the default dshowhelper.

    I strongly suggest this makes its way into the next MP1.3 beta.

    Thanks Tony
     

    doveman

    Portal Pro
    February 12, 2008
    2,326
    178
    Home Country
    United Kingdom United Kingdom
    Release v663b:
    • Registry key added - 'HKEY_CURRENT_USER\Software\Team MediaPortal\EVR Presenter\EnableDWMQueuedMode - if this is '1' DWM queued mode is enabled, if '0' it is disabled (it is disabled in the standard dshowhelper).

    Thanks for this Owlsroost. Do we need to create/set the registry key manually to enable 'queued' mode or is this auto-set/default?
     

    cruse

    MP Donator
  • Premium Supporter
  • November 7, 2007
    166
    41
    Home Country
    Germany Germany
    In my case the reg key was there (may have already been there) and set to 1, once I put the dll in MP folder and started MP.
     

    Users who are viewing this thread

    Top Bottom