I know it's a difficult things but maybe not impossible, I made some others important step forward, now there it's not blink or stutter in playback or on the gui, before this fix everythings was like a stroboscopic flash
so the two render are synchronized
but when Kodi show it's gui there is a loop in video playback with the last second
this it's a video
https://www.youtube.com/watch?v=kfCKeSKD...e=youtu.be
i wanna explain how everythings work so that maybe if a team kodi developer or madshi read this post can submit a possible solution
normally in application.render() there is a framewait
m_bPresentFrame = g_renderManager.FrameWait(100);
i suppose that it's for wait an available frame from XBMC EVR
so in RenderManager when the present it's ready
m_presentstep = PRESENT_READY
application.render() begin to render the final frame to submit
before render everything he clear the device with
application.RenderNoPresent()
...
g_renderManager.Render(true, 0, 255);
this because when we move the mouse if the frame before it's not cleared we would see the trail of the movement of the mouse printed on video
so many many mouse stamped on the screen
now how work madVR with kodi
at begin when the render it's created we let him utilize the device created by Kodi with this interface
suited by madshi especially for xbmc develompent
IMadVRDirect3D9Manager
STDMETHOD(UseTheseDevices)(LPDIRECT3DDEVICE9 scanlineReading, LPDIRECT3DDEVICE9 rendering, LPDIRECT3DDEVICE9 presentation) = 0;
so in madvrallocator there is
m_pD3DDevice = g_Windowing.Get3DDevice();
hr = pMadVrD3d->UseTheseDevices(m_pD3DDevice, m_pD3DDevice, m_pD3DDevice);
that before take the kodi device and then tell to madvr to utilize it
then there is an interface that callback when madvr has finish to render the frame
STDMETHODIMP RenderOsd (LPCSTR name, REFERENCE_TIME frameStart, RECT *fullOutputRect, RECT *activeVideoRect)
to synchronize Kodi device with madVR device i've put a call
g_renderManager.NewFrame();
that contain m_presentstep = PRESENT_FLIP
to interrupt the g_renderManager.FrameWait() in application.render() and render everythings, but before do that i've removed the clear when using madvr
g_renderManager.Render(true, 0, 255);
because this also clears the renders of madVR and we would have a black frame, we not need to clear the previous frame because madvr each time that renders a new frame clears the entire picture
but this means that without a working playback that come from madVR we would have a trail of mouse printed on video if the gui it's active
so this it's the conclusion... why there it's a loop when Kodi shows the gui?
madvr work with separate thread and continue to play the video and send frame because otherwise the previous frames would not be cleared and we would see a trail of mouse printed on the gui
another proof is that this loop process don't pause the video... the playback continue normally in background and when the gui it's closed the video resumes as nothing happened
so i think that the problem come from the render process of kodi vs madvr but I could not find the problem
anyway i made a new branch with madvr
https://github.com/aracnoz/xbmc/tree/Hel...ayer_madvr
if someone wants to help in the development