Stutter after refresh rate change (5 Viewers)

tourettes

Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    framePerSecond = (float)frames / (time - lastTime);
    GUIGraphicsContext.CurrentFPS = framePerSecond;

    it might happen that the stats are just wrong. Could you add debug logging on every rendered frame, that will log the current fps?
     

    nyt

    Retired Team Member
  • Premium Supporter
  • October 15, 2009
    199
    48
    Home Country
    United States of America United States of America
    I added a case for 23970 and it sets the display properly, but no change with stutter issues.

    Sounds like adriver bug if such is required.

    Either way, the refresh rate was still being set properly. I just thought this was interesting behavior so I took a stab at it.


    framePerSecond = (float)frames / (time - lastTime);
    GUIGraphicsContext.CurrentFPS = framePerSecond;

    it might happen that the stats are just wrong. Could you add debug logging on every rendered frame, that will log the current fps?


    I don't know how to do this, however, I do not believe it to be a bug, but either way, it is indicative that it is trying to sync to the wrong rate. When the stutter is not there, it is always at 24fps, however, when the stutter is there, depending on system load, it will generally be ~60, sometimes lower, but always above 24, and never above 60.

    I'm a programmer by trade, but I've never done D3D programming, so this is taking me a lot longer than someone else who is familiar with all this code.


    It's not a problem exactly with the refresh rate changer, it's doing what its supposed to. The whole directshow/renderer part of the code just doesn't know the refresh rate has changed. It will take me quite a bit of time digging for where this all is since this is all new to me.

    It seems to be when the directx stuff is setup, that's the refresh rate that it uses unless it's updated. Simply changing the refresh rate does not help. DX needs to know the refresh rate as well. Still working on this. Hopefully I can get this resolved soon =]
     

    gibman

    Retired Team Member
  • Premium Supporter
  • October 4, 2006
    2,998
    1,372
    Aarhus
    Home Country
    Denmark Denmark
    I find it almost impossible to use the alt-tab notepad.exe workaround for fixing the stuttering when I use MP in always-on-top mode.

    If I disable this mode, it's quite easy to do the workaround.

    I guess we need some app. to throw focus at too ?
    Or is windows desktop enough ?

    If always-on-top is DISABLED, then I guess the user would see some window flashing ?

    I guess one could use autoit3 to do some scripting for starters.
    AutoIt v3 - Automate and Script Windows Tasks - For Free!

    WinActivate -->
    http://www.autoitscript.com/autoit3/docs/functions/WinActivate.htm

    all functions :
    http://www.autoitscript.com/autoit3/docs/functions.htm

    and then place the script in the external bat file that does the dc.exe thing :)

    /gibman

    Out of desperation as I am not willing to give up yet:

    Let's see if sending a WM_PAINT message after the RR change to the handle of GetForegroundWindow() will do the same as Alt-Tab. Or better an InvalidateRect() followed by an UpdateWindow() as WM_PAINT shouldn't be sent by an application (I don't care if it works...).

    Maybe this does the trick, but I doubt it. Any other suggestions how to simulate what Alt-Tab does?
     

    nyt

    Retired Team Member
  • Premium Supporter
  • October 15, 2009
    199
    48
    Home Country
    United States of America United States of America
    I find it almost impossible to use the alt-tab notepad.exe workaround for fixing the stuttering when I use MP in always-on-top mode.

    If I disable this mode, it's quite easy to do the workaround.

    I guess we need some app. to throw focus at too ?
    Or is windows desktop enough ?

    If always-on-top is DISABLED, then I guess the user would see some window flashing ?

    I guess one could use autoit3 to do some scripting for starters.
    AutoIt v3 - Automate and Script Windows Tasks - For Free!

    WinActivate -->
    Function WinActivate

    all functions :
    Functions

    and then place the script in the external bat file that does the dc.exe thing :)

    /gibman

    Out of desperation as I am not willing to give up yet:

    Let's see if sending a WM_PAINT message after the RR change to the handle of GetForegroundWindow() will do the same as Alt-Tab. Or better an InvalidateRect() followed by an UpdateWindow() as WM_PAINT shouldn't be sent by an application (I don't care if it works...).

    Maybe this does the trick, but I doubt it. Any other suggestions how to simulate what Alt-Tab does?

    with always-on-top use win-tab

    edit: failed to fix stutter with window move
    So, I added code to move the window a few seconds after the video is playing, but it does not fix it. Apparently this is not the same as dragging the window.

    edit: more debugging
    Log.Debug("currentfps: {0}, desiredtime: {1}", GUIGraphicsContext.CurrentFPS, GUIGraphicsContext.DesiredFrameTime);
    STUTTER: currentfps: 60, desiredtime: 45573
    NO STUTTER: currentfps: 24, desiredtime: 45573

    so desiredframetime doesnt have a difference.

    edit: yet more debugging:

    Log.Debug("currentfps: {0}, {1}, {2}", GUIGraphicsContext.CurrentFPS, GUIGraphicsContext.Vmr9FPS, GUIGraphicsContext.DX9Device.DisplayMode.RefreshRate);

    60, 0, 60 when stutters, so directx device still thinks refresh rate is 60.
     

    tourettes

    Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    ...just over my dead body it will be possible to add some notepad.exe related hack to the SVN code base :D Even if there is no other way we wont include such in MP.
     

    tourettes

    Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    Log.Debug("currentfps: {0}, desiredtime: {1}", GUIGraphicsContext.CurrentFPS, GUIGraphicsContext.DesiredFrameTime);
    STUTTER: currentfps: 60, desiredtime: 45573
    NO STUTTER: currentfps: 24, desiredtime: 45573

    so desiredframetime doesnt have a difference.

    edit: yet more debugging:

    Log.Debug("currentfps: {0}, {1}, {2}", GUIGraphicsContext.CurrentFPS, GUIGraphicsContext.Vmr9FPS, GUIGraphicsContext.DX9Device.DisplayMode.RefreshRate);

    60, 0, 60 when stutters, so directx device still thinks refresh rate is 60.

    Does that "GUIGraphicsContext.DX9Device.DisplayMode.RefreshRate" change to correct refresh rate when you are changing MP's focus or miving the window? Unfortunately that is directly coming from DirectX itself, so if it doesn't see the correct refresh rate...
     

    nyt

    Retired Team Member
  • Premium Supporter
  • October 15, 2009
    199
    48
    Home Country
    United States of America United States of America
    Log.Debug("currentfps: {0}, desiredtime: {1}", GUIGraphicsContext.CurrentFPS, GUIGraphicsContext.DesiredFrameTime);
    STUTTER: currentfps: 60, desiredtime: 45573
    NO STUTTER: currentfps: 24, desiredtime: 45573

    so desiredframetime doesnt have a difference.

    edit: yet more debugging:

    Log.Debug("currentfps: {0}, {1}, {2}", GUIGraphicsContext.CurrentFPS, GUIGraphicsContext.Vmr9FPS, GUIGraphicsContext.DX9Device.DisplayMode.RefreshRate);

    60, 0, 60 when stutters, so directx device still thinks refresh rate is 60.

    Does that "GUIGraphicsContext.DX9Device.DisplayMode.RefreshRate" change to correct refresh rate when you are changing MP's focus or miving the window? Unfortunately that is directly coming from DirectX itself, so if it doesn't see the correct refresh rate...

    Hm, guess that's a dead end. Even with smooth playback @ 24hz, that still is set to 60.

    Ok, so I commented out the internals of D3DApp.OnMove, moved the window, and it still fixed the stutter when moving the window, so it doesn't seem to be something inside of MP that's performing wrong, we just need to give something a proper kick after changing the refresh rate.

    So, in windowed mode, if you minimize and restore in the refresh rate change code, the stutter disappears. This doesn't work for fullscreen though. I stayed up all night messing with this and need to sleep now. I'll try more stuff tomorrow. I'm not a d3d programmer, so someone more familiar with this might know a way to give MP the kick it needs after the refresh rate change without interrupting playback.

    Can someone try sending EC_DISPLAY_CHANGED to the EVR Presenter?
     

    rak

    Portal Pro
    March 5, 2008
    93
    1
    Home Country
    Czech Republic Czech Republic
    I just noticed, that after refresh rate change the GUI stutter too. After changing back from 24Hz movie to 50Hz I noticed stutter in the main manu transitions. I checked the max fps in settings window and it showed 39fps only. After ALT-TAB it showed 50fps and transitions were smooth again...

    Anyway I have stutter with or without refresh rate change. Mainly with 25p movies - I started new thread, but nowbody seems to have any answer...
     

    nyt

    Retired Team Member
  • Premium Supporter
  • October 15, 2009
    199
    48
    Home Country
    United States of America United States of America
    It looks like other people are having the same issues too.

    forum.sly soft.com/showthread.php?p=239976
    forum.sly soft.com/showthread.php?p=239372
    ... without the spaces, not sure why thats filtered...

    Apparently MPC-HC might have a fix for it in their code, but I haven't had time to check.
    https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/branches/gothsync
     

    nyt

    Retired Team Member
  • Premium Supporter
  • October 15, 2009
    199
    48
    Home Country
    United States of America United States of America
    something else I've just discovered, using displaychanger to set the refresh rate while video is running results in a stutter. Using nvidia control panel to change the refresh rate results in smooth playback. HMM..

    Also, if I use dc and change resolution, and refresh rate, playback is smooth. onto something again! (update: ugh, only with windowed mode)

    update again, http://www.news2news.com/vfp/?example=374&ver=vcs seems to change refresh without introducing stutter, but only in windowed mode.

    sending WM_PAINT and invalidating, also do not work.
     

    Users who are viewing this thread

    Top Bottom