Normal
I thought I'd get back to the thread with the patches I've made locally. I think I've got it nailed now, I had to make 3 changes to the source code:1. DirectShow occasionally got the wrong frametime. Fix:Add a delay of 2 seconds, once the graph is found. This seems to be enough time for videoHeader2.AvgTimePerFrame to start reporting the correct fps.Edit lines in RefreshRateControl.DirectShow.cs: if (graphBuilder != null) { WriteToLog("Got valid graph!"); //PATCH Thread.Sleep(2000); WriteToLog("Delayed 2 seconds"); //PATCH break; } else { WriteToLog("Couldn't cast it as IGraphBuilder"); }2. Some videos don't work, namely MKV. They find a graph but 0 fps. Fix:Set option in configuration to perform VMR9 check. Change main code to continue picking a method if DirectShow returns 0 fps. Edit code in RefreshRateControl.cs (SetRefreshRate): if (settings.DirectShowSupport && DirectShowGetFrameRate(fileName, out frameRate, settings.DirectShowBuilding)) { //PATCH if (frameRate != 0) { //PATCH SetRefreshRate(GetBestRefreshRate(frameRate)); return; //PATCH } //PATCH } //none found last chance if (settings.Vmr9Guessing) { //PATCH lastFPS = 0; //PATCH ProcessFrameRate(); }3. VMR9 detection isn't a great FPS identifier. Fix:While testing using the ! key, I noticed a better indicater. Use MediaPortal.GUI.Library.VideoRendererStatistics.AverageFrameRate for a more accurate reporting of the source file FPS. Edit in RefreshRateControl.cs (ProcessFrameRate): float rate = MediaPortal.GUI.Library.VideoRendererStatistics.AverageFrameRate;//MediaPortal.GUI.Library.GUIGraphicsContext.DesiredFrameTime;With these edits, I am hitting 100% accuracy, albeit with a little stutter on startup. Hope they're useful to someone. I will probably clean things up a bit better. I am tempted to make a version that just uses the new AverageFrameRate I found, it usually gets the correct rate within two seconds, any other changes the RefreshRateControl makes later are mistakes based on the fact that I've skipped inside the video file.EDIT: secco do you have Haali Media Splitter installed?
I thought I'd get back to the thread with the patches I've made locally. I think I've got it nailed now, I had to make 3 changes to the source code:
1. DirectShow occasionally got the wrong frametime. Fix:
Add a delay of 2 seconds, once the graph is found. This seems to be enough time for videoHeader2.AvgTimePerFrame to start reporting the correct fps.
Edit lines in RefreshRateControl.DirectShow.cs:
if (graphBuilder != null)
{
WriteToLog("Got valid graph!");
//PATCH
Thread.Sleep(2000);
WriteToLog("Delayed 2 seconds");
break;
}
else
WriteToLog("Couldn't cast it as IGraphBuilder");
2. Some videos don't work, namely MKV. They find a graph but 0 fps. Fix:
Set option in configuration to perform VMR9 check. Change main code to continue picking a method if DirectShow returns 0 fps. Edit code in RefreshRateControl.cs (SetRefreshRate):
if (settings.DirectShowSupport &&
DirectShowGetFrameRate(fileName, out frameRate, settings.DirectShowBuilding))
if (frameRate != 0)
SetRefreshRate(GetBestRefreshRate(frameRate));
return;
//none found last chance
if (settings.Vmr9Guessing)
lastFPS = 0;
ProcessFrameRate();
3. VMR9 detection isn't a great FPS identifier. Fix:
While testing using the ! key, I noticed a better indicater. Use MediaPortal.GUI.Library.VideoRendererStatistics.AverageFrameRate for a more accurate reporting of the source file FPS. Edit in RefreshRateControl.cs (ProcessFrameRate):
float rate = MediaPortal.GUI.Library.VideoRendererStatistics.AverageFrameRate;//MediaPortal.GUI.Library.GUIGraphicsContext.DesiredFrameTime;
With these edits, I am hitting 100% accuracy, albeit with a little stutter on startup. Hope they're useful to someone. I will probably clean things up a bit better. I am tempted to make a version that just uses the new AverageFrameRate I found, it usually gets the correct rate within two seconds, any other changes the RefreshRateControl makes later are mistakes based on the fact that I've skipped inside the video file.
EDIT: secco do you have Haali Media Splitter installed?