From 8a676136e3e8960f5483ff5a7cfe4f1df78fbf7e Mon Sep 17 00:00:00 2001 From: cxh Date: Thu, 16 Oct 2025 11:04:22 +0800 Subject: [PATCH] 1 --- src/rtmp_manager.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/rtmp_manager.cpp b/src/rtmp_manager.cpp index 97c85d4..b68cc16 100644 --- a/src/rtmp_manager.cpp +++ b/src/rtmp_manager.cpp @@ -175,7 +175,16 @@ void RTMPManager::stream_loop(Camera cam, StreamType type, std::promise lock(streams_mutex); + auto it = streams.find(key); + if (it == streams.end() || !it->second->running.load()) + { + break; // 停止逻辑 + } + } + if (!first_frame_received && std::chrono::duration_cast(std::chrono::steady_clock::now() - start_time).count() > 5) { @@ -204,7 +213,7 @@ void RTMPManager::stream_loop(Camera cam, StreamType type, std::promiseset_value(status); // 立刻返回给 start_camera + if (status_promise) status_promise->set_value(status); } break; } @@ -219,10 +228,10 @@ void RTMPManager::stream_loop(Camera cam, StreamType type, std::promise