mirror of
https://github.com/koush/scrypted.git
synced 2026-02-03 06:03:27 +00:00
cameras: dont run configuration in parallel due to race conditions in camera side
This commit is contained in:
@@ -104,8 +104,18 @@ export async function autoconfigureCodecs(
|
||||
// get the fps of 20 or highest available
|
||||
let fps = Math.min(20, Math.max(...l.video.fpsRange));
|
||||
|
||||
const waiting: Promise<MediaStreamConfiguration>[] = [];
|
||||
const confLow = configureCodecs({
|
||||
let errors = '';
|
||||
|
||||
const logConfigureCodecs = async (config: MediaStreamConfiguration) => {
|
||||
try {
|
||||
await configureCodecs(config);
|
||||
}
|
||||
catch (e) {
|
||||
errors += e;
|
||||
}
|
||||
}
|
||||
|
||||
await logConfigureCodecs({
|
||||
id: l.id,
|
||||
video: {
|
||||
width: resolution[0],
|
||||
@@ -120,7 +130,6 @@ export async function autoconfigureCodecs(
|
||||
},
|
||||
audio: audioOptions,
|
||||
});
|
||||
waiting.push(confLow);
|
||||
|
||||
if (used.length === 3) {
|
||||
// find remote and low
|
||||
@@ -131,7 +140,7 @@ export async function autoconfigureCodecs(
|
||||
const lResolution = findResolutionTarget(l, 640, 360);
|
||||
|
||||
fps = Math.min(20, Math.max(...r.video.fpsRange));
|
||||
const confRemote = configureCodecs({
|
||||
await logConfigureCodecs({
|
||||
id: r.id,
|
||||
video: {
|
||||
width: rResolution[0],
|
||||
@@ -146,10 +155,9 @@ export async function autoconfigureCodecs(
|
||||
},
|
||||
audio: audioOptions,
|
||||
});
|
||||
waiting.push(confRemote);
|
||||
|
||||
fps = Math.min(20, Math.max(...l.video.fpsRange));
|
||||
const confLow = configureCodecs({
|
||||
await logConfigureCodecs({
|
||||
id: l.id,
|
||||
video: {
|
||||
width: lResolution[0],
|
||||
@@ -164,8 +172,6 @@ export async function autoconfigureCodecs(
|
||||
},
|
||||
audio: audioOptions,
|
||||
});
|
||||
|
||||
waiting.push(confLow);
|
||||
}
|
||||
else if (used.length == 2) {
|
||||
let target: [number, number];
|
||||
@@ -191,23 +197,11 @@ export async function autoconfigureCodecs(
|
||||
},
|
||||
audio: audioOptions,
|
||||
});
|
||||
|
||||
waiting.push(confRemote);
|
||||
}
|
||||
else if (used.length === 1) {
|
||||
// no nop
|
||||
}
|
||||
|
||||
const waited = await Promise.allSettled(waiting);
|
||||
|
||||
let errors = '';
|
||||
for (const w of waited) {
|
||||
if (w.status === 'rejected') {
|
||||
console.error(w.reason?.message);
|
||||
errors += w.reason?.message + '\n';
|
||||
}
|
||||
}
|
||||
|
||||
if (errors)
|
||||
throw new Error(errors);
|
||||
}
|
||||
|
||||
4
plugins/amcrest/package-lock.json
generated
4
plugins/amcrest/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/amcrest",
|
||||
"version": "0.0.156",
|
||||
"version": "0.0.158",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/amcrest",
|
||||
"version": "0.0.156",
|
||||
"version": "0.0.158",
|
||||
"license": "Apache",
|
||||
"dependencies": {
|
||||
"@scrypted/common": "file:../../common",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@scrypted/amcrest",
|
||||
"version": "0.0.156",
|
||||
"version": "0.0.158",
|
||||
"description": "Amcrest Plugin for Scrypted",
|
||||
"author": "Scrypted",
|
||||
"license": "Apache",
|
||||
|
||||
4
plugins/hikvision/package-lock.json
generated
4
plugins/hikvision/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/hikvision",
|
||||
"version": "0.0.154",
|
||||
"version": "0.0.155",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/hikvision",
|
||||
"version": "0.0.154",
|
||||
"version": "0.0.155",
|
||||
"license": "Apache",
|
||||
"dependencies": {
|
||||
"@scrypted/common": "file:../../common",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@scrypted/hikvision",
|
||||
"version": "0.0.154",
|
||||
"version": "0.0.155",
|
||||
"description": "Hikvision Plugin for Scrypted",
|
||||
"author": "Scrypted",
|
||||
"license": "Apache",
|
||||
|
||||
4
plugins/onvif/package-lock.json
generated
4
plugins/onvif/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/onvif",
|
||||
"version": "0.1.18",
|
||||
"version": "0.1.19",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/onvif",
|
||||
"version": "0.1.18",
|
||||
"version": "0.1.19",
|
||||
"license": "Apache",
|
||||
"dependencies": {
|
||||
"@scrypted/common": "file:../../common",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@scrypted/onvif",
|
||||
"version": "0.1.18",
|
||||
"version": "0.1.19",
|
||||
"description": "ONVIF Camera Plugin for Scrypted",
|
||||
"author": "Scrypted",
|
||||
"license": "Apache",
|
||||
|
||||
Reference in New Issue
Block a user