Skip to content

Commit

Permalink
videoanalysis: fix snapshot hangs caused by HOL jpeg
Browse files Browse the repository at this point in the history
  • Loading branch information
koush committed Apr 17, 2023
1 parent b9eb74d commit ace7720
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions plugins/objectdetector/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -415,16 +415,21 @@ class ObjectDetectionMixin extends SettingsMixinDeviceBase<VideoCamera & Camera

if (detected.detected.detectionId) {
updatePipelineStatus('creating jpeg');
const jpeg = await detected.videoFrame.toBuffer({
// const start = Date.now();
const vf = await sdk.connectRPCObject(detected.videoFrame);
const jpeg = await vf.toBuffer({
format: 'jpg',
});
updatePipelineStatus('converting jpeg');
const mo = await sdk.mediaManager.createMediaObject(jpeg, 'image/jpeg');
// this.console.log('retain took', Date.now() -start);
this.setDetection(detected.detected, mo);
// this.console.log('image saved', detected.detected.detections);
}
this.reportObjectDetections(detected.detected);
if (this.hasMotionType) {
// const diff = Date.now() - when;
// when = Date.now();
// this.console.log('sleper', diff);
await sleep(250);
}
updatePipelineStatus('waiting result');
Expand Down

0 comments on commit ace7720

Please sign in to comment.