homekit: fix reversed logic when there is no audio

This commit is contained in:
Koushik Dutta
2021-12-28 13:13:25 -08:00
parent 84ab5b9d40
commit 52ffdcd789
4 changed files with 14 additions and 10 deletions

View File

@@ -1,12 +1,12 @@
{
"name": "@scrypted/homekit",
"version": "0.0.142",
"version": "0.0.143",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@scrypted/homekit",
"version": "0.0.142",
"version": "0.0.143",
"dependencies": {
"hap-nodejs": "file:../../external/HAP-NodeJS",
"lodash": "^4.17.21",

View File

@@ -40,5 +40,5 @@
"@types/qrcode": "^1.4.1",
"@types/url-parse": "^1.4.3"
},
"version": "0.0.142"
"version": "0.0.143"
}

View File

@@ -4,11 +4,6 @@ import { getH264DecoderArgs, getH264EncoderArgs } from "../../../common/src/ffmp
const { log, systemManager, deviceManager } = sdk;
const extraEncoderArgs = [
'-b:v',
'${request.video.max_bit_rate * 2}k',
];
export const defaultObjectDetectionContactSensorTimeout = 60;
export class CameraMixin extends SettingsMixinDeviceBase<any> implements Settings {
@@ -205,8 +200,17 @@ export class CameraMixin extends SettingsMixinDeviceBase<any> implements Setting
if (key === 'h264EncoderArguments') {
const encoderArgs = getH264EncoderArgs();
const args = encoderArgs[value.toString()];
if (args)
if (args) {
// if default args were specified (ie, videotoolbox, quicksync, etc),
// expand that into args that include bitrate and rescale.
const extraEncoderArgs = [
'-b:v',
'${request.video.max_bit_rate * 2}k',
'-vf',
'scale=${request.video.width}:${request.video.height}',
];
args.push(...extraEncoderArgs);
}
const substitute = args?.join(' ');
value = substitute ? `\`${substitute}\`` : value;
}

View File

@@ -253,7 +253,7 @@ addSupportedType({
args.push(...ffmpegInput.inputArguments);
// dummy audio
if (!noAudio) {
if (noAudio) {
// create a dummy audio track if none actually exists.
// this track will only be used if no audio track is available.
// https://stackoverflow.com/questions/37862432/ffmpeg-output-silent-audio-track-if-source-has-no-audio-or-audio-is-shorter-th