Add Eve sensor receiver ingest
This commit is contained in:
parent
4fadcfff14
commit
693f69b41b
12 changed files with 402 additions and 84 deletions
|
|
@ -3,6 +3,7 @@
|
|||
<Project Path="src/Mimir.App/Mimir.App.csproj" />
|
||||
<Project Path="src/Mimir.Broadcast/Mimir.Broadcast.csproj" />
|
||||
<Project Path="src/Mimir.EveRelay/Mimir.EveRelay.csproj" />
|
||||
<Project Path="src/Mimir.EveSensorReceiver/Mimir.EveSensorReceiver.csproj" />
|
||||
<Project Path="src/Mimir.Runtime/Mimir.Runtime.csproj" />
|
||||
<Project Path="src/Mimir.BufferSmoke/Mimir.BufferSmoke.csproj" />
|
||||
</Folder>
|
||||
|
|
|
|||
|
|
@ -70,28 +70,37 @@
|
|||
"kind": "Video",
|
||||
"origin": "Network",
|
||||
"enabled": true,
|
||||
"adapter": "ffmpeg-rawvideo",
|
||||
"command": "ffmpeg",
|
||||
"width": 1280,
|
||||
"height": 720,
|
||||
"pixelFormat": "Bgra8",
|
||||
"adapter": "frame-events",
|
||||
"command": "../src/Mimir.EveSensorReceiver/bin/Debug/net10.0/Mimir.EveSensorReceiver.exe",
|
||||
"arguments": [
|
||||
"-hide_banner",
|
||||
"-nostdin",
|
||||
"-loglevel",
|
||||
"warning",
|
||||
"-fflags",
|
||||
"nobuffer",
|
||||
"-flags",
|
||||
"low_delay",
|
||||
"-i",
|
||||
"srt://0.0.0.0:5201?mode=listener&latency=120000&timeout=5000000",
|
||||
"-an",
|
||||
"-f",
|
||||
"rawvideo",
|
||||
"-pix_fmt",
|
||||
"bgra",
|
||||
"-"
|
||||
"--port",
|
||||
"8793",
|
||||
"--path",
|
||||
"/eve/camera",
|
||||
"--source-id",
|
||||
"eve-camera",
|
||||
"--type",
|
||||
"video-frame"
|
||||
]
|
||||
},
|
||||
{
|
||||
"sourceId": "eve-mic",
|
||||
"displayName": "Eve microphone capture",
|
||||
"clockDomainId": "eve-camera",
|
||||
"kind": "Audio",
|
||||
"origin": "Network",
|
||||
"enabled": true,
|
||||
"adapter": "frame-events",
|
||||
"command": "../src/Mimir.EveSensorReceiver/bin/Debug/net10.0/Mimir.EveSensorReceiver.exe",
|
||||
"arguments": [
|
||||
"--port",
|
||||
"8794",
|
||||
"--path",
|
||||
"/eve/mic",
|
||||
"--source-id",
|
||||
"eve-mic",
|
||||
"--type",
|
||||
"audio-block"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -226,11 +226,12 @@ a named invariant that the native runtime cannot protect yet.
|
|||
`Mimir.BufferSmoke --synchronized-buffer-planner-smoke` proves the aligned
|
||||
local-camera, Raven-display, loopback, and mic buffer shape.
|
||||
- `MimirFfmpegRawVideoStreamSource` is the current network-pixel adapter for
|
||||
Raven/Eve ingest. FFmpeg owns SRT receive/decode, Mimir owns exact raw-video
|
||||
frame reads and synchronized buffer samples. `config/mimir-runtime.raven-eve.example.json`
|
||||
listens for Raven screen capture on port `5200` and Eve camera capture on
|
||||
port `5201`. `Mimir.BufferSmoke --ffmpeg-rawvideo-source-smoke` proves the
|
||||
local raw-video adapter without Raven or Eve online.
|
||||
Raven ingest. FFmpeg owns SRT receive/decode, Mimir owns exact raw-video
|
||||
frame reads and synchronized buffer samples. Eve uses EveCanvas-native sensor
|
||||
uplinks instead: `Mimir.EveSensorReceiver` listens for `eve-camera` on
|
||||
WebSocket port `8793` and `eve-mic` on port `8794`, emitting the existing
|
||||
frame-event shape into runtime buffers. `Mimir.BufferSmoke --ffmpeg-rawvideo-source-smoke`
|
||||
proves the local raw-video adapter without Raven online.
|
||||
- `MimirPresentationControlState` owns operator intent for the Fensalir program
|
||||
surface: video feed visibility/solo/opacity/layer order, audio mute/solo/gain,
|
||||
and global LUT preset selection. The `Mimir Program` UI panel is deliberately
|
||||
|
|
|
|||
|
|
@ -36,8 +36,10 @@ network producer pass:
|
|||
|
||||
- `raven-display` listens for Raven screen capture on SRT port `5200`, decodes
|
||||
through FFmpeg, and emits BGRA video samples into the runtime buffer path.
|
||||
- `eve-camera` listens for Eve camera capture on SRT port `5201`, using the same
|
||||
raw-video adapter.
|
||||
- `eve-camera` listens for EveCanvas camera frame-events on WebSocket port
|
||||
`8793`.
|
||||
- `eve-mic` listens for EveCanvas microphone frame-events on WebSocket port
|
||||
`8794`.
|
||||
|
||||
The older disabled `frame-events` example in
|
||||
`config/mimir-runtime.asio.example.json` remains diagnostic only. It can witness
|
||||
|
|
|
|||
|
|
@ -2,25 +2,25 @@
|
|||
|
||||
## Objective
|
||||
|
||||
Ingest Raven screen capture and Eve camera capture into Mimir as ordinary
|
||||
network video sources, then let the existing synchronization hub place those
|
||||
samples in rolling buffers beside Scarlett audio and local camera sources.
|
||||
Ingest Raven screen capture plus Eve camera and microphone capture into Mimir,
|
||||
then let the existing synchronization hub place those samples in rolling buffers
|
||||
beside Scarlett audio and local camera sources.
|
||||
|
||||
## Authority Map
|
||||
|
||||
- Owner: `Mimir.Runtime` owns decoded video samples and rolling-buffer
|
||||
placement.
|
||||
- Owner: `Mimir.Runtime` owns decoded samples and rolling-buffer placement.
|
||||
- Inputs: Raven sends H.264/MPEG-TS over SRT to Starfire port `5200`; Eve sends
|
||||
camera video over SRT to Starfire port `5201`; Scarlett/ASIO carries audio and
|
||||
sync evidence.
|
||||
- Outputs: `raven-display` and `eve-camera` emit `MimirStreamSample` frames with
|
||||
BGRA payloads and `MimirVideoFrameDescriptor` metadata.
|
||||
camera frame-events over WebSocket port `8793`; Eve sends microphone
|
||||
frame-events over WebSocket port `8794`; Scarlett/ASIO carries audio and sync
|
||||
evidence.
|
||||
- Outputs: `raven-display`, `eve-camera`, and `eve-mic` emit
|
||||
`MimirStreamSample` records with video or audio descriptors.
|
||||
- Derived state: network arrival timestamps are capture metadata only. Raven
|
||||
audio-in-Scarlett remains the timing witness for global alignment.
|
||||
- Forbidden writers: OBS, FFmpeg sender clocks, and SRT arrival time do not own
|
||||
final sync truth.
|
||||
- Cut line: no custom transport daemon and no second compositor path until this
|
||||
FFmpeg/SRT edge fails a concrete invariant.
|
||||
- Forbidden writers: OBS, FFmpeg sender clocks, WebSocket receive time, and SRT
|
||||
arrival time do not own final sync truth.
|
||||
- Cut line: EveCanvas owns Eve's sensors directly. External iOS streaming apps
|
||||
are fallback tools, not the current architecture.
|
||||
|
||||
## Starfire Receiver
|
||||
|
||||
|
|
@ -38,13 +38,15 @@ $env:MIMIR_RUNTIME_CONFIG = "E:\Projects\Mimir\config\mimir-runtime.raven-eve.ex
|
|||
dotnet run --project .\src\Mimir.BufferSmoke\Mimir.BufferSmoke.csproj -- --seconds 5 --require-samples
|
||||
```
|
||||
|
||||
The config starts two FFmpeg listener processes:
|
||||
The config starts one FFmpeg listener and two Eve sensor receiver processes:
|
||||
|
||||
- `raven-display`: `srt://0.0.0.0:5200?mode=listener&latency=120000&timeout=5000000`
|
||||
- `eve-camera`: `srt://0.0.0.0:5201?mode=listener&latency=120000&timeout=5000000`
|
||||
- `eve-camera`: `ws://0.0.0.0:8793/eve/camera`
|
||||
- `eve-mic`: `ws://0.0.0.0:8794/eve/mic`
|
||||
|
||||
Each listener decodes to raw BGRA frames on stdout. Mimir reads exact frame
|
||||
boundaries and stores those frames in the normal synchronization buffers.
|
||||
The Raven listener decodes to raw BGRA frames on stdout. The Eve receivers emit
|
||||
typed JSON frame-events from EveCanvas camera/mic packets. Mimir stores all of
|
||||
them in the normal synchronization buffers.
|
||||
|
||||
## Raven Sender
|
||||
|
||||
|
|
@ -64,29 +66,28 @@ Raven sync signal: route Raven audio or a Raven-generated chirp into the
|
|||
Scarlett alongside the microphone. Mimir should treat that audio evidence as
|
||||
the authority for aligning Raven video with the rest of the program.
|
||||
|
||||
## Eve Sender Status
|
||||
## Eve Sensor Sender
|
||||
|
||||
Eve is configured as a receiver lane now, and SSH is reachable, but the actual
|
||||
camera producer is not implemented in this repo yet. The existing Eve app is a
|
||||
view/control surface for receiving Starfire video and sending touch events; it
|
||||
is not currently an AVFoundation camera broadcaster. No `ffmpeg` or obvious
|
||||
camera-capture helper is installed on the iPad path checked during setup.
|
||||
EveCanvas now starts native AVFoundation capture after permission grants:
|
||||
|
||||
Current next options:
|
||||
- Camera frames are sampled from `AVCaptureVideoDataOutput`, JPEG-compressed,
|
||||
wrapped as `video-frame` events for `eve-camera`, and sent to
|
||||
`ws://192.168.1.66:8793/eve/camera`.
|
||||
- Microphone blocks are captured with `AVAudioEngine`, packed as interleaved
|
||||
Float32 samples, wrapped as `audio-block` events for `eve-mic`, and sent to
|
||||
`ws://192.168.1.66:8794/eve/mic`.
|
||||
|
||||
- Add AVFoundation capture to Eve and send H.264 over SRT or MPEG-TS/TCP to
|
||||
Starfire. This keeps Eve as the source owner and matches the network-producer
|
||||
model, but needs the iPad online and a native sender cut.
|
||||
- Use a known iOS camera streaming app that can publish RTSP, SRT, NDI, or
|
||||
MPEG-TS, then point the `eve-camera` FFmpeg listener/receiver at that stream.
|
||||
This is fastest for a room test, but delegates camera authority to an app
|
||||
outside the Mimir/Eve codebase.
|
||||
- Capture Eve over USB/Continuity on Starfire and expose it as a local camera
|
||||
source. This is operationally simple if Windows sees the device, but Eve stops
|
||||
being a networked producer and the clock-domain model changes.
|
||||
This is an inspectable first transport, not the final high-throughput shape.
|
||||
When cadence or bandwidth becomes the bottleneck, replace the JSON/base64 event
|
||||
transport with binary packet framing or VideoToolbox H.264 while preserving the
|
||||
same source ownership and Mimir runtime sample contract.
|
||||
|
||||
The coherent default is the AVFoundation sender, because it gives Mimir one
|
||||
clean producer per physical source and leaves sync ownership explicit.
|
||||
Deploy EveCanvas after staging:
|
||||
|
||||
```powershell
|
||||
powershell -ExecutionPolicy Bypass -File E:\Projects\Eve\scripts\stage-to-eve.ps1
|
||||
ssh eve "cd /var/mobile/Projects/Eve && export THEOS=/var/theos && make package install && uiopen --bundleid org.gamecult.evecanvas"
|
||||
```
|
||||
|
||||
## Smoke Test
|
||||
|
||||
|
|
@ -99,3 +100,9 @@ dotnet run --project .\src\Mimir.BufferSmoke\Mimir.BufferSmoke.csproj -- --ffmpe
|
|||
|
||||
That smoke starts FFmpeg with `testsrc2`, decodes BGRA frames through stdout,
|
||||
and verifies the sample metadata and payload size that Mimir receives.
|
||||
|
||||
The Eve sensor receiver can be checked without launching the whole runtime:
|
||||
|
||||
```powershell
|
||||
dotnet run --project .\src\Mimir.EveSensorReceiver\Mimir.EveSensorReceiver.csproj -- --port 8793 --path /eve/camera --source-id eve-camera --type video-frame
|
||||
```
|
||||
|
|
|
|||
|
|
@ -82,12 +82,14 @@ probes can emit per-frame JSON metadata so Fensalir sees real sensor cadence in
|
|||
the rolling buffers while the direct ABI driver is being cut. It does not carry
|
||||
pixels and does not own the final six-camera hot path. Multi-camera probes are
|
||||
one process with declared accepted source ids, not one process per camera.
|
||||
The `ffmpeg-rawvideo` adapter is the live network-pixel edge for Raven/Eve
|
||||
setup: FFmpeg owns SRT receive/decode and writes exact raw frames to stdout;
|
||||
The `ffmpeg-rawvideo` adapter is the live network-pixel edge for Raven setup:
|
||||
FFmpeg owns SRT receive/decode and writes exact raw frames to stdout;
|
||||
`MimirFfmpegRawVideoStreamSource` owns frame-boundary reads, BGRA/NV12 payload
|
||||
geometry, sample descriptors, and insertion into the normal synchronization
|
||||
path. `config/mimir-runtime.raven-eve.example.json` declares `raven-display`
|
||||
on SRT port `5200` and `eve-camera` on SRT port `5201`.
|
||||
on SRT port `5200`. EveCanvas owns Eve camera/mic capture directly and sends
|
||||
typed frame-events to `Mimir.EveSensorReceiver` on WebSocket ports `8793` and
|
||||
`8794`.
|
||||
|
||||
## OBS Bridge Utility
|
||||
|
||||
|
|
@ -394,10 +396,10 @@ routed into Scarlett, so Scarlett-decoded Raven audio evidence can earn a
|
|||
`raven-sync` correction that is applied to the `raven-display` buffer. Network
|
||||
arrival timestamps remain metadata, not timing authority.
|
||||
The first operational ingest config is `config/mimir-runtime.raven-eve.example.json`:
|
||||
Raven screen capture and Eve camera capture arrive over SRT, decode to raw BGRA
|
||||
through FFmpeg, and enter the same rolling-buffer model as local sources. Eve's
|
||||
receiver lane exists; the iPad-side camera producer still needs either a native
|
||||
AVFoundation sender or an explicitly chosen external camera-streaming app.
|
||||
Raven screen capture arrives over SRT and decodes to raw BGRA through FFmpeg;
|
||||
Eve camera/mic arrive as EveCanvas-native WebSocket frame-events. All three
|
||||
enter the same rolling-buffer model as local sources. Eve's sensor authority now
|
||||
lives in EveCanvas, not an external camera-streaming app.
|
||||
`MimirPresentationControlState` now owns the Fensalir program-control intent:
|
||||
video feed visibility/solo/opacity/layer order, audio mute/solo/gain, and
|
||||
global LUT preset selection. The `Mimir Program` panel exposes those controls
|
||||
|
|
|
|||
|
|
@ -124,12 +124,13 @@ Get-Content .\state\evidence.jsonl -Tail 8
|
|||
`https://gamecult.org/livestream` and reads
|
||||
`https://streampixels.gamecult.org/mimir/live/hls/mimir.m3u8`.
|
||||
- Raven/Eve ingest now has a network-pixel receiver config:
|
||||
`config/mimir-runtime.raven-eve.example.json` starts FFmpeg-backed raw-video
|
||||
listeners for `raven-display` on SRT port `5200` and `eve-camera` on port
|
||||
`5201`. `scripts/start-raven-screen-capture-sender.ps1` launches Raven desktop
|
||||
capture with `gdigrab` plus NVENC. Eve's Mimir receiver lane exists, but the
|
||||
iPad-side camera producer is still an open cut: add native AVFoundation send
|
||||
support or deliberately choose an external iOS streaming app.
|
||||
`config/mimir-runtime.raven-eve.example.json` starts an FFmpeg-backed
|
||||
raw-video listener for `raven-display` on SRT port `5200` and Eve sensor
|
||||
frame-event receivers for `eve-camera` on WebSocket port `8793` and `eve-mic`
|
||||
on port `8794`. `scripts/start-raven-screen-capture-sender.ps1` launches
|
||||
Raven desktop capture with `gdigrab` plus NVENC. EveCanvas owns Eve camera/mic
|
||||
capture directly through AVFoundation/AVAudioEngine; no external iOS camera
|
||||
app owns that path.
|
||||
- Faust/native DSP owns hot audio alignment, separation, spatialization, and
|
||||
synchronized stems.
|
||||
- OBS receives final program surfaces; it does not own synchronization.
|
||||
|
|
|
|||
12
src/Mimir.EveSensorReceiver/Mimir.EveSensorReceiver.csproj
Normal file
12
src/Mimir.EveSensorReceiver/Mimir.EveSensorReceiver.csproj
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<AssemblyName>Mimir.EveSensorReceiver</AssemblyName>
|
||||
<RootNamespace>Mimir.EveSensorReceiver</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
280
src/Mimir.EveSensorReceiver/Program.cs
Normal file
280
src/Mimir.EveSensorReceiver/Program.cs
Normal file
|
|
@ -0,0 +1,280 @@
|
|||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
|
||||
var options = EveSensorReceiverOptions.Parse(args);
|
||||
using var receiver = new EveSensorReceiver(options);
|
||||
await receiver.RunAsync();
|
||||
|
||||
internal sealed record EveSensorReceiverOptions(
|
||||
int Port,
|
||||
string Path,
|
||||
string SourceId,
|
||||
string ExpectedType)
|
||||
{
|
||||
public static EveSensorReceiverOptions Parse(string[] args)
|
||||
{
|
||||
return new EveSensorReceiverOptions(
|
||||
ParseInt(args, "--port", 8793),
|
||||
ParseString(args, "--path", "/eve/camera"),
|
||||
ParseString(args, "--source-id", "eve-camera"),
|
||||
ParseString(args, "--type", "video-frame"));
|
||||
}
|
||||
|
||||
private static string ParseString(IReadOnlyList<string> args, string name, string fallback)
|
||||
{
|
||||
for (var index = 0; index < args.Count - 1; index++)
|
||||
{
|
||||
if (string.Equals(args[index], name, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return args[index + 1];
|
||||
}
|
||||
}
|
||||
|
||||
return fallback;
|
||||
}
|
||||
|
||||
private static int ParseInt(IReadOnlyList<string> args, string name, int fallback)
|
||||
{
|
||||
return int.TryParse(ParseString(args, name, ""), out var value) ? value : fallback;
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class EveSensorReceiver(EveSensorReceiverOptions options) : IDisposable
|
||||
{
|
||||
private readonly TcpListener listener = new(IPAddress.Any, options.Port);
|
||||
private readonly CancellationTokenSource stopping = new();
|
||||
|
||||
public async Task RunAsync()
|
||||
{
|
||||
listener.Start();
|
||||
Console.Error.WriteLine($"Eve sensor receiver listening on ws://0.0.0.0:{options.Port}{options.Path} source={options.SourceId}");
|
||||
while (!stopping.IsCancellationRequested)
|
||||
{
|
||||
var client = await listener.AcceptTcpClientAsync(stopping.Token).ConfigureAwait(false);
|
||||
_ = Task.Run(() => HandleAsync(client));
|
||||
}
|
||||
}
|
||||
|
||||
private async Task HandleAsync(TcpClient tcpClient)
|
||||
{
|
||||
await using var stream = tcpClient.GetStream();
|
||||
var request = await ReadHttpRequestAsync(stream).ConfigureAwait(false);
|
||||
if (request.Path == "/health")
|
||||
{
|
||||
var health = JsonSerializer.Serialize(new
|
||||
{
|
||||
ok = true,
|
||||
options.SourceId,
|
||||
options.ExpectedType,
|
||||
options.Path,
|
||||
});
|
||||
await WriteHttpResponseAsync(stream, "200 OK", "application/json", Encoding.UTF8.GetBytes(health)).ConfigureAwait(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!string.Equals(request.Path, options.Path, StringComparison.Ordinal)
|
||||
|| !request.Headers.TryGetValue("Sec-WebSocket-Key", out var key))
|
||||
{
|
||||
await WriteHttpResponseAsync(stream, "404 Not Found", "text/plain", Encoding.UTF8.GetBytes("not found")).ConfigureAwait(false);
|
||||
return;
|
||||
}
|
||||
|
||||
await WriteWebSocketHandshakeAsync(stream, key).ConfigureAwait(false);
|
||||
while (!stopping.IsCancellationRequested)
|
||||
{
|
||||
var frame = await ReceiveFrameAsync(stream).ConfigureAwait(false);
|
||||
if (frame.Opcode == 0x8)
|
||||
{
|
||||
await WriteCloseFrameAsync(stream).ConfigureAwait(false);
|
||||
break;
|
||||
}
|
||||
|
||||
if (frame.Opcode != 0x1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var text = Encoding.UTF8.GetString(frame.Payload);
|
||||
if (TryValidateFrameEvent(text, out var normalized))
|
||||
{
|
||||
Console.WriteLine(normalized);
|
||||
Console.Out.Flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool TryValidateFrameEvent(string text, out string normalized)
|
||||
{
|
||||
normalized = "";
|
||||
try
|
||||
{
|
||||
using var document = JsonDocument.Parse(text);
|
||||
var root = document.RootElement;
|
||||
if (!root.TryGetProperty("type", out var type)
|
||||
|| !string.Equals(type.GetString(), options.ExpectedType, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!root.TryGetProperty("sourceId", out var sourceId)
|
||||
|| !string.Equals(sourceId.GetString(), options.SourceId, StringComparison.Ordinal))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
normalized = root.GetRawText();
|
||||
return true;
|
||||
}
|
||||
catch (JsonException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task<HttpRequest> ReadHttpRequestAsync(NetworkStream stream)
|
||||
{
|
||||
var bytes = new List<byte>();
|
||||
var lastFour = new Queue<byte>(4);
|
||||
while (true)
|
||||
{
|
||||
var value = stream.ReadByte();
|
||||
if (value < 0)
|
||||
{
|
||||
throw new IOException("Client closed before HTTP headers completed.");
|
||||
}
|
||||
|
||||
var b = (byte)value;
|
||||
bytes.Add(b);
|
||||
lastFour.Enqueue(b);
|
||||
if (lastFour.Count > 4)
|
||||
{
|
||||
lastFour.Dequeue();
|
||||
}
|
||||
|
||||
if (lastFour.Count == 4 && lastFour.SequenceEqual(new byte[] { 13, 10, 13, 10 }))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var text = Encoding.ASCII.GetString(bytes.ToArray());
|
||||
var lines = text.Split("\r\n", StringSplitOptions.None);
|
||||
var first = lines[0].Split(' ');
|
||||
var headers = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
foreach (var line in lines.Skip(1))
|
||||
{
|
||||
var colon = line.IndexOf(':');
|
||||
if (colon > 0)
|
||||
{
|
||||
headers[line[..colon].Trim()] = line[(colon + 1)..].Trim();
|
||||
}
|
||||
}
|
||||
|
||||
await Task.CompletedTask.ConfigureAwait(false);
|
||||
return new HttpRequest(first.Length > 1 ? first[1] : "/", headers);
|
||||
}
|
||||
|
||||
private static async Task WriteHttpResponseAsync(NetworkStream stream, string status, string contentType, byte[] body)
|
||||
{
|
||||
var header = Encoding.ASCII.GetBytes(
|
||||
$"HTTP/1.1 {status}\r\nContent-Type: {contentType}\r\nContent-Length: {body.Length}\r\nConnection: close\r\n\r\n");
|
||||
await stream.WriteAsync(header).ConfigureAwait(false);
|
||||
await stream.WriteAsync(body).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private static async Task WriteWebSocketHandshakeAsync(NetworkStream stream, string key)
|
||||
{
|
||||
var acceptBytes = SHA1.HashData(Encoding.ASCII.GetBytes(key + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"));
|
||||
var accept = Convert.ToBase64String(acceptBytes);
|
||||
var response = Encoding.ASCII.GetBytes(
|
||||
"HTTP/1.1 101 Switching Protocols\r\n" +
|
||||
"Upgrade: websocket\r\n" +
|
||||
"Connection: Upgrade\r\n" +
|
||||
$"Sec-WebSocket-Accept: {accept}\r\n\r\n");
|
||||
await stream.WriteAsync(response).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private static async Task<WebSocketFrame> ReceiveFrameAsync(NetworkStream stream)
|
||||
{
|
||||
var header = new byte[2];
|
||||
await ReadExactAsync(stream, header).ConfigureAwait(false);
|
||||
var opcode = header[0] & 0x0f;
|
||||
var masked = (header[1] & 0x80) != 0;
|
||||
var length = header[1] & 0x7f;
|
||||
if (length == 126)
|
||||
{
|
||||
var extended = new byte[2];
|
||||
await ReadExactAsync(stream, extended).ConfigureAwait(false);
|
||||
length = (extended[0] << 8) | extended[1];
|
||||
}
|
||||
else if (length == 127)
|
||||
{
|
||||
var extended = new byte[8];
|
||||
await ReadExactAsync(stream, extended).ConfigureAwait(false);
|
||||
var longLength = 0L;
|
||||
foreach (var b in extended)
|
||||
{
|
||||
longLength = (longLength << 8) | b;
|
||||
}
|
||||
|
||||
if (longLength > int.MaxValue)
|
||||
{
|
||||
throw new InvalidDataException("WebSocket frame is too large.");
|
||||
}
|
||||
|
||||
length = (int)longLength;
|
||||
}
|
||||
|
||||
var mask = new byte[4];
|
||||
if (masked)
|
||||
{
|
||||
await ReadExactAsync(stream, mask).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
var payload = new byte[length];
|
||||
await ReadExactAsync(stream, payload).ConfigureAwait(false);
|
||||
if (masked)
|
||||
{
|
||||
for (var index = 0; index < payload.Length; index++)
|
||||
{
|
||||
payload[index] ^= mask[index % 4];
|
||||
}
|
||||
}
|
||||
|
||||
return new WebSocketFrame(opcode, payload);
|
||||
}
|
||||
|
||||
private static Task WriteCloseFrameAsync(NetworkStream stream)
|
||||
{
|
||||
return stream.WriteAsync(new byte[] { 0x88, 0x00 }).AsTask();
|
||||
}
|
||||
|
||||
private static async Task ReadExactAsync(NetworkStream stream, byte[] buffer)
|
||||
{
|
||||
var offset = 0;
|
||||
while (offset < buffer.Length)
|
||||
{
|
||||
var read = await stream.ReadAsync(buffer.AsMemory(offset, buffer.Length - offset)).ConfigureAwait(false);
|
||||
if (read == 0)
|
||||
{
|
||||
throw new IOException("WebSocket closed.");
|
||||
}
|
||||
|
||||
offset += read;
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
stopping.Cancel();
|
||||
listener.Stop();
|
||||
stopping.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed record HttpRequest(string Path, IReadOnlyDictionary<string, string> Headers);
|
||||
|
||||
internal sealed record WebSocketFrame(int Opcode, byte[] Payload);
|
||||
|
|
@ -275,6 +275,7 @@ public sealed class MimirRuntimeConfiguration
|
|||
private static string ResolveCommand(string command, string? configDirectory)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(command)
|
||||
|| (!command.Contains(Path.DirectorySeparatorChar) && !command.Contains(Path.AltDirectorySeparatorChar))
|
||||
|| Path.IsPathRooted(command)
|
||||
|| string.IsNullOrWhiteSpace(configDirectory))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -243,3 +243,5 @@
|
|||
{"ts": "2026-05-30T22:45:01+01:00", "type": "decision", "status": "ok", "note": "Added Raven/Eve ingest setup: ffmpeg-rawvideo runtime source decodes SRT feeds into Mimir video samples; raven-display listens on 5200, eve-camera on 5201; Raven desktop sender script uses gdigrab plus NVENC. Eve receiver lane exists but the iPad camera producer remains an explicit AVFoundation/external-app decision."}
|
||||
{"ts": "2026-05-30T22:46:17+01:00", "type": "verification", "status": "warn", "note": "Raven/Eve ingest host probe: Eve SSH is reachable and reports iPadOS Darwin 20.3.0, but /var/mobile/Projects/Eve only contains the receiver/control app sources and no ffmpeg/avcapture helper was found. Raven SSH with the recorded key still fails publickey authentication, so Raven screen capture is prepared as a desktop-run script until SSH authority is repaired."}
|
||||
{"ts": "2026-05-30T22:53:29+01:00", "type": "decision", "status": "ok", "note": "Leap dense geometry now has a Mimir-side point-cloud root: live Leap packed stereo lowers to R16F disparity, and Mimir declares a derived GPU FieldMesh PointList resource that plans as a Mesh backend packet. This is a typed socket only; Fensalir still owns D3D12 vertex generation, editor draw, and global residual/calibration ownership."}
|
||||
{"ts": "2026-05-30T23:05:53+01:00", "type": "implementation", "status": "ok", "note": "EveCanvas now owns Eve sensor uplink: AVFoundation camera frames are JPEG frame-events to ws://Starfire:8793/eve/camera and AVAudioEngine mic blocks are Float32 audio-block events to ws://Starfire:8794/eve/mic. Mimir.EveSensorReceiver validates those WebSocket frame-events and emits JSON lines for the existing frame-events runtime adapter; raven-eve config now wires eve-camera and eve-mic through it."}
|
||||
{"ts": "2026-05-30T23:07:16+01:00", "type": "verification", "status": "ok", "note": "Raven/Eve runtime config smoke ran for 1s with MIMIR_RUNTIME_CONFIG=config/mimir-runtime.raven-eve.example.json. It started Focusrite ASIO plus raven-display/eve-camera/eve-mic sources after fixing command resolution so bare PATH commands like ffmpeg are not resolved under config/. With no senders active, ASIO ingested 7120 samples across 4 channels and network sources remained empty as expected."}
|
||||
|
|
|
|||
|
|
@ -269,14 +269,14 @@ accepted_design:
|
|||
shared `clockDomainId`; the Raven path uses audio evidence routed into
|
||||
Scarlett to earn a `raven-sync` correction for Raven display frames.
|
||||
Network arrival timestamps remain metadata only.
|
||||
`MimirFfmpegRawVideoStreamSource` is the network-pixel adapter for the
|
||||
Raven/Eve ingest setup: FFmpeg owns SRT receive/decode, while Mimir owns
|
||||
exact raw-video frame reads, payload geometry, video descriptors, and
|
||||
rolling-buffer samples. `config/mimir-runtime.raven-eve.example.json`
|
||||
listens for `raven-display` on port 5200 and `eve-camera` on port 5201.
|
||||
`MimirFfmpegRawVideoStreamSource` is the network-pixel adapter for Raven
|
||||
ingest: FFmpeg owns SRT receive/decode, while Mimir owns exact raw-video
|
||||
frame reads, payload geometry, video descriptors, and rolling-buffer
|
||||
samples. `config/mimir-runtime.raven-eve.example.json` listens for
|
||||
`raven-display` on port 5200. EveCanvas now owns Eve camera/mic capture
|
||||
directly and sends typed frame-events to `Mimir.EveSensorReceiver` on
|
||||
WebSocket ports 8793 (`eve-camera`) and 8794 (`eve-mic`).
|
||||
Raven can send desktop capture with `scripts/start-raven-screen-capture-sender.ps1`.
|
||||
Eve's receiver lane exists, but the iPad-side camera producer still needs a
|
||||
native AVFoundation sender or a chosen external camera streaming app.
|
||||
`MimirPresentationControlState` owns program-control intent for Fensalir:
|
||||
video feed visibility/solo/opacity/layer order, audio mute/solo/gain, and
|
||||
global LUT preset selection. The `Mimir Program` panel filters video
|
||||
|
|
|
|||
Loading…
Reference in a new issue