diff --git a/CMakeLists.txt b/CMakeLists.txt index 2445b6c..3cac91b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,7 +57,7 @@ endif() set(SRC_FILES src/main.cpp - src/media_server_app.cpp + src/edge_server_app.cpp src/graph_manager.cpp src/plugin_loader.cpp src/ai_scheduler.cpp diff --git a/include/media_server_app.h b/include/edge_server_app.h similarity index 80% rename from include/media_server_app.h rename to include/edge_server_app.h index 7aeef52..7cf5100 100644 --- a/include/media_server_app.h +++ b/include/edge_server_app.h @@ -8,9 +8,9 @@ namespace rk3588 { -class MediaServerApp { +class EdgeServerApp { public: - explicit MediaServerApp(std::string config_path); + explicit EdgeServerApp(std::string config_path); int Start(); private: diff --git a/src/media_server_app.cpp b/src/edge_server_app.cpp similarity index 89% rename from src/media_server_app.cpp rename to src/edge_server_app.cpp index b93b69e..c3f868b 100644 --- a/src/media_server_app.cpp +++ b/src/edge_server_app.cpp @@ -1,4 +1,4 @@ -#include "media_server_app.h" +#include "edge_server_app.h" #include #include @@ -125,9 +125,9 @@ void InotifyWatchLoop(const std::string& path, std::atomic& stop_flag, Gra if (matched) { std::string err; if (!mgr.ReloadFromFile(path, err)) { - LogWarn("[MediaServerApp] hot reload failed: " + err); + LogWarn("[EdgeServerApp] hot reload failed: " + err); } else { - LogInfo("[MediaServerApp] hot reload succeeded"); + LogInfo("[EdgeServerApp] hot reload succeeded"); } // Debounce burst events. std::this_thread::sleep_for(std::chrono::milliseconds(300)); @@ -159,9 +159,9 @@ void PollWatchLoop(const std::string& path, std::atomic& stop_flag, GraphM std::string err; if (!mgr.ReloadFromFile(path, err)) { - LogWarn("[MediaServerApp] hot reload failed: " + err); + LogWarn("[EdgeServerApp] hot reload failed: " + err); } else { - LogInfo("[MediaServerApp] hot reload succeeded"); + LogInfo("[EdgeServerApp] hot reload succeeded"); } #else (void)path; @@ -172,14 +172,14 @@ void PollWatchLoop(const std::string& path, std::atomic& stop_flag, GraphM } // namespace -MediaServerApp::MediaServerApp(std::string config_path) +EdgeServerApp::EdgeServerApp(std::string config_path) : config_path_(std::move(config_path)), graph_manager_(ResolvePluginDir()) {} -int MediaServerApp::Start() { +int EdgeServerApp::Start() { SimpleJson root_cfg; std::string err; if (!GraphManager::LoadConfigFile(config_path_, root_cfg, err)) { - LogError("[MediaServerApp] Failed to load config: " + err); + LogError("[EdgeServerApp] Failed to load config: " + err); return 1; } @@ -191,7 +191,7 @@ int MediaServerApp::Start() { } if (!graph_manager_.BuildFromFile(config_path_, err)) { - LogError("[MediaServerApp] Failed to build graphs: " + err); + LogError("[EdgeServerApp] Failed to build graphs: " + err); return 1; } @@ -214,7 +214,7 @@ int MediaServerApp::Start() { const int sig = sigtimedwait(&set, nullptr, &ts); if (sig == SIGINT || sig == SIGTERM) { - LogWarn("[MediaServerApp] Caught signal, stopping..."); + LogWarn("[EdgeServerApp] Caught signal, stopping..."); graph_manager_.RequestStop(); return; } @@ -229,7 +229,7 @@ int MediaServerApp::Start() { signal_thread_ = std::thread([this]() { while (!stop_signal_thread_.load(std::memory_order_acquire)) { if (g_stop_signal) { - LogWarn("[MediaServerApp] Caught signal, stopping..."); + LogWarn("[EdgeServerApp] Caught signal, stopping..."); graph_manager_.RequestStop(); return; } @@ -244,7 +244,7 @@ int MediaServerApp::Start() { }; if (!graph_manager_.StartAll()) { - LogError("[MediaServerApp] Failed to start graphs"); + LogError("[EdgeServerApp] Failed to start graphs"); stop_signal(); return 1; } @@ -252,7 +252,7 @@ int MediaServerApp::Start() { HttpServer http(graph_manager_, metrics_port, web_root); (void)http.Start(); - LogInfo("[MediaServerApp] Running. Press Ctrl+C to stop."); + LogInfo("[EdgeServerApp] Running. Press Ctrl+C to stop."); std::atomic stop_watch{false}; std::thread watcher; @@ -266,7 +266,7 @@ int MediaServerApp::Start() { #else watcher = std::thread([&] { PollWatchLoop(config_path_, stop_watch, graph_manager_); }); #endif - LogInfo("[MediaServerApp] Hot reload enabled"); + LogInfo("[EdgeServerApp] Hot reload enabled"); } graph_manager_.BlockUntilStop(); @@ -277,7 +277,7 @@ int MediaServerApp::Start() { stop_watch.store(true); if (watcher.joinable()) watcher.join(); - LogInfo("[MediaServerApp] Shutdown complete."); + LogInfo("[EdgeServerApp] Shutdown complete."); return 0; } diff --git a/src/main.cpp b/src/main.cpp index b68ecc4..560855f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2,7 +2,7 @@ #include #include -#include "media_server_app.h" +#include "edge_server_app.h" #include "version.h" namespace { @@ -50,6 +50,6 @@ int main(int argc, char** argv) { } PrintVersion(); - rk3588::MediaServerApp app(config_path); + rk3588::EdgeServerApp app(config_path); return app.Start(); }