mirror of
https://github.com/n00mkrad/flowframes.git
synced 2025-12-23 03:39:26 +01:00
Fix issues with queue getting stuck waiting for ffmpeg to exit
This commit is contained in:
@@ -113,6 +113,9 @@ namespace Flowframes
|
|||||||
|
|
||||||
public static string[] SplitIntoLines(this string str)
|
public static string[] SplitIntoLines(this string str)
|
||||||
{
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(str))
|
||||||
|
return new string[0];
|
||||||
|
|
||||||
return Regex.Split(str, "\r\n|\r|\n");
|
return Regex.Split(str, "\r\n|\r|\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,11 @@ namespace Flowframes
|
|||||||
public const string defaultLogName = "sessionlog";
|
public const string defaultLogName = "sessionlog";
|
||||||
public static long id;
|
public static long id;
|
||||||
|
|
||||||
|
private static string _lastUi = "";
|
||||||
|
public static string LastUiLine { get { return _lastUi; } }
|
||||||
|
private static string _lastLog = "";
|
||||||
|
public static string LastLogLine { get { return _lastLog; } }
|
||||||
|
|
||||||
public struct LogEntry
|
public struct LogEntry
|
||||||
{
|
{
|
||||||
public string logMessage;
|
public string logMessage;
|
||||||
@@ -55,7 +60,14 @@ namespace Flowframes
|
|||||||
if (string.IsNullOrWhiteSpace(entry.logMessage))
|
if (string.IsNullOrWhiteSpace(entry.logMessage))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Console.WriteLine(entry.logMessage);
|
string msg = entry.logMessage;
|
||||||
|
|
||||||
|
_lastLog = msg;
|
||||||
|
|
||||||
|
if (!entry.hidden)
|
||||||
|
_lastUi = msg;
|
||||||
|
|
||||||
|
Console.WriteLine(msg);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -68,21 +80,21 @@ namespace Flowframes
|
|||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
|
|
||||||
entry.logMessage = entry.logMessage.Replace("\n", Environment.NewLine);
|
msg = msg.Replace("\n", Environment.NewLine);
|
||||||
|
|
||||||
if (!entry.hidden && textbox != null)
|
if (!entry.hidden && textbox != null)
|
||||||
textbox.AppendText((textbox.Text.Length > 1 ? Environment.NewLine : "") + entry.logMessage);
|
textbox.AppendText((textbox.Text.Length > 1 ? Environment.NewLine : "") + msg);
|
||||||
|
|
||||||
if (entry.replaceLastLine)
|
if (entry.replaceLastLine)
|
||||||
{
|
{
|
||||||
textbox.Resume();
|
textbox.Resume();
|
||||||
entry.logMessage = "[REPL] " + entry.logMessage;
|
msg = "[REPL] " + msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!entry.hidden)
|
if (!entry.hidden)
|
||||||
entry.logMessage = "[UI] " + entry.logMessage;
|
msg = "[UI] " + msg;
|
||||||
|
|
||||||
LogToFile(entry.logMessage, false, entry.filename);
|
LogToFile(msg, false, entry.filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void LogToFile(string logStr, bool noLineBreak, string filename)
|
public static void LogToFile(string logStr, bool noLineBreak, string filename)
|
||||||
|
|||||||
@@ -88,20 +88,33 @@ namespace Flowframes.Os
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
while (Interpolate.currentlyUsingAutoEnc && Program.busy)
|
while (Interpolate.currentlyUsingAutoEnc && Program.busy)
|
||||||
{
|
{
|
||||||
|
Logger.Log($"Interpolate.currentlyUsingAutoEnc && Program.busy");
|
||||||
|
|
||||||
if (AvProcess.lastAvProcess != null && !AvProcess.lastAvProcess.HasExited)
|
if (AvProcess.lastAvProcess != null && !AvProcess.lastAvProcess.HasExited)
|
||||||
{
|
{
|
||||||
string lastLine = AvProcess.lastOutputFfmpeg.SplitIntoLines().Last();
|
string lastLine = Logger.LastLogLine;
|
||||||
Logger.Log(FormatUtils.BeautifyFfmpegStats(lastLine), false, Logger.GetLastLine().ToLower().Contains("frame"));
|
|
||||||
|
if(lastLine.Contains("frame"))
|
||||||
|
Logger.Log(FormatUtils.BeautifyFfmpegStats(lastLine), false, Logger.LastUiLine.ToLower().Contains("frame"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Logger.Log($"will break if AvProcess.lastAvProcess.HasExited ({AvProcess.lastAvProcess.HasExited}) && !AutoEncode.HasWorkToDo() ({!AutoEncode.HasWorkToDo()})");
|
||||||
|
|
||||||
if (AvProcess.lastAvProcess.HasExited && !AutoEncode.HasWorkToDo()) // Stop logging if ffmpeg is not running & AE is done
|
if (AvProcess.lastAvProcess.HasExited && !AutoEncode.HasWorkToDo()) // Stop logging if ffmpeg is not running & AE is done
|
||||||
break;
|
break;
|
||||||
|
|
||||||
await Task.Delay(500);
|
await Task.Delay(500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
Logger.Log($"AiFinished encoder logging error: {e.Message}\n{e.StackTrace}", true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static async Task RunRifeCuda(string framesPath, float interpFactor, string mdl)
|
public static async Task RunRifeCuda(string framesPath, float interpFactor, string mdl)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user