rename: MediaServerApp -> EdgeServerApp, media_server_app -> edge_server_app
This commit is contained in:
parent
341faf91f1
commit
601f9a5a98
@ -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
|
||||
|
||||
@ -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:
|
||||
@ -1,4 +1,4 @@
|
||||
#include "media_server_app.h"
|
||||
#include "edge_server_app.h"
|
||||
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
@ -125,9 +125,9 @@ void InotifyWatchLoop(const std::string& path, std::atomic<bool>& 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<bool>& 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<bool>& 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<bool> 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;
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
#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();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user