This commit is contained in:
cxh 2025-12-17 17:43:39 +08:00
parent 6a601227d6
commit 09fdc0a875

View File

@ -295,12 +295,19 @@ void RTMPManager::stream_loop(Camera cam, StreamContext* ctx)
// ========== 启停与状态 ========== // ========== 启停与状态 ==========
void RTMPManager::start_all() void RTMPManager::start_all()
{ {
LOG_INFO("[RTMP] Starting all record streams..."); LOG_INFO("[RTMP] Starting enabled record streams...");
std::lock_guard<std::mutex> lock(streams_mutex); std::lock_guard<std::mutex> lock(streams_mutex);
int delay_ms = 0; int delay_ms = 0;
for (auto& cam : g_app_config.cameras) for (const auto& cam : g_app_config.cameras)
{ {
// 🔴 核心修正:跳过未启用摄像头
if (!cam.enabled)
{
LOG_INFO("[RTMP] Skip disabled camera: " + cam.name);
continue;
}
auto key = make_key(cam.name); auto key = make_key(cam.name);
if (streams.find(key) != streams.end()) if (streams.find(key) != streams.end())
{ {
@ -319,7 +326,7 @@ void RTMPManager::start_all()
}); });
streams.emplace(key, std::move(ctx)); streams.emplace(key, std::move(ctx));
delay_ms += 200; // 每路错开 200ms delay_ms += 200;
} }
} }