SuRGeoNix / Flyleaf

Media Player .NET Library for WinUI 3/ WPF/WinForms (based on FFmpeg/DirectX)
GNU Lesser General Public License v3.0
712 stars 100 forks source link

Open/OpenAsync with ClearScreenOnOpen still shows black frame #442

Closed jeroenm2 closed 5 months ago

jeroenm2 commented 6 months ago

Hi, as others have tried, I am trying to play video's and images without a black frame between them. I am using FlyleafLib.Controls.WPF 1.3.7. I did set the property ClearScreenOnOpen to true (a little confusing).

I do the following:

The same counts for images, especially if the images are white, the black flashes are very clear.

It does seem like ClearScreenOnOpen is not functioning properly, if not, can you provide me instructions on how to achieve this? Very happy with your library BTW

SuRGeoNix commented 6 months ago

@jeroenm2 You are right, that was there from old days probably not working at all now. I will try to fix that, the issue is that when you stop/close the input it will destroy the swap chain and all the frames (including the last visible frame) to ensure complete clean of RAM/VRAM. I could leave the frame visible though and not clear it but if you try to resize the window it will not resize properly the frame. The other solution would be to copy the frame from the old device/swap chain to the new one. I will review this and include it in the next update. Feel free to share your ideas / requirements.

From a quick look I think I will just let the cached frame in the swap chain without clearing the GPU buffer (resize will not work properly) and in v4 I will prevent destroying the device/swap chain everytime.

SuRGeoNix commented 6 months ago

Re-check from master if you can and let me know what you think

jeroenm2 commented 6 months ago

Thanks for your fast reply! Seems logical you want to cleanup the resources. For me both scenarios will work, I do not need the resize on that point. But I understand you want to copy it in the future release, for best best practices.

I just checked master and it looks good, really smooth!