Route Muninn capture activation over RUDP commands
This commit is contained in:
parent
c72879fe7f
commit
3f4d46bdd8
4 changed files with 1333 additions and 162 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -6,7 +6,8 @@ param(
|
|||
[string] $LogRoot = "C:\Meta\Odin\logs\muninn",
|
||||
[string] $Ffmpeg = "C:\Users\Madman's Lullaby\AppData\Local\Microsoft\WinGet\Links\ffmpeg.exe",
|
||||
[string] $TargetHost = "10.77.0.2",
|
||||
[int] $Port = 5200,
|
||||
[int] $Port = 5204,
|
||||
[string] $MediaTransport = "rudp",
|
||||
[string] $ObsTargetHost = "10.77.0.2",
|
||||
[int] $ObsPort = 5204,
|
||||
[string] $AudioDevice = "Realtek",
|
||||
|
|
@ -123,14 +124,16 @@ $activatePsPath = Join-Path $muninnDir "activate-raven-av-srt.ps1"
|
|||
$activateVbsPath = Join-Path $muninnDir "activate-raven-av-srt-hidden.vbs"
|
||||
|
||||
$activateArguments = @(
|
||||
"activate",
|
||||
"request-stream",
|
||||
"--store", $StorePath,
|
||||
"--host", "raven",
|
||||
"--stream", "muninn.raven.av.srt",
|
||||
"--stream", "muninn.raven.av.rudp",
|
||||
"--stream-action", "start",
|
||||
"--target-host", $TargetHost,
|
||||
"--port", $Port.ToString()
|
||||
"--port", $Port.ToString(),
|
||||
"--media-transport", $MediaTransport
|
||||
)
|
||||
if ($NoObsTarget.IsPresent -or ($TargetHost -eq $ObsTargetHost -and $Port -eq $ObsPort)) {
|
||||
if ($NoObsTarget.IsPresent -or $MediaTransport -ne "srt" -or ($TargetHost -eq $ObsTargetHost -and $Port -eq $ObsPort)) {
|
||||
$activateArguments += "--no-obs-target"
|
||||
} else {
|
||||
$activateArguments += @("--obs-target-host", $ObsTargetHost, "--obs-port", $ObsPort.ToString())
|
||||
|
|
@ -202,7 +205,7 @@ foreach (`$path in @(
|
|||
|
||||
Get-CimInstance Win32_Process |
|
||||
Where-Object {
|
||||
(`$_.Name -ieq "muninn.exe" -and `$_.CommandLine -like "*activate*") -or
|
||||
(`$_.Name -like "muninn*.exe" -and `$_.CommandLine -like "*activate*") -or
|
||||
(`$_.Name -ieq "ffmpeg.exe" -and `$_.CommandLine -like "*srt://$TargetHost*") -or
|
||||
(`$_.Name -ieq "powershell.exe" -and `$_.CommandLine -like "*wasapi-loopback-capture.ps1*")
|
||||
} |
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@ param(
|
|||
[string] $RavenHost = "raven",
|
||||
[string] $MuninnExe = "C:\Meta\Odin\Muninn\muninn.exe",
|
||||
[string] $StorePath = "C:\Meta\Odin\state\muninn.telemetry.cc",
|
||||
[string] $ActivateStorePath = "C:\Meta\Odin\state\muninn.activate.cc",
|
||||
[string] $LogRoot = "C:\Meta\Odin\logs\muninn",
|
||||
[int] $MaxStoreAgeSeconds = 180,
|
||||
[string] $IdunnRudpHealth = "10.77.0.2:17870"
|
||||
)
|
||||
|
||||
|
|
@ -94,9 +97,6 @@ foreach (`$expectation in `$taskExpectations) {
|
|||
if (`$psContent -notmatch 'Start-Process') {
|
||||
throw "`$(`$expectation.Ps) does not launch a hidden process"
|
||||
}
|
||||
if (`$expectation.Name -eq "GameCult-Muninn-Activate" -and `$psContent -notmatch 'muninn\.exe') {
|
||||
throw "`$(`$expectation.Ps) does not launch muninn.exe"
|
||||
}
|
||||
if (`$expectation.Name -eq "GameCult-Muninn-VideoProof" -and `$psContent -notmatch 'ffmpeg\.exe') {
|
||||
throw "`$(`$expectation.Ps) does not launch ffmpeg.exe"
|
||||
}
|
||||
|
|
@ -119,6 +119,8 @@ if (`$null -eq `$process) {
|
|||
}
|
||||
foreach (`$pattern in @(
|
||||
"--host raven",
|
||||
"--activate-store $ActivateStorePath",
|
||||
"--capture-command-rudp-bind 0.0.0.0:17872",
|
||||
"--idunn-rudp-health $IdunnRudpHealth",
|
||||
"--idunn-daemon muninn",
|
||||
"--idunn-health-contract muninn.cultnet-rudp-remote-telemetry-health"
|
||||
|
|
@ -127,11 +129,29 @@ foreach (`$pattern in @(
|
|||
throw "Muninn serve process is missing expected command-line segment `${pattern}: `$(`$process.CommandLine)"
|
||||
}
|
||||
}
|
||||
`$healthArgs = @(
|
||||
"--health",
|
||||
"--store", "$StorePath"
|
||||
)
|
||||
& "$MuninnExe" @healthArgs
|
||||
`$conflictingWriter = Get-CimInstance Win32_Process |
|
||||
Where-Object {
|
||||
`$_.Name -like "muninn*.exe" -and
|
||||
`$_.ProcessId -ne `$process.ProcessId -and
|
||||
`$_.ParentProcessId -ne `$process.ProcessId -and
|
||||
`$_.CommandLine -like "*activate*" -and
|
||||
`$_.CommandLine -like "*$StorePath*"
|
||||
} |
|
||||
Select-Object -First 1
|
||||
if (`$null -ne `$conflictingWriter) {
|
||||
throw "Conflicting Muninn activate writer still targets ${StorePath}: `$(`$conflictingWriter.CommandLine)"
|
||||
}
|
||||
if (-not (Test-Path -LiteralPath "$StorePath")) {
|
||||
throw "Muninn telemetry store is missing at $StorePath"
|
||||
}
|
||||
`$storeAgeSeconds = (([DateTime]::UtcNow) - (Get-Item -LiteralPath "$StorePath").LastWriteTimeUtc).TotalSeconds
|
||||
if (`$storeAgeSeconds -gt $MaxStoreAgeSeconds) {
|
||||
throw "Muninn telemetry store is stale (`$([math]::Round(`$storeAgeSeconds))s old)"
|
||||
}
|
||||
`$servePidPath = Join-Path "$LogRoot" "muninn-serve.pid"
|
||||
if (-not (Test-Path -LiteralPath `$servePidPath)) {
|
||||
throw "Muninn serve PID file is missing at `$servePidPath"
|
||||
}
|
||||
"@
|
||||
|
||||
Invoke-RavenUploadedPowerShell -RavenHost $RavenHost -RemoteScriptContent $remoteScript -TempPrefix "odin-raven-muninn-health"
|
||||
|
|
|
|||
|
|
@ -7,13 +7,16 @@ param(
|
|||
[string] $LoopbackScript = "C:\Meta\Odin\Muninn\scripts\wasapi-loopback-capture.ps1",
|
||||
[string] $Ffmpeg = "C:\Users\Madman's Lullaby\AppData\Local\Microsoft\WinGet\Links\ffmpeg.exe",
|
||||
[string] $TargetHost = "10.77.0.2",
|
||||
[int] $Port = 5200,
|
||||
[int] $Port = 5204,
|
||||
[string] $MediaTransport = "rudp",
|
||||
[string] $ObsTargetHost = "10.77.0.2",
|
||||
[int] $ObsPort = 5204,
|
||||
[string] $AudioDevice = "Realtek",
|
||||
[string] $IdunnRudpHealth = "10.77.0.2:17870",
|
||||
[string] $IdunnDaemon = "muninn",
|
||||
[string] $IdunnHealthContract = "muninn.cultnet-rudp-remote-telemetry-health"
|
||||
[string] $IdunnHealthContract = "muninn.cultnet-rudp-remote-telemetry-health",
|
||||
[string] $CaptureCommandRudpBind = "0.0.0.0:17872",
|
||||
[string] $CaptureCommandRudpTarget = "127.0.0.1:17872"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
|
@ -185,23 +188,36 @@ $videoProofVbsPath = Join-Path $muninnDir "muninn-raven-video-to-starfire-obs-hi
|
|||
$serveArguments = @(
|
||||
"serve",
|
||||
"--store", $StorePath,
|
||||
"--activate-store", $ActivateStorePath,
|
||||
"--log-root", $LogRoot,
|
||||
"--host", "raven",
|
||||
"--stream", "muninn.raven.av.rudp",
|
||||
"--target-host", $TargetHost,
|
||||
"--port", $Port.ToString(),
|
||||
"--media-transport", $MediaTransport,
|
||||
"--audio-device", $AudioDevice,
|
||||
"--ffmpeg", $Ffmpeg,
|
||||
"--loopback-script", $LoopbackScript,
|
||||
"--interval-seconds", "15",
|
||||
"--capture-command-rudp-bind", $CaptureCommandRudpBind,
|
||||
"--idunn-rudp-health", $IdunnRudpHealth,
|
||||
"--idunn-daemon", $IdunnDaemon,
|
||||
"--idunn-health-contract", $IdunnHealthContract
|
||||
)
|
||||
|
||||
$activateArguments = @(
|
||||
"activate",
|
||||
"--store", $ActivateStorePath,
|
||||
"request-stream",
|
||||
"--store", $StorePath,
|
||||
"--activate-store", $ActivateStorePath,
|
||||
"--capture-command-rudp-target", $CaptureCommandRudpTarget,
|
||||
"--host", "raven",
|
||||
"--stream", "muninn.raven.av.srt",
|
||||
"--stream", "muninn.raven.av.rudp",
|
||||
"--stream-action", "start",
|
||||
"--target-host", $TargetHost,
|
||||
"--port", $Port.ToString()
|
||||
"--port", $Port.ToString(),
|
||||
"--media-transport", $MediaTransport
|
||||
)
|
||||
if ($TargetHost -eq $ObsTargetHost -and $Port -eq $ObsPort) {
|
||||
if ($MediaTransport -ne "srt" -or ($TargetHost -eq $ObsTargetHost -and $Port -eq $ObsPort)) {
|
||||
$activateArguments += "--no-obs-target"
|
||||
} else {
|
||||
$activateArguments += @("--obs-target-host", $ObsTargetHost, "--obs-port", $ObsPort.ToString())
|
||||
|
|
@ -318,13 +334,15 @@ foreach (`$path in @(
|
|||
}
|
||||
|
||||
Get-CimInstance Win32_Process |
|
||||
Where-Object { `$_.Name -ieq "muninn.exe" } |
|
||||
Where-Object { `$_.Name -like "muninn*.exe" } |
|
||||
ForEach-Object {
|
||||
& taskkill.exe /PID `$_.ProcessId /T /F | Out-Null
|
||||
}
|
||||
|
||||
New-Item -ItemType Directory -Force -Path "$LogRoot" | Out-Null
|
||||
New-Item -ItemType Directory -Force -Path (Split-Path -Parent "$StorePath") | Out-Null
|
||||
& netsh.exe advfirewall firewall delete rule name="GameCult Muninn Capture Command RUDP" | Out-Null 2>`$null
|
||||
& netsh.exe advfirewall firewall add rule name="GameCult Muninn Capture Command RUDP" dir=in action=allow protocol=UDP localport=17872 | Out-Null
|
||||
|
||||
function Register-HiddenVbsTask {
|
||||
param(
|
||||
|
|
|
|||
Loading…
Reference in a new issue