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

@@ -10,8 +10,10 @@ SERIAL_OBJ = $(BUILD)/serial/serial.o
TRANSPORT_OBJ = $(BUILD)/transport/transport.o
DISCOVERY_OBJ = $(BUILD)/discovery/discovery.o
CONFIG_OBJ = $(BUILD)/config/config.o
PROTOCOL_OBJ = $(BUILD)/protocol/protocol.o
XORG_OBJ = $(BUILD)/xorg/xorg.o
PROTOCOL_OBJ = $(BUILD)/protocol/protocol.o
RECONCILER_OBJ = $(BUILD)/reconciler/reconciler.o
INGEST_OBJ = $(BUILD)/ingest/ingest.o
XORG_OBJ = $(BUILD)/xorg/xorg.o
.PHONY: all clean
@@ -20,7 +22,7 @@ all: $(NODE_BUILD)/video-node
$(NODE_BUILD)/video-node: $(MAIN_OBJ) \
$(COMMON_OBJ) $(MEDIA_OBJ) $(V4L2_OBJ) $(SERIAL_OBJ) \
$(TRANSPORT_OBJ) $(DISCOVERY_OBJ) $(CONFIG_OBJ) $(PROTOCOL_OBJ) \
$(XORG_OBJ)
$(RECONCILER_OBJ) $(INGEST_OBJ) $(XORG_OBJ)
$(CC) $(CFLAGS) -o $@ $^ -lpthread $(PKG_LDFLAGS)
$(MAIN_OBJ): main.c | $(NODE_BUILD)
@@ -33,8 +35,10 @@ $(SERIAL_OBJ): ; $(MAKE) -C $(ROOT)/src/modules/serial
$(TRANSPORT_OBJ): ; $(MAKE) -C $(ROOT)/src/modules/transport
$(DISCOVERY_OBJ): ; $(MAKE) -C $(ROOT)/src/modules/discovery
$(CONFIG_OBJ): ; $(MAKE) -C $(ROOT)/src/modules/config
$(PROTOCOL_OBJ): ; $(MAKE) -C $(ROOT)/src/modules/protocol
$(XORG_OBJ): ; $(MAKE) -C $(ROOT)/src/modules/xorg
$(PROTOCOL_OBJ): ; $(MAKE) -C $(ROOT)/src/modules/protocol
$(RECONCILER_OBJ): ; $(MAKE) -C $(ROOT)/src/modules/reconciler
$(INGEST_OBJ): ; $(MAKE) -C $(ROOT)/src/modules/ingest
$(XORG_OBJ): ; $(MAKE) -C $(ROOT)/src/modules/xorg
$(NODE_BUILD):
mkdir -p $@