关闭录像功能和mqtt功能

This commit is contained in:
cxh 2025-12-23 09:25:52 +08:00
parent a9c236d5f2
commit 3676e38a89
2 changed files with 24 additions and 37 deletions

View File

@ -37,7 +37,7 @@ int main()
LOG_INFO("[MAIN] ===== Vehicle Video Service Starting ====="); LOG_INFO("[MAIN] ===== Vehicle Video Service Starting =====");
// 创建全局 RecordManager 实例 // 创建全局 RecordManager 实例
g_record_manager = std::make_shared<RecordManager>("/home/aiec/srs/conf/kun_record.conf"); // g_record_manager = std::make_shared<RecordManager>("/home/aiec/srs/conf/kun_record.conf");
try try
{ {
@ -59,20 +59,20 @@ int main()
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));
@ -85,11 +85,11 @@ int main()
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;

View File

@ -114,24 +114,11 @@ GstElement* RTMPManager::create_pipeline(const Camera& cam)
" ! mpph264enc bps=" + " ! mpph264enc bps=" +
std::to_string(bitrate) + " gop=" + std::to_string(fps) + std::to_string(bitrate) + " gop=" + std::to_string(fps) +
" rc-mode=cbr " " rc-mode=cbr "
" ! h264parse ! tee name=t " " ! h264parse "
" ! queue max-size-buffers=5 leaky=downstream "
// ------ 分支1live ------ " ! flvmux streamable=true "
"t. ! queue max-size-buffers=5 leaky=downstream "
" ! flvmux streamable=true name=mux_live "
" ! rtmpsink location=\"" + " ! rtmpsink location=\"" +
live_rtmp + live_rtmp + "\" sync=false async=false";
"\" sync=false async=false "
// ------ 分支2record ------
"t. ! queue max-size-buffers=5 leaky=downstream "
" ! flvmux streamable=true name=mux_record "
" ! rtmpsink location=\"" +
record_rtmp +
"\" sync=false async=false "
// ------ 分支3AI ------
"t. ! queue ! fakesink sync=false";
GError* error = nullptr; GError* error = nullptr;
GstElement* pipeline = gst_parse_launch(pipeline_str.c_str(), &error); GstElement* pipeline = gst_parse_launch(pipeline_str.c_str(), &error);