Wire reconciler and ingest into video node

Each ingest stream gets two reconciler resources (device, transport) with
dependencies: transport waits for device OPEN (needs format for STREAM_OPEN),
device waits for transport CONNECTED before starting capture.

START_INGEST sets wanted state and triggers a tick; the reconciler drives
device CLOSED→OPEN→STREAMING and transport DISCONNECTED→CONNECTED over
subsequent ticks. STOP_INGEST reverses both.

External events (transport drop, ingest thread error) use
reconciler_force_current to push state backward; the periodic 500ms timer
thread re-drives toward wanted state automatically.

All 8 stream slots are pre-allocated at startup. on_ingest_frame sends
VIDEO_FRAME messages over the outbound transport connection, protected by
a per-stream conn_mutex.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-29 02:17:16 +00:00
parent 6c9e0ce7dc
commit 6747c9e00d
4 changed files with 582 additions and 178 deletions

View File

@@ -85,6 +85,15 @@ void reconciler_add_dep(
int dep_min_state);
void reconciler_set_wanted(struct Rec_Resource *r, int wanted_state);
/*
* Force current state without executing a transition.
* Use when an external event pushes a resource into a new state —
* e.g. a transport connection drops unexpectedly, or a device error
* causes the capture thread to exit. The reconciler will drive back
* toward wanted state on the next tick.
*/
void reconciler_force_current(struct Rec_Resource *r, int state);
int reconciler_get_current(const struct Rec_Resource *r);
int reconciler_get_wanted(const struct Rec_Resource *r);
const char *reconciler_get_name(const struct Rec_Resource *r);