Claude: Phase 2 button
This commit is contained in:
@@ -29,7 +29,7 @@ function readJpegWidth(buf) {
|
||||
// GET /api/snapshot/cam0/hires → 1280×960 JPEG via cam0_hires (Phase 2)
|
||||
function createSnapshotRouter(go2rtcUrl) {
|
||||
const router = express.Router();
|
||||
let hiresLock = false; // Mutex: nie zwei Hi-Res-Grabs gleichzeitig
|
||||
const hiresLocks = {}; // Mutex pro Kamera: { cam0: false, cam1: false, … }
|
||||
|
||||
// ── PHASE 1: Geräte-Freigabe messen (rein LESEND, kein Grab) ────────────────
|
||||
// Linchpin-Test aus doc/05_screenShot_roadmap.md: Gibt go2rtc das Gerät frei,
|
||||
@@ -118,10 +118,10 @@ function createSnapshotRouter(go2rtcUrl) {
|
||||
const { id } = req.params;
|
||||
const hiresId = `${id}_hires`;
|
||||
|
||||
if (hiresLock) {
|
||||
return res.status(429).json({ error: 'Hi-Res-Grab läuft bereits – bitte warten' });
|
||||
if (hiresLocks[id]) {
|
||||
return res.status(429).json({ error: `Hi-Res-Grab für ${id} läuft bereits – bitte warten` });
|
||||
}
|
||||
hiresLock = true;
|
||||
hiresLocks[id] = true;
|
||||
const t0 = Date.now();
|
||||
|
||||
try {
|
||||
@@ -206,7 +206,7 @@ function createSnapshotRouter(go2rtcUrl) {
|
||||
} catch (err) {
|
||||
if (!res.headersSent) res.status(503).json({ error: `hires: ${err.message}` });
|
||||
} finally {
|
||||
hiresLock = false;
|
||||
hiresLocks[id] = false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user