Successful stream stress test
Need to add stream watchdog timer and accessory timeout timer
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { Rtsp } from "rtsp-stream/lib";
|
||||
import { Rtsp, IStreamEventArgs } from "../src/rtsp/rtsp";
|
||||
import { nets } from "@vladmandic/face-api";
|
||||
import * as faceapi from "@vladmandic/face-api";
|
||||
import canvas from "canvas";
|
||||
@ -37,10 +37,10 @@ const main = async () => {
|
||||
const content = JSON.parse(raw);
|
||||
const matcher = faceapi.FaceMatcher.fromJSON(content);
|
||||
|
||||
rtsp.on("data", async (data: Buffer) => {
|
||||
const input = ((await canvas.loadImage(data)) as unknown) as ImageData;
|
||||
rtsp.dataEvent.push(async (sender: Rtsp, args: IStreamEventArgs) => {
|
||||
const input = ((await canvas.loadImage(args.data)) as unknown) as ImageData;
|
||||
const out = faceapi.createCanvasFromMedia(input);
|
||||
await saveFile("image.jpg", data);
|
||||
await saveFile(process.env.OUT_DIR as string, "image.jpg", args.data);
|
||||
const resultsQuery = await faceapi
|
||||
.detectAllFaces(out, getFaceDetectorOptions(faceDetectionNet))
|
||||
.withFaceLandmarks()
|
||||
@ -52,10 +52,6 @@ const main = async () => {
|
||||
}
|
||||
});
|
||||
|
||||
rtsp.on("error", (err) => {
|
||||
// console.log(err);
|
||||
});
|
||||
|
||||
rtsp.start();
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user