1
This commit is contained in:
parent
b599ef6903
commit
5ee6245d1b
@ -150,13 +150,25 @@ 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)
|
||||
{
|
||||
ctx->status.running = false;
|
||||
ctx->status.last_error = "No frames detected (no video signal)";
|
||||
LOG_ERROR("[RTMP] " + key + " - " + ctx->status.last_error);
|
||||
need_restart = true;
|
||||
break;
|
||||
GstState state;
|
||||
gst_element_get_state(pipeline, &state, nullptr, 0);
|
||||
if (state != GST_STATE_PLAYING)
|
||||
{
|
||||
ctx->status.running = false;
|
||||
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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user