fix(node-agent): inject per-port bridge format JSON into deltacast sidecar env
Capture bridge emits per-port format JSON on signal lock. Node-agent now caches these by port and injects DELTACAST_VIDEO_SIZE, DELTACAST_FRAMERATE, DELTACAST_INTERLACED into the sidecar env so capture-manager uses actual signal dimensions instead of hardcoded 1920x1080/25fps defaults.
This commit is contained in:
parent
ebeaf01a67
commit
b697d356b2
1 changed files with 20 additions and 2 deletions
|
|
@ -75,6 +75,8 @@ let _dcBridge = null; // ChildProcess | null
|
|||
let _dcSidecarCount = 0; // active deltacast sidecars on this node
|
||||
// Map containerId -> sourceType so stop() can decrement the deltacast counter.
|
||||
const _containerSourceType = new Map();
|
||||
// port -> fmt JSON from bridge stderr (inject into sidecar env)
|
||||
const _dcPortFmt = new Map();
|
||||
|
||||
function _dcBridgeRunning() {
|
||||
return _dcBridge !== null && _dcBridge.exitCode === null && _dcBridge.signalCode === null;
|
||||
|
|
@ -104,8 +106,12 @@ function startDeltacastBridge() {
|
|||
const t = line.trim();
|
||||
if (!t) continue;
|
||||
// Format JSON lines go to stdout so node-agent can log/forward them.
|
||||
if (t.startsWith('{')) console.log('[dc-bridge] ' + t);
|
||||
else console.error('[dc-bridge] ' + t);
|
||||
if (t.startsWith('{')) {
|
||||
console.log('[dc-bridge] ' + t);
|
||||
try { const f = JSON.parse(t); if (typeof f.port === 'number') _dcPortFmt.set(f.port, f); } catch (_) {}
|
||||
} else {
|
||||
console.error('[dc-bridge] ' + t);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -273,6 +279,18 @@ async function handleSidecarStart(body, res) {
|
|||
if (sourceType === 'deltacast') {
|
||||
_dcSidecarCount++;
|
||||
startDeltacastBridge();
|
||||
// Inject per-port signal format so capture-manager uses real dimensions/fps
|
||||
const _srcCfg = (env.find(e => e.startsWith('SOURCE_CONFIG=')) || '').slice(14);
|
||||
let _portNum = NaN;
|
||||
try { _portNum = JSON.parse(_srcCfg).port; } catch (_) {}
|
||||
if (Number.isFinite(_portNum) && _dcPortFmt.has(_portNum)) {
|
||||
const _fmt = _dcPortFmt.get(_portNum);
|
||||
const _fps = (_fmt.fps_den && _fmt.fps_den !== 1) ? `${_fmt.fps_num}/${_fmt.fps_den}` : String(_fmt.fps_num);
|
||||
sidecarEnv.push(`DELTACAST_VIDEO_SIZE=${_fmt.width}x${_fmt.height}`);
|
||||
sidecarEnv.push(`DELTACAST_FRAMERATE=${_fps}`);
|
||||
sidecarEnv.push(`DELTACAST_INTERLACED=${_fmt.interlaced ? '1' : '0'}`);
|
||||
console.log(`[dc-bridge] port ${_portNum} fmt: ${_fmt.width}x${_fmt.height} ${_fps} interlaced=${_fmt.interlaced}`);
|
||||
}
|
||||
}
|
||||
|
||||
let containerId;
|
||||
|
|
|
|||
Loading…
Reference in a new issue