mirror of
https://github.com/koush/scrypted.git
synced 2026-09-17 17:20:39 +01:00
google-device-access: nre fix
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
|
||||
{
|
||||
"scrypted.debugHost": "127.0.0.1",
|
||||
"scrypted.debugHost": "192.168.2.119",
|
||||
}
|
||||
4
plugins/google-device-access/package-lock.json
generated
4
plugins/google-device-access/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/google-device-access",
|
||||
"version": "0.0.45",
|
||||
"version": "0.0.52",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/google-device-access",
|
||||
"version": "0.0.45",
|
||||
"version": "0.0.52",
|
||||
"dependencies": {
|
||||
"@googleapis/smartdevicemanagement": "^0.2.0",
|
||||
"axios": "^0.21.1",
|
||||
|
||||
@@ -43,5 +43,5 @@
|
||||
"@types/node": "^14.17.11",
|
||||
"@types/url-parse": "^1.4.3"
|
||||
},
|
||||
"version": "0.0.45"
|
||||
"version": "0.0.52"
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ class NestCamera extends ScryptedDeviceBase implements VideoCamera, MotionSensor
|
||||
this.console.log(result.data);
|
||||
const expirationDate = new Date(expiresAt);
|
||||
const refreshAt = expirationDate.getTime();
|
||||
|
||||
|
||||
return mediaManager.createFFmpegMediaObject({
|
||||
url: u,
|
||||
mediaStreamOptions: {
|
||||
@@ -347,7 +347,7 @@ class GoogleSmartDeviceAccess extends ScryptedDeviceBase implements OauthClient,
|
||||
const traits = payload.resourceUpdate?.traits;
|
||||
const events = payload.resourceUpdate?.events;
|
||||
|
||||
const nativeId = payload.resourceUpdate.name.split('/').pop();
|
||||
const nativeId = payload.resourceUpdate?.name.split('/').pop();
|
||||
const device = this.devices.get(nativeId);
|
||||
if (device) {
|
||||
if (traits) {
|
||||
|
||||
4
plugins/homekit/package-lock.json
generated
4
plugins/homekit/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/homekit",
|
||||
"version": "0.0.160",
|
||||
"version": "0.0.161",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/homekit",
|
||||
"version": "0.0.160",
|
||||
"version": "0.0.161",
|
||||
"dependencies": {
|
||||
"hap-nodejs": "file:../../external/HAP-NodeJS",
|
||||
"lodash": "^4.17.21",
|
||||
|
||||
@@ -40,5 +40,5 @@
|
||||
"@types/qrcode": "^1.4.1",
|
||||
"@types/url-parse": "^1.4.3"
|
||||
},
|
||||
"version": "0.0.160"
|
||||
"version": "0.0.161"
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import { CharacteristicEventTypes, DataStreamConnection, Service, WithUUID } fro
|
||||
import { RecordingManagement } from 'hap-nodejs/src/lib/camera';
|
||||
import { defaultObjectDetectionContactSensorTimeout } from '../camera-mixin';
|
||||
import os from 'os';
|
||||
import { levelToFfmpeg, profileToFfmpeg } from './camera/camera-utils';
|
||||
|
||||
const { log, mediaManager, deviceManager, systemManager } = sdk;
|
||||
|
||||
@@ -225,7 +226,7 @@ addSupportedType({
|
||||
|
||||
|
||||
const videomtu = request.video.mtu;
|
||||
// seems fine? no idea what to use here. this is the mtu for sending audio to homekit.
|
||||
// 400 seems fine? no idea what to use here. this is the mtu for sending audio to homekit.
|
||||
// from my observation of talkback packets, the max packet size is ~370, so
|
||||
// I'm just guessing that HomeKit wants something similar for the audio it receives.
|
||||
// going higher causes choppiness. going lower may cause other issues.
|
||||
@@ -282,6 +283,8 @@ addSupportedType({
|
||||
'-pix_fmt', 'yuv420p',
|
||||
'-color_range', 'mpeg',
|
||||
"-bf", "0",
|
||||
"-profile:v", profileToFfmpeg(request.video.profile),
|
||||
'-level:v', levelToFfmpeg(request.video.level),
|
||||
"-b:v", request.video.max_bit_rate.toString() + "k",
|
||||
"-bufsize", (2 * request.video.max_bit_rate).toString() + "k",
|
||||
"-maxrate", request.video.max_bit_rate.toString() + "k",
|
||||
|
||||
@@ -9,6 +9,7 @@ import { AudioRecordingCodecType, AudioRecordingSamplerateValues, CameraRecordin
|
||||
import { FFMpegFragmentedMP4Session, startFFMPegFragmetedMP4Session } from '@scrypted/common/src/ffmpeg-mp4-parser-session';
|
||||
import { evalRequest } from './camera-transcode';
|
||||
import { parseFragmentedMP4 } from '@scrypted/common/src/stream-parser';
|
||||
import { levelToFfmpeg, profileToFfmpeg } from './camera-utils';
|
||||
|
||||
const { log, mediaManager, deviceManager } = sdk;
|
||||
|
||||
@@ -109,19 +110,13 @@ export async function* handleFragmentsRequests(device: ScryptedDevice & VideoCam
|
||||
];
|
||||
}
|
||||
|
||||
const profile = configuration.videoCodec.profile === H264Profile.HIGH ? 'high'
|
||||
: configuration.videoCodec.profile === H264Profile.MAIN ? 'main' : 'baseline';
|
||||
|
||||
const level = configuration.videoCodec.level === H264Level.LEVEL4_0 ? '4.0'
|
||||
: configuration.videoCodec.level === H264Level.LEVEL3_2 ? '3.2' : '3.1';
|
||||
|
||||
let videoArgs: string[];
|
||||
if (transcodeRecording) {
|
||||
const h264EncoderArguments = storage.getItem('h264EncoderArguments') || '';
|
||||
videoArgs = h264EncoderArguments
|
||||
? evalRequest(h264EncoderArguments, request) : [
|
||||
'-profile:v', profile,
|
||||
'-level:v', level,
|
||||
"-profile:v", profileToFfmpeg(request.video.profile),
|
||||
'-level:v', levelToFfmpeg(request.video.level),
|
||||
'-b:v', `${configuration.videoCodec.bitrate}k`,
|
||||
'-force_key_frames', `expr:gte(t,n_forced*${iframeIntervalSeconds})`,
|
||||
'-r', configuration.videoCodec.resolution[2].toString(),
|
||||
|
||||
17
plugins/homekit/src/types/camera/camera-utils.ts
Normal file
17
plugins/homekit/src/types/camera/camera-utils.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { H264Profile, H264Level } from "../../hap";
|
||||
|
||||
export function profileToFfmpeg(profile: H264Profile): string {
|
||||
if (profile === H264Profile.HIGH)
|
||||
return "high";
|
||||
if (profile === H264Profile.MAIN)
|
||||
return "main";
|
||||
return "baseline";
|
||||
}
|
||||
|
||||
export function levelToFfmpeg(level: H264Level): string {
|
||||
if (level === H264Level.LEVEL4_0)
|
||||
return '4.0';
|
||||
if (level === H264Level.LEVEL3_2)
|
||||
return '3.2';
|
||||
return '3.1';
|
||||
}
|
||||
Reference in New Issue
Block a user