[other] Problems with dropping frames with EVR (4 Viewers)

Scythe42

Retired Team Member
  • Premium Supporter
  • June 20, 2009
    2,065
    2,703
    51
    Berlin
    Home Country
    Germany Germany
    Can you guys try with this:

    Code:
    Index: source/EVRCustomPresenter.cpp
    ===================================================================
    --- source/EVRCustomPresenter.cpp	(revision 24764)
    +++ source/EVRCustomPresenter.cpp	(working copy)
    @@ -1078,8 +1078,8 @@
         }
         LOG_TRACE("Time to schedule: %I64d", *pNextSampleTime);
     
    -    // If we are ahead up to one quarter of a frame present sample as the vsync will be waited for anyway
    -    if (*pNextSampleTime > m_rtTimePerFrame/4)
    +    // If we are ahead up to 1/3 + 1ms of a frame present sample as the vsync will be waited for anyway
    +    if (*pNextSampleTime > (m_rtTimePerFrame/3)+10000)
         {
           break;
         }
    @@ -1101,8 +1101,6 @@
         else 
         {
           CHECK_HR(PresentSample(pSample), "PresentSample failed");
    -      // EXPERIMENTAL: give other threads some time to breath
    -      Sleep(3);
         }
         *pNextSampleTime = 0;
         ReturnSample(pSample, TRUE);
    @@ -1119,7 +1117,7 @@
         return;
       }
       StartThread(&m_hScheduler, &m_schedulerParams, SchedulerThread, &m_uSchedulerThreadId, THREAD_PRIORITY_TIME_CRITICAL);
    -  StartThread(&m_hWorker, &m_workerParams, WorkerThread, &m_uWorkerThreadId, THREAD_PRIORITY_BELOW_NORMAL);
    +  StartThread(&m_hWorker, &m_workerParams, WorkerThread, &m_uWorkerThreadId, THREAD_PRIORITY_ABOVE_NORMAL);
       m_bSchedulerRunning = TRUE;
     }
     
    Index: source/Scheduler.cpp
    ===================================================================
    --- source/Scheduler.cpp	(revision 24764)
    +++ source/Scheduler.cpp	(working copy)
    @@ -110,13 +110,13 @@
         timePerFrame = p->pPresenter->GetFrameDuration();
         if (hnsSampleTime > 0)
         {
    -      // wait for 3/4 sample time or 3/4 of frame duration depending on what is smaller
    -      delay = min((hnsSampleTime/100*75), (timePerFrame/100*75));
    +      // wait for 1/3 sample time or 1/3 of frame duration depending on what is smaller
    +      delay = min((hnsSampleTime/3), (timePerFrame/3));
         }
         else 
         {
    -      // workaround for unknown bugs
    -      delay = timePerFrame/100*25;
    +      // do not schedule late frames
    +      delay = 0;
         }
         if (delay >= 10000)
         {
    @@ -129,7 +129,8 @@
         }
         else 
         {
    -      p->eHasWork.Set();
    +      //p->eHasWork.Set();
    +      p->pPresenter->CheckForScheduledSample(&hnsSampleTime, delay);
         }
         p->csLock.Unlock();
         while (!p->eHasWork.Wait());

    Basically using 1/3 in advance now, removed the sleep, bumped the worker thread priority and instead of p->eHasWork.Set() on delay = 0 CheckForScheduledSample() is called.

    I tried with a couple of transmuxed BRs and playback starts and the number of dropped frames is still as low as before on my system. Please check with movies on your HD and not only TS files or life TV. I just want to rule tsreader out for the moment. If only live TV shows massive problems we can limit the problem further down.

    Here's a typical log from my system with one dropped frame on playback start on a 1080p file (transmuxed BR):
    Code:
    17-01-2010 16:01:49.039 [114c]Loading EVR libraries
    17-01-2010 16:01:49.043 [114c]Found dxva2.dll
    17-01-2010 16:01:49.043 [114c]Found method DXVA2CreateDirect3DDeviceManager9
    17-01-2010 16:01:49.068 [114c]Found method MFCreateVideoSampleFromSurface
    17-01-2010 16:01:49.068 [114c]Found method MFCreateVideoMediaType
    17-01-2010 16:01:49.069 [114c]Found method MFCreateMediaType
    17-01-2010 16:01:49.069 [114c]Successfully loaded EVR dlls
    17-01-2010 16:01:49.070 [114c]----------v0.5---------------------------
    17-01-2010 16:01:49.070 [114c]GetDeviceID
    17-01-2010 16:01:49.070 [114c]GetService
    17-01-2010 16:01:49.070 [114c]guid: {1092A86C-AB1A-459A-A336-831FBC4D11FF}
    17-01-2010 16:01:49.070 [114c]riid: {A0CADE0F-06D5-4CF4-A1C7-F3CDD725AA75}
    17-01-2010 16:02:17.986 [114c]InitServicePointers
    17-01-2010 16:02:17.986 [114c]ReleaseServicePointers
    17-01-2010 16:02:17.986 [114c]Found mixers: 1
    17-01-2010 16:02:17.986 [114c]ERR: Could not get IMFClock interface
    17-01-2010 16:02:17.986 [114c]Found event sink: 1
    17-01-2010 16:02:17.986 [114c]ReleaseServicePointers
    17-01-2010 16:02:17.986 [114c]InitServicePointers
    17-01-2010 16:02:17.986 [114c]ReleaseServicePointers
    17-01-2010 16:02:17.986 [114c]Found mixers: 1
    17-01-2010 16:02:17.986 [114c]ERR: Could not get IMFClock interface
    17-01-2010 16:02:17.986 [114c]Found event sink: 1
    17-01-2010 16:02:17.986 [114c]ReleaseServicePointers
    17-01-2010 16:02:17.986 [114c]InitServicePointers
    17-01-2010 16:02:17.986 [114c]ReleaseServicePointers
    17-01-2010 16:02:17.986 [114c]Found mixers: 1
    17-01-2010 16:02:17.986 [114c]ERR: Could not get IMFClock interface
    17-01-2010 16:02:17.986 [114c]Found event sink: 1
    17-01-2010 16:02:17.986 [114c]ReleaseServicePointers
    17-01-2010 16:02:17.986 [114c]InitServicePointers
    17-01-2010 16:02:17.986 [114c]ReleaseServicePointers
    17-01-2010 16:02:17.986 [114c]Found mixers: 1
    17-01-2010 16:02:17.986 [114c]ERR: Could not get IMFClock interface
    17-01-2010 16:02:17.986 [114c]Found event sink: 1
    17-01-2010 16:02:17.986 [114c]ReleaseServicePointers
    17-01-2010 16:02:17.986 [114c]InitServicePointers
    17-01-2010 16:02:17.986 [114c]ReleaseServicePointers
    17-01-2010 16:02:17.986 [114c]Found mixers: 1
    17-01-2010 16:02:17.986 [114c]ERR: Could not get IMFClock interface
    17-01-2010 16:02:17.986 [114c]Found event sink: 1
    17-01-2010 16:02:17.986 [114c]ReleaseServicePointers
    17-01-2010 16:02:17.986 [114c]InitServicePointers
    17-01-2010 16:02:17.986 [114c]ReleaseServicePointers
    17-01-2010 16:02:17.986 [114c]Found mixers: 1
    17-01-2010 16:02:17.986 [114c]ERR: Could not get IMFClock interface
    17-01-2010 16:02:17.986 [114c]Found event sink: 1
    17-01-2010 16:02:17.986 [114c]ReleaseServicePointers
    17-01-2010 16:02:17.986 [114c]InitServicePointers
    17-01-2010 16:02:17.986 [114c]ReleaseServicePointers
    17-01-2010 16:02:17.986 [114c]Found mixers: 1
    17-01-2010 16:02:17.986 [114c]ERR: Could not get IMFClock interface
    17-01-2010 16:02:17.986 [114c]Found event sink: 1
    17-01-2010 16:02:17.987 [114c]ProcessMessage MFVP_MESSAGE_INVALIDATEMEDIATYPE
    17-01-2010 16:02:17.987 [114c]RenegotiateMediaOutputType
    17-01-2010 16:02:17.987 [114c]Testing media type...
    17-01-2010 16:02:17.987 [114c]Successfully cloned media type
    17-01-2010 16:02:17.987 [114c]Time Per Frame: 417083
    17-01-2010 16:02:17.987 [114c]Setting MFVideoTransferMatrix_BT709
    17-01-2010 16:02:17.987 [114c]Frame size: 1920x800
    17-01-2010 16:02:17.987 [114c]Aperture size: 0:0, 1920x800
    17-01-2010 16:02:17.987 [114c]New media type successfully negotiated!
    17-01-2010 16:02:17.987 [114c]Getting aspect ratio 'DirectShow style'
    17-01-2010 16:02:17.987 [114c]New format: 1920x800, Ratio: 12:5
    17-01-2010 16:02:17.987 [114c]guid: {00000016-0000-0010-8000-00AA00389B71}
    17-01-2010 16:02:17.987 [114c]ReallocSurfaces
    17-01-2010 16:02:17.987 [114c]ReleaseSurfaces()
    17-01-2010 16:02:17.988 [114c]Releasing device
    17-01-2010 16:02:17.988 [114c]ReleaseSurfaces() done
    17-01-2010 16:02:17.988 [114c]Textures will be 1920x800
    17-01-2010 16:02:17.988 [114c]Adding sample: 0xd8ba9f0
    17-01-2010 16:02:17.988 [114c]Adding sample: 0xd8ba8a0
    17-01-2010 16:02:17.988 [114c]Adding sample: 0xd8ba948
    17-01-2010 16:02:17.988 [114c]Adding sample: 0xd8ba6a8
    17-01-2010 16:02:17.988 [114c]Adding sample: 0xd8ba750
    17-01-2010 16:02:17.988 [114c]Releasing device: 366
    17-01-2010 16:02:17.989 [114c]ReallocSurfaces done
    17-01-2010 16:02:17.989 [114c]Setting media type on mixer
    17-01-2010 16:02:17.989 [114c]GetService
    17-01-2010 16:02:17.989 [114c]guid: {EFEF5175-5C7D-4CE2-BBBD-34FF8BCA6554}
    17-01-2010 16:02:17.989 [114c]riid: {A0CADE0F-06D5-4CF4-A1C7-F3CDD725AA75}
    17-01-2010 16:02:17.989 [114c]GetService
    17-01-2010 16:02:17.989 [114c]guid: {1092A86C-AB1A-459A-A336-831FBC4D11FF}
    17-01-2010 16:02:17.989 [114c]riid: {A490B1E4-AB84-4D31-A1B2-181E03B1077A}
    17-01-2010 16:02:17.989 [114c]IMFVideoDisplayControl.GetVideoWindow()
    17-01-2010 16:02:19.341 [114c]ReleaseServicePointers
    17-01-2010 16:02:19.341 [114c]InitServicePointers
    17-01-2010 16:02:19.341 [114c]ReleaseServicePointers
    17-01-2010 16:02:19.341 [114c]Found mixers: 1
    17-01-2010 16:02:19.341 [114c]Found clock: 1
    17-01-2010 16:02:19.341 [114c]Found event sink: 1
    17-01-2010 16:02:19.356 [114c]ProcessMessage MFVP_MESSAGE_BEGINSTREAMING
    17-01-2010 16:02:19.356 [114c]Starting thread!
    17-01-2010 16:02:19.356 [114c]Started thread. id: 0x1134 (4404), handle: 0xcec
    17-01-2010 16:02:19.356 [114c]Starting thread!
    17-01-2010 16:02:19.357 [114c]Started thread. id: 0x594 (1428), handle: 0xcdc
    17-01-2010 16:02:21.571 [11d4]Should not be processing data in pause mode
    17-01-2010 16:02:21.572 [594]Should not be processing data in pause mode
    17-01-2010 16:02:21.595 [8d8]OnClockStart
    17-01-2010 16:02:22.232 [1134]Dropping frame, behind 1.11 ms, last sleep time 5.27 ms.
    17-01-2010 16:04:49.721 [114c]OnClockPause
    17-01-2010 16:04:49.742 [114c]OnClockStop
    17-01-2010 16:04:49.742 [594]Should not be processing data in pause mode
    17-01-2010 16:04:49.742 [114c]Flushing: size=4
    17-01-2010 16:04:49.743 [114c]ProcessMessage MFVP_MESSAGE_ENDSTREAMING
    17-01-2010 16:04:49.776 [114c]EVRDeinit:m_evrPresenter release:2
    17-01-2010 16:04:49.776 [114c]Unloading EVR libraries
    17-01-2010 16:04:49.776 [114c]Freeing library DXVA2.dll
    17-01-2010 16:04:49.776 [114c]Freeing lib: EVR.dll
    17-01-2010 16:04:49.776 [114c]Freeing lib: MFPLAT.dll
    17-01-2010 16:04:49.777 [114c]ReleaseServicePointers
    17-01-2010 16:04:49.777 [114c]InitServicePointers
    17-01-2010 16:04:49.777 [114c]ReleaseServicePointers
    17-01-2010 16:04:49.777 [114c]Found mixers: 1
    17-01-2010 16:04:49.777 [114c]ERR: Could not get IMFClock interface
    17-01-2010 16:04:49.777 [114c]Found event sink: 1
    17-01-2010 16:04:49.777 [114c]ReleaseServicePointers
    The multiple "ERR: Could not get IMFClock interface" is a different problem that needs investigation (no Mantis entry yet). Also building the DirectShow graph takes a long time, probably because various filters are loaded and discarded (at least from what I see in the system tray)
     

    disaster123

    MP Donator
  • Premium Supporter
  • May 14, 2008
    3,558
    434
    Home Country
    Germany Germany
    AW: Problems with dropping frames with EVR

    Looked very good on my system for now (only tested 10 minutes but normally i had a lot of dropped frames in this time.) I've the IMFClock Interface Problem too.

    What about looking at the EVRAllocatorPresenter.cpp of mplayer, xmbc and so on? could this help?

    I've still every 2 or 5 minutes dropped frames (doing nothing else on this PC) - but that's better than every 5 or 10 seconds.

    The interesting part seems to be here:
    /svplayer/src/apps/mplayerc/EVRAllocatorPresenter.cpp ? SVPlayer
    Part: void CEVRAllocatorPresenter::RenderThread()
     

    gemx

    Retired Team Member
  • Premium Supporter
  • October 31, 2006
    1,972
    539
    Home Country
    Germany Germany
    That is really an improvement. I only get 1 dropped frame every 10 minutes or so which is normal i think.

    This should be commited asap if it also works for the others

    BTW: I don't get these IMFClock errors
     

    cfforce

    MP Donator
  • Premium Supporter
  • March 4, 2008
    241
    21
    Home Country
    Netherlands Netherlands
    I find it very strange on one of my systems; last friday i was playing around with codecs, reinstalled MP etc etc.; don't know what i did exactly :p.
    But i had on this system the same problems; but after figgeling around; the problems where suddenly gone :( I tried to reproduce the "same" actions on my other systems; but it doesn't work what i did on my 1st system.
     

    tourettes

    Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    One source for dropped frames with H.264 content has been identified to be in TsReader.ax. So, if you are having dropped frames with TS files, please test renaming such file as .mkv and let haali splitter to do the splitting. This is just for testing and pin pointing the bad component. TsReader.ax will be fixed soon.
     

    tourettes

    Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800

    disaster123

    MP Donator
  • Premium Supporter
  • May 14, 2008
    3,558
    434
    Home Country
    Germany Germany
    AW: Re: Problems with dropping frames with EVR

    deleted other problem not related to this thread - sorry
     

    romuz

    Retired Team Member
  • Premium Supporter
  • July 26, 2008
    1,045
    250
    Moskau
    Home Country
    Russian Federation Russian Federation
    Can you guys try with this:


    The multiple "ERR: Could not get IMFClock interface" is a different problem that needs investigation (no Mantis entry yet). Also building the DirectShow graph takes a long time, probably because various filters are loaded and discarded (at least from what I see in the system tray)

    Thank you, working great. just 1 droped frame in 5 mins.
    ERR: Could not get IMFClock interface ocured once in my log and not repeated like in your logs.
     

    disaster123

    MP Donator
  • Premium Supporter
  • May 14, 2008
    3,558
    434
    Home Country
    Germany Germany
    AW: Problems with dropping frames with EVR

    Sorry my problem is that MP freezes when i've selected prefer AC3 and i select a channel where AC3 stream is available. There seems to be another bug in tsreader or mp.
     

    romuz

    Retired Team Member
  • Premium Supporter
  • July 26, 2008
    1,045
    250
    Moskau
    Home Country
    Russian Federation Russian Federation
    Re: AW: Re: Problems with dropping frames with EVR

    One source for dropped frames with H.264 content has been identified to be in TsReader.ax. So, if you are having dropped frames with TS files, please test renaming such file as .mkv and let haali splitter to do the splitting. This is just for testing and pin pointing the bad component. TsReader.ax will be fixed soon.

    0002645: High CPU usage causes frame dropping - MediaPortal Bugtracker

    With your patch my tsreader hangs really often.


    sorry ignore my post i don't know why it is not working. It is working on one of my clients fine and on the other one it is not working at all - but also with old tsreader and "new" dshowhelper.

    for me new ts reader running without hangs so far (with prefer AC3 and AC3 audio tracks too)

    Add:
    Hi, when i viewing BD there are a few dropped frames with old and new dshowhelper. 1 for that test
    but looking on screen stats (shift 1) i see sync glitches are growing 400 for 10 min with new one an just 3 with old
    so i think it needs some tuning for bd.
    Or that sync glitches not so important?
    But by the way live tv now works very good.
     

    Users who are viewing this thread

    Top Bottom