mirror of
https://github.com/koush/scrypted.git
synced 2026-09-19 10:10:39 +01:00
rebroadcast: various memory fixes and process observations.
This commit is contained in:
4
plugins/prebuffer-mixin/package-lock.json
generated
4
plugins/prebuffer-mixin/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/prebuffer-mixin",
|
||||
"version": "0.1.51",
|
||||
"version": "0.1.52",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/prebuffer-mixin",
|
||||
"version": "0.1.51",
|
||||
"version": "0.1.52",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@scrypted/common": "file:../../common",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@scrypted/prebuffer-mixin",
|
||||
"version": "0.1.51",
|
||||
"version": "0.1.52",
|
||||
"description": "Rebroadcast and Prebuffer for VideoCameras.",
|
||||
"author": "Scrypted",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -209,6 +209,16 @@ class PrebufferMixin extends SettingsMixinDeviceBase<VideoCamera> implements Vid
|
||||
});
|
||||
}
|
||||
|
||||
let watchdog: NodeJS.Timeout;
|
||||
session.events.on('mp4-data', () => {
|
||||
clearTimeout(watchdog);
|
||||
setTimeout(() => {
|
||||
this.console.error('watchdog for mp4 parser timed out... killing ffmpeg session');
|
||||
session.kill();
|
||||
}, 30000);
|
||||
})
|
||||
session.events.once('killed', () => clearTimeout(watchdog));
|
||||
|
||||
return session;
|
||||
}
|
||||
|
||||
|
||||
4
plugins/unifi-protect/package-lock.json
generated
4
plugins/unifi-protect/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/unifi-protect",
|
||||
"version": "0.0.38",
|
||||
"version": "0.0.39",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/unifi-protect",
|
||||
"version": "0.0.38",
|
||||
"version": "0.0.39",
|
||||
"license": "Apache",
|
||||
"dependencies": {
|
||||
"@types/ws": "^7.4.7",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@scrypted/unifi-protect",
|
||||
"version": "0.0.38",
|
||||
"version": "0.0.39",
|
||||
"description": "Unifi Protect Plugin for Scrypted",
|
||||
"author": "Scrypted",
|
||||
"license": "Apache",
|
||||
|
||||
@@ -31,6 +31,10 @@ class UnifiCamera extends ScryptedDeviceBase implements Camera, VideoCamera, Mot
|
||||
}
|
||||
}
|
||||
|
||||
async getObjectTypes(): Promise<string[]> {
|
||||
return this.findCamera().featureFlags.smartDetectTypes;
|
||||
}
|
||||
|
||||
async getDetectionInput(detectionId: any): Promise<MediaObject> {
|
||||
const data = this.detections.get(detectionId);
|
||||
if (!data)
|
||||
@@ -95,7 +99,6 @@ class UnifiCamera extends ScryptedDeviceBase implements Camera, VideoCamera, Mot
|
||||
const rtspChannels = camera.channels.filter(channel => channel.isRtspEnabled && this.isChannelEnabled(channel));
|
||||
|
||||
const rtspChannel = camera.channels.find(channel => channel.id === options?.id) || rtspChannels[0];
|
||||
this.console.log('serving rtsp channel', rtspChannel);
|
||||
|
||||
const { rtspAlias } = rtspChannel;
|
||||
const u = `rtsp://${this.protect.getSetting('ip')}:7447/${rtspAlias}`
|
||||
@@ -288,6 +291,8 @@ class UnifiProtect extends ScryptedDeviceBase implements Settings, DeviceProvide
|
||||
}
|
||||
|
||||
const detectionId = Math.random().toString();
|
||||
const camera = rtsp.findCamera();
|
||||
const snapshotChannel = camera.channels[0];
|
||||
|
||||
const detection: ObjectDetection = {
|
||||
detectionId,
|
||||
@@ -295,13 +300,14 @@ class UnifiProtect extends ScryptedDeviceBase implements Settings, DeviceProvide
|
||||
detections: payload.smartDetectTypes.map(type => ({
|
||||
className: type,
|
||||
score: payload.score,
|
||||
}))
|
||||
})),
|
||||
inputDimensions: [snapshotChannel.width, snapshotChannel.height],
|
||||
};
|
||||
|
||||
rtsp.onDeviceEvent(ScryptedInterface.ObjectDetector, detection);
|
||||
const snapshot = rtsp.getSnapshot();
|
||||
rtsp.detections.set(detectionId, snapshot);
|
||||
setTimeout(() => rtsp.detections.delete(detectionId), 30000);
|
||||
rtsp.onDeviceEvent(ScryptedInterface.ObjectDetector, detection);
|
||||
|
||||
rtsp.lastSeen = payload.start;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user