This commit is contained in:
cxh 2025-10-17 16:03:26 +08:00
parent b599ef6903
commit 5ee6245d1b

View File

@ -150,14 +150,26 @@ void RTMPManager::stream_loop(Camera cam, StreamContext *ctx)
// 检查帧超时3 秒内没有检测到帧
auto elapsed =
std::chrono::duration_cast<std::chrono::seconds>(std::chrono::steady_clock::now() - start_time).count();
if (!got_frame && elapsed > 3)
if (!got_frame && elapsed > 5)
{
GstState state;
gst_element_get_state(pipeline, &state, nullptr, 0);
if (state != GST_STATE_PLAYING)
{
ctx->status.running = false;
ctx->status.last_error = "No frames detected (no video signal)";
ctx->status.last_error = "Pipeline failed to reach PLAYING (maybe no device signal)";
LOG_ERROR("[RTMP] " + key + " - " + ctx->status.last_error);
need_restart = true;
break;
}
else
{
ctx->status.running = true;
ctx->status.last_error.clear();
LOG_INFO("[RTMP] " + key + " reached PLAYING but no frames yet, assuming OK");
got_frame = true;
}
}
if (!msg) continue;