homekit: put opus behind a setting.

This commit is contained in:
Koushik Dutta
2022-03-03 13:18:41 -08:00
parent 8a3ce5118d
commit 4ab40e7305
4 changed files with 17 additions and 6 deletions

View File

@@ -1,12 +1,12 @@
{
"name": "@scrypted/homekit",
"version": "0.0.209",
"version": "0.0.211",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@scrypted/homekit",
"version": "0.0.209",
"version": "0.0.211",
"dependencies": {
"@koush/qrcode-terminal": "^0.12.0",
"hap-nodejs": "file:../../external/HAP-NodeJS",

View File

@@ -39,5 +39,5 @@
"@types/node": "^14.17.9",
"@types/url-parse": "^1.4.3"
},
"version": "0.0.209"
"version": "0.0.211"
}

View File

@@ -109,6 +109,14 @@ class HomeKit extends ScryptedDeviceBase implements MixinProvider, Settings, Hom
multiple: true,
combobox: true,
},
{
key: 'forceOpus',
group: 'Performance',
title: 'Force Opus Audio Codec',
description: 'Adding or resetting a camera accessory will force HomeKit to use the Opus Audio codec rather than AAC-ELD.',
type: 'boolean',
value: this.storage.getItem('forceOpus') !== 'false',
}
]
}

View File

@@ -32,10 +32,13 @@ addSupportedType({
const codecs: AudioStreamingCodec[] = [];
// homekit seems to prefer AAC_ELD if it is offered.
// so forcing opus must be done by not offering AAC_ELD.
for (const type of [
const enabledAudioCodecTypes = [
AudioStreamingCodecType.OPUS,
// AudioStreamingCodecType.AAC_ELD,
]) {
];
if (homekitSession.storage.getItem('forceOpus') !== 'true') {
enabledAudioCodecTypes.push(AudioStreamingCodecType.AAC_ELD);
}
for (const type of enabledAudioCodecTypes) {
// force 24k, because various parts of the pipeline make that assumption.
// off the top of my head:
// 1) opus rtp timestamp mangling assumes 24k for the interval of 480