Try to fix waveform/mpv lagging - thx Leon :)

Work on  #5432
This commit is contained in:
niksedk 2021-10-29 18:05:10 +02:00
parent a108b5448f
commit e54cba6bc7

View File

@ -440,6 +440,7 @@ namespace Nikse.SubtitleEdit.Controls
private int _mpvSubOldHash = -1;
private string _mpvTextFileName;
private int _retryCount = 3;
private void RefreshMpv(LibMpvDynamic mpv, Subtitle subtitle, SubtitleFormat uiFormat)
{
if (subtitle == null)
@ -447,6 +448,14 @@ namespace Nikse.SubtitleEdit.Controls
return;
}
var hash = subtitle.GetFastHashCode(null);
if (hash == _mpvSubOldHash)
{
return;
}
_mpvSubOldHash = hash;
try
{
if (SmpteMode)
@ -508,11 +517,9 @@ namespace Nikse.SubtitleEdit.Controls
}
}
var hash = subtitle.GetFastHashCode(null);
if (hash != _mpvSubOldHash || string.IsNullOrEmpty(_mpvTextOld))
{
text = subtitle.ToText(format);
_mpvSubOldHash = hash;
}
else
{