From 9513ca6e159af032b7a636efc5960608227e35ac Mon Sep 17 00:00:00 2001 From: seo-amugae Date: Thu, 8 Oct 2026 03:08:13 +0900 Subject: [PATCH] Verify RTSP probes from frame progress --- screen-rtsp.ps1 | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/screen-rtsp.ps1 b/screen-rtsp.ps1 index 965f9c0..54d4298 100644 --- a/screen-rtsp.ps1 +++ b/screen-rtsp.ps1 @@ -3006,9 +3006,10 @@ function New-RtspHealthProbeArguments { param([int]$Channel) return @( - "-hide_banner", "-loglevel", "error", "-nostdin", + "-hide_banner", "-loglevel", "error", "-nostdin", "-nostats", + "-progress", "pipe:1", "-rtsp_transport", "tcp", - "-rw_timeout", [string]($RtspHealthTimeoutSec * 1000000), + "-timeout", [string]($RtspHealthTimeoutSec * 1000000), "-i", "$RTSPPublishBase/monitor$Channel", "-map", "0:v:0", "-frames:v", "1", "-an", "-sn", "-dn", "-f", "null", "NUL" @@ -3022,17 +3023,21 @@ function Test-RtspStreamFrames { try { for ($channel = 1; $channel -le $ChannelCount; $channel++) { $errorLog = Join-Path $LogDir "rtsp-health-monitor$channel.log" - Remove-Item -LiteralPath $errorLog -Force -ErrorAction SilentlyContinue + $progressLog = Join-Path $LogDir "rtsp-health-monitor$channel.progress" + Remove-Item -LiteralPath $errorLog,$progressLog ` + -Force -ErrorAction SilentlyContinue $process = Start-Process -FilePath $FFmpegPath ` -ArgumentList (Join-ProcessArguments (New-RtspHealthProbeArguments $channel)) ` -WorkingDirectory $BaseDir -WindowStyle Hidden ` + -RedirectStandardOutput $progressLog ` -RedirectStandardError $errorLog -PassThru $probes += [PSCustomObject]@{ Channel = $channel Process = $process ErrorLog = $errorLog + ProgressLog = $progressLog } } @@ -3055,8 +3060,20 @@ function Test-RtspStreamFrames { } $probe.Process.WaitForExit() - if ($probe.Process.ExitCode -ne 0) { - $detail = "exit=$($probe.Process.ExitCode)" + $progress = @() + if (Test-Path -LiteralPath $probe.ProgressLog) { + $progress = @( + Get-Content -LiteralPath $probe.ProgressLog ` + -ErrorAction SilentlyContinue + ) + } + $hasFrame = @($progress | Where-Object { + $_ -match '^frame=([1-9][0-9]*)$' + }).Count -gt 0 + $reachedEnd = $progress -contains "progress=end" + + if (-not ($hasFrame -and $reachedEnd)) { + $detail = "FFmpeg progress에 디코딩 완료 프레임 없음" if (Test-Path -LiteralPath $probe.ErrorLog) { $tail = @( Get-Content -LiteralPath $probe.ErrorLog -Tail 3 ` @@ -3611,7 +3628,9 @@ function Invoke-SimulationTests { Invoke-SimulationCase "RTSP 상태 검사는 새 수신기로 실제 영상 1프레임 요구" { $arguments = @(New-RtspHealthProbeArguments 2) - return ($arguments -contains '-rw_timeout' -and + return ($arguments -contains '-timeout' -and + $arguments -contains '-progress' -and + $arguments -contains 'pipe:1' -and $arguments -contains '-frames:v' -and $arguments -contains '1' -and $arguments -contains '0:v:0' -and