diff --git a/src/main.cpp b/src/main.cpp index 382b985..b7df1a0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -37,7 +37,7 @@ int main() LOG_INFO("[MAIN] ===== Vehicle Video Service Starting ====="); // 创建全局 RecordManager 实例 - g_record_manager = std::make_shared("/home/aiec/srs/conf/kun_record.conf"); + // g_record_manager = std::make_shared("/home/aiec/srs/conf/kun_record.conf"); try { @@ -59,20 +59,20 @@ int main() RTMPManager::start_all(); // 启动 MQTT 线程 - std::thread mqtt_thread( - [] - { - try - { - LOG_INFO("[MAIN] MQTT thread started."); - mqtt_client_thread_func(); // 在回调里执行推流控制 - } - catch (const std::exception& e) - { - LOG_ERROR(std::string("[MAIN] MQTT thread crashed: ") + e.what()); - } - LOG_INFO("[MAIN] MQTT thread exiting..."); - }); + // std::thread mqtt_thread( + // [] + // { + // try + // { + // LOG_INFO("[MAIN] MQTT thread started."); + // mqtt_client_thread_func(); // 在回调里执行推流控制 + // } + // catch (const std::exception& e) + // { + // LOG_ERROR(std::string("[MAIN] MQTT thread crashed: ") + e.what()); + // } + // LOG_INFO("[MAIN] MQTT thread exiting..."); + // }); // 主循环,仅等待退出信号 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(); - if (mqtt_thread.joinable()) - { - mqtt_thread.join(); - LOG_INFO("[MAIN] MQTT thread joined."); - } + // if (mqtt_thread.joinable()) + // { + // mqtt_thread.join(); + // LOG_INFO("[MAIN] MQTT thread joined."); + // } LOG_INFO("[MAIN] ===== Vehicle Video Service Exited Cleanly ====="); return 0; diff --git a/src/rtmp_manager.cpp b/src/rtmp_manager.cpp index eeaf696..abab4fa 100644 --- a/src/rtmp_manager.cpp +++ b/src/rtmp_manager.cpp @@ -114,24 +114,11 @@ GstElement* RTMPManager::create_pipeline(const Camera& cam) " ! mpph264enc bps=" + std::to_string(bitrate) + " gop=" + std::to_string(fps) + " rc-mode=cbr " - " ! h264parse ! tee name=t " - - // ------ 分支1:live ------ - "t. ! queue max-size-buffers=5 leaky=downstream " - " ! flvmux streamable=true name=mux_live " + " ! h264parse " + " ! queue max-size-buffers=5 leaky=downstream " + " ! flvmux streamable=true " " ! rtmpsink location=\"" + - live_rtmp + - "\" sync=false async=false " - - // ------ 分支2:record ------ - "t. ! queue max-size-buffers=5 leaky=downstream " - " ! flvmux streamable=true name=mux_record " - " ! rtmpsink location=\"" + - record_rtmp + - "\" sync=false async=false " - - // ------ 分支3:AI ------ - "t. ! queue ! fakesink sync=false"; + live_rtmp + "\" sync=false async=false"; GError* error = nullptr; GstElement* pipeline = gst_parse_launch(pipeline_str.c_str(), &error);