Skip to content

Commit

Permalink
Renderer: Fixes a memory leak with D3D11VP during PresentOffline (eg.…
Browse files Browse the repository at this point in the history
… called by TakeSnapshot) [Fixes #318]
  • Loading branch information
SuRGeoNix committed May 25, 2024
1 parent 653dde9 commit 678b76f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions FlyleafLib/MediaFramework/MediaDecoder/VideoDecoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,8 @@ bool oldKeyFrameRequiredPacket

private void RunInternalReverse()
{
// Bug with B-frames, we should not remove the ref packets (we miss frames each time we restart decoding the gop)

int ret = 0;
int allowedErrors = Config.Decoder.MaxErrors;
AVPacket *packet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ unsafe internal void PresentOffline(VideoFrame frame, ID3D11RenderTargetView rtv
{
if (videoProcessor == VideoProcessors.D3D11)
{
vd1.CreateVideoProcessorOutputView(rtv.Resource, vpe, vpovd, out var vpov);
var tmpResource = rtv.Resource;
vd1.CreateVideoProcessorOutputView(tmpResource, vpe, vpovd, out var vpov);

RawRect rect = new((int)viewport.X, (int)viewport.Y, (int)(viewport.Width + viewport.X), (int)(viewport.Height + viewport.Y));
vc.VideoProcessorSetStreamSourceRect(vp, 0, true, VideoRect);
Expand All @@ -56,6 +57,7 @@ unsafe internal void PresentOffline(VideoFrame frame, ID3D11RenderTargetView rtv
vc.VideoProcessorBlt(vp, vpov, 0, 1, vpsa);
vpiv.Dispose();
vpov.Dispose();
tmpResource.Dispose();
}
else
{
Expand Down

0 comments on commit 678b76f

Please sign in to comment.