From f7aaea430025ddb114a31712cb791ea5141e8d56 Mon Sep 17 00:00:00 2001
From: gdkchan <gab.dark.100@gmail.com>
Date: Mon, 4 Oct 2021 14:12:24 -0300
Subject: [PATCH] Unref frames before decoding with FFMPEG (#2704)

---
 Ryujinx.Graphics.Nvdec.H264/FFmpegContext.cs | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Ryujinx.Graphics.Nvdec.H264/FFmpegContext.cs b/Ryujinx.Graphics.Nvdec.H264/FFmpegContext.cs
index 7676093f8d..66b1e6c1aa 100644
--- a/Ryujinx.Graphics.Nvdec.H264/FFmpegContext.cs
+++ b/Ryujinx.Graphics.Nvdec.H264/FFmpegContext.cs
@@ -106,6 +106,8 @@ namespace Ryujinx.Graphics.Nvdec.H264
 
         public int DecodeFrame(Surface output, ReadOnlySpan<byte> bitstream)
         {
+            ffmpeg.av_frame_unref(output.Frame);
+
             int result;
             int gotFrame;