降低CPU使用率,处置好因降低CPU使用率带来的颜色偏差

This commit is contained in:
2026-01-31 10:43:41 +08:00
parent 6661edfc44
commit 4afbf06439
17 changed files with 360 additions and 64 deletions

View File

@@ -11,12 +11,15 @@ namespace SHH.MjpegPlayer
static void Main(string[] args)
{
InitTemporaryLog();
_sysLog.Information("MjpegPlayer 正在初始化...");
var builder = WebApplication.CreateBuilder(args);
// 1. 注册 gRpc 服务
builder.Services.AddGrpc(options => {
builder.Services.AddGrpc(options =>
{
options.MaxReceiveMessageSize = 10 * 1024 * 1024; // 针对工业视频流,建议放宽至 10MB
});
@@ -39,6 +42,19 @@ namespace SHH.MjpegPlayer
app.Run("http://0.0.0.0:9002");
}
/// <summary>
/// [新增] 临时日志初始化
/// </summary>
private static void InitTemporaryLog()
{
// 在未读取到 MjpegConfig 前,先使用默认参数启动日志
LogBootstrapper.Init(new LogOptions
{
AppId = "MjpegPlayer",
LogRootPath = @"D:\Logs",
ConsoleLevel = Serilog.Events.LogEventLevel.Information
});
}
#region StartServer
@@ -73,6 +89,9 @@ namespace SHH.MjpegPlayer
catch (Exception ex)
{
//Logs.LogCritical<Program>(ex.Message, ex.StackTrace);
Console.WriteLine(ex.ToString());
Console.ReadLine();
// 退出应用
Bootstrapper.ExitApp("应用程序崩溃.");
}