Permalink
Browse files

MP1-4781V8 : madVR V335 (trying to fix memory leak and crash with MPC…

…-HC Engine)
  • Loading branch information...
Sebastiii committed Oct 3, 2017
1 parent 274b843 commit 42ad307b60da14edff2ecd3804e173c81f8cf08a
@@ -1217,7 +1217,7 @@ HRESULT MPMadPresenter::SetDevice(IDirect3DDevice9* pD3DDev)
// Lock madVR thread while Shutdown()
//CAutoLock lock(&m_dsLock);
CAutoLock cAutoLock(this);
//CAutoLock cAutoLock(this);
Log("MPMadPresenter::SetDevice() device 0x:%x", pD3DDev);
@@ -58,13 +58,13 @@ void CSubManager::SetDevice(IDirect3DDevice9* d3DDev)
if (!d3DDev)
{
// Release ressource
m_pAllocator = nullptr;
m_pSubPicQueue = nullptr;
if (m_d3DDev)
{
m_d3DDev.Release();
m_d3DDev = nullptr;
//m_d3DDev = nullptr;
}
m_pAllocator = nullptr;
m_pSubPicQueue = nullptr;
return;
}
@@ -147,6 +147,12 @@ BOOL IsModified()
void FreeSubtitles()
{
g_d3DDev = NULL;
g_subManager.Free();
try
{
g_d3DDev = NULL;
g_subManager->SetDevice(nullptr);
g_subManager.Free();
}
catch (...)
{}
}
@@ -1297,9 +1297,12 @@ public void SetSubtitleDevice(IntPtr device)
GUIGraphicsContext.SubDeviceMadVr = device;
// No need to set subtitle engine when using XySubFilter and madVR.
if (!_subEngineType.Equals("XySubFilter"))
{
ISubEngine engine = GUIGraphicsContext.SubDeviceMadVr != IntPtr.Zero ? SubEngine.GetInstance() : SubEngine.GetInstance(true);
engine?.SetDevice(device);
{
ISubEngine engine = SubEngine.GetInstance(true);
if (engine != null)
{
engine.SetDevice(device);
}
Log.Debug("Planescene: Set subtitle device - {0}", device);
}
}
@@ -98,6 +98,20 @@ protected override void LoadAdvancedSettings(Settings xmlreader)
public void SetDevice(IntPtr device)
{
if (GUIGraphicsContext.VideoRenderer == GUIGraphicsContext.VideoRendererType.madVR)
{
// Need to init there to have the setting for madVR.
LoadSettings();
MpcSubtitles.SetDefaultStyle(ref this.defStyle, this.overrideASSStyle);
if (selectionOff)
{
MpcSubtitles.SetShowForcedOnly(false);
}
else
{
MpcSubtitles.SetShowForcedOnly(!this.autoShow);
}
}
MpcSubtitles.SetDevice(device);
}
@@ -25,6 +25,7 @@
using System.Drawing;
using MediaPortal.Profile;
using MediaPortal.Configuration;
using MediaPortal.GUI.Library;
namespace MediaPortal.Player.Subtitles
{
@@ -112,6 +113,7 @@ public static ISubEngine GetInstance(bool forceinitialize)
else
engine = new DummyEngine();
}
Log.Debug("SubEngine : init engine : {0}", engine.ToString());
}
return engine;
}
@@ -1537,7 +1537,7 @@ public static bool Play(string strFile, MediaType type, TextReader chapters, boo
// back to previous Windows if we are only in video fullscreen to do a proper release when next item is music only
if (((GUIWindow.Window) (Enum.Parse(typeof (GUIWindow.Window), GUIWindowManager.ActiveWindow.ToString())) ==
GUIWindow.Window.WINDOW_FULLSCREEN_VIDEO) && !MediaInfo.hasVideo && type == MediaType.Music)
GUIWindow.Window.WINDOW_FULLSCREEN_VIDEO) && (MediaInfo != null && !MediaInfo.hasVideo) && type == MediaType.Music)
{
GUIWindowManager.ShowPreviousWindow();
}

0 comments on commit 42ad307

Please sign in to comment.