This commit is contained in:
cxh 2025-11-14 14:49:45 +08:00
parent f1ec176d10
commit 055fe9c626

View File

@ -38,53 +38,53 @@ int main()
RecordManager rm("/home/aiec/srs/conf/kun_record.conf"); RecordManager rm("/home/aiec/srs/conf/kun_record.conf");
// try try
// { {
// // 加载配置 // 加载配置
// g_app_config = AppConfig::load_from_file(get_executable_dir_file_path("config.json")); g_app_config = AppConfig::load_from_file(get_executable_dir_file_path("config.json"));
// LOG_INFO("[MAIN] Loaded config from config.json"); LOG_INFO("[MAIN] Loaded config from config.json");
// } }
// catch (const std::exception& e) catch (const std::exception& e)
// { {
// LOG_ERROR(std::string("[MAIN] Failed to load config: ") + e.what()); LOG_ERROR(std::string("[MAIN] Failed to load config: ") + e.what());
// return -1; return -1;
// } }
// // ---------- 初始化 GStreamer ---------- // ---------- 初始化 GStreamer ----------
// RTMPManager::init(); RTMPManager::init();
// // ---------- 自动推流8 路录像守护) ---------- // ---------- 自动推流8 路录像守护) ----------
// LOG_INFO("[MAIN] Starting all record streams..."); LOG_INFO("[MAIN] Starting all record streams...");
// RTMPManager::start_all(); RTMPManager::start_all();
// // 启动 MQTT 线程 // 启动 MQTT 线程
// std::thread mqtt_thread( std::thread mqtt_thread(
// [] []
// { {
// try try
// { {
// LOG_INFO("[MAIN] MQTT thread started."); LOG_INFO("[MAIN] MQTT thread started.");
// mqtt_client_thread_func(); // 在回调里执行推流控制 mqtt_client_thread_func(); // 在回调里执行推流控制
// } }
// catch (const std::exception& e) catch (const std::exception& e)
// { {
// LOG_ERROR(std::string("[MAIN] MQTT thread crashed: ") + e.what()); LOG_ERROR(std::string("[MAIN] MQTT thread crashed: ") + e.what());
// } }
// LOG_INFO("[MAIN] MQTT thread exiting..."); LOG_INFO("[MAIN] MQTT thread exiting...");
// }); });
// 主循环,仅等待退出信号 // 主循环,仅等待退出信号
while (g_running.load(std::memory_order_relaxed)) std::this_thread::sleep_for(std::chrono::milliseconds(200)); while (g_running.load(std::memory_order_relaxed)) std::this_thread::sleep_for(std::chrono::milliseconds(200));
// // ---------- 退出清理 ---------- // ---------- 退出清理 ----------
// LOG_INFO("[MAIN] Shutdown requested. Stopping RTMP streams..."); LOG_INFO("[MAIN] Shutdown requested. Stopping RTMP streams...");
// RTMPManager::stop_all(); RTMPManager::stop_all();
// if (mqtt_thread.joinable()) if (mqtt_thread.joinable())
// { {
// mqtt_thread.join(); mqtt_thread.join();
// LOG_INFO("[MAIN] MQTT thread joined."); LOG_INFO("[MAIN] MQTT thread joined.");
// } }
LOG_INFO("[MAIN] ===== Vehicle Video Service Exited Cleanly ====="); LOG_INFO("[MAIN] ===== Vehicle Video Service Exited Cleanly =====");
return 0; return 0;