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