mirror of
https://github.com/koush/scrypted.git
synced 2026-05-04 21:30:30 +01:00
videoanalysis: stream watchdog
This commit is contained in:
4
plugins/objectdetector/package-lock.json
generated
4
plugins/objectdetector/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/objectdetector",
|
||||
"version": "0.0.40",
|
||||
"version": "0.0.41",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/objectdetector",
|
||||
"version": "0.0.40",
|
||||
"version": "0.0.41",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@scrypted/common": "file:../../common",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@scrypted/objectdetector",
|
||||
"version": "0.0.40",
|
||||
"version": "0.0.41",
|
||||
"description": "Scrypted Video Analysis Plugin. Installed alongside a detection service like OpenCV or TensorFlow.",
|
||||
"author": "Scrypted",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -236,6 +236,7 @@ class ObjectDetectionMixin extends SettingsMixinDeviceBase<VideoCamera & Camera
|
||||
this.running = session.running;
|
||||
}
|
||||
catch (e) {
|
||||
this.console.log('failure retrieving stream', e);
|
||||
this.running = false;
|
||||
}
|
||||
}
|
||||
|
||||
4
plugins/opencv/package-lock.json
generated
4
plugins/opencv/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/opencv",
|
||||
"version": "0.0.36",
|
||||
"version": "0.0.37",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/opencv",
|
||||
"version": "0.0.36",
|
||||
"version": "0.0.37",
|
||||
"devDependencies": {
|
||||
"@scrypted/sdk": "file:../../sdk"
|
||||
}
|
||||
|
||||
@@ -30,5 +30,5 @@
|
||||
"devDependencies": {
|
||||
"@scrypted/sdk": "file:../../sdk"
|
||||
},
|
||||
"version": "0.0.36"
|
||||
"version": "0.0.37"
|
||||
}
|
||||
|
||||
4
plugins/tensorflow-lite/package-lock.json
generated
4
plugins/tensorflow-lite/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/tensorflow-lite",
|
||||
"version": "0.0.30",
|
||||
"version": "0.0.31",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/tensorflow-lite",
|
||||
"version": "0.0.30",
|
||||
"version": "0.0.31",
|
||||
"devDependencies": {
|
||||
"@scrypted/sdk": "file:../../sdk"
|
||||
}
|
||||
|
||||
@@ -37,5 +37,5 @@
|
||||
"devDependencies": {
|
||||
"@scrypted/sdk": "file:../../sdk"
|
||||
},
|
||||
"version": "0.0.30"
|
||||
"version": "0.0.31"
|
||||
}
|
||||
|
||||
@@ -93,6 +93,7 @@ class DetectionSession:
|
||||
self.attached = False
|
||||
self.mutex = multiprocessing.Lock()
|
||||
self.valve: PipelineValve = None
|
||||
self.last_sample = time.time()
|
||||
|
||||
def clearTimeoutLocked(self):
|
||||
if self.timerHandle:
|
||||
@@ -210,6 +211,10 @@ class DetectPlugin(scrypted_sdk.ScryptedDeviceBase, ObjectDetection):
|
||||
detection_session.future.add_done_callback(
|
||||
lambda _: self.end_session(detection_session))
|
||||
|
||||
if detection_session and time.time() - detection_session.last_sample > 30:
|
||||
print('detection session has not received a sample in 30 seconds, terminating', detection_session.id)
|
||||
ending = True
|
||||
|
||||
if ending:
|
||||
if detection_session:
|
||||
self.end_session(detection_session)
|
||||
@@ -303,6 +308,8 @@ class DetectPlugin(scrypted_sdk.ScryptedDeviceBase, ObjectDetection):
|
||||
first_frame = True
|
||||
def user_callback(gst_sample, src_size, convert_to_src_size):
|
||||
try:
|
||||
detection_session.last_sample = time.time()
|
||||
|
||||
nonlocal first_frame
|
||||
if first_frame:
|
||||
first_frame = False
|
||||
|
||||
Reference in New Issue
Block a user