Files
Johanness d677b654f0 fix: non-blocking grain timing — use mxlGetNsUntilIndex instead of mxlSleepUntil
mxlSleepUntil blocks the entire thread including LWS poll, causing the
control server to become unresponsive and grains to be missed. Instead,
check mxlGetNsUntilIndex and skip process() if the grain isn't due yet
(>2ms away). The node loop spins with poll(1) keeping LWS responsive,
and only attempts a grain read when it's nearly due.
2026-05-26 22:51:57 +03:00

52 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
set -e
ENGINE_PORT=${ENGINE_PORT:-9000}
MXL_DOMAIN=${MXL_DOMAIN:-/tmp/dmf-mxl}
FLOW_ID=${FLOW_ID:-a0000001-0000-0000-0000-000000000001}
BASE_URL="http://127.0.0.1:${ENGINE_PORT}"
log() { echo "=== $1 ==="; }
log "Adding passthrough node"
curl -s -X POST "${BASE_URL}/api/graph/nodes" \
-H "Content-Type: application/json" \
-d '{"type":"passthrough","id":"pass1"}' | python3 -m json.tool 2>/dev/null || echo ""
log "Starting graph"
curl -s -X POST "${BASE_URL}/api/graph/start" | python3 -m json.tool 2>/dev/null || echo ""
sleep 1
log "Connecting input to flow ${FLOW_ID}"
curl -s -X POST "${BASE_URL}/api/graph/nodes/pass1/connect-input" \
-H "Content-Type: application/json" \
-d "{\"port_id\":\"video_in\",\"flow_id\":\"${FLOW_ID}\"}" | python3 -m json.tool 2>/dev/null || echo ""
log "Connecting output (creates new MXL flow)"
OUTPUT=$(curl -s -X POST "${BASE_URL}/api/graph/nodes/pass1/connect-output" \
-H "Content-Type: application/json" \
-d '{"port_id":"video_out"}')
echo "$OUTPUT" | python3 -m json.tool 2>/dev/null || echo "$OUTPUT"
OUTPUT_FLOW_ID=$(echo "$OUTPUT" | python3 -c "import sys,json; print(json.load(sys.stdin)['flow_id'])" 2>/dev/null)
if [ -n "$OUTPUT_FLOW_ID" ]; then
log "Output flow ID: ${OUTPUT_FLOW_ID}"
log "To verify with mxl-gst-sink:"
echo " mxl-gst-sink -d ${MXL_DOMAIN} -v ${OUTPUT_FLOW_ID}"
fi
sleep 3
log "Checking MXL domain"
mxl-info --domain "${MXL_DOMAIN}" 2>/dev/null || true
log "Sending status command"
curl -s -X POST "${BASE_URL}/api/graph/nodes/pass1/command" \
-H "Content-Type: application/json" \
-d '{"cmd":"status"}' | python3 -m json.tool 2>/dev/null || echo ""
log "Graph state"
curl -s "${BASE_URL}/api/graph" | python3 -m json.tool 2>/dev/null || echo ""