Can you guys try with this:
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):
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)
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