homebridge-unifi-protect
Version:
Homebridge UniFi Protect plugin providing complete HomeKit integration for the entire UniFi Protect ecosystem with full support for most features including HomeKit Secure Video, multiple controllers, blazing fast performance, and much more.
16 lines • 1.71 kB
JavaScript
import { AudioStreamingSamplerate } from "homebridge-plugin-utils";
// True when current reports a frozen audio capability that built lacked - the additive-eager, subtractive-conservative rising edge over an audio-options identity. A
// capability appearing (false to true) warrants an in-place controller rebuild; a capability reading false (a transient incomplete-bootstrap drain, a settled demotion)
// never does, so the symmetric "the identities differ" comparison - which would rebuild on the all-false reconnect drain - is deliberately not what this expresses.
export function audioCapabilityAppeared(built, current) {
return (current.isDoorbell && !built.isDoorbell) || (current.twoWayAudio && !built.twoWayAudio);
}
// The streaming audio sample rates a camera advertises to HomeKit. This condition deliberately encodes TWO wire facts, so it does not defer to livestreamAudioSampleRate:
// on the fMP4 livestream a doorbell delivers 48 kHz and every other camera 16 kHz (the half livestreamAudioSampleRate owns), while a camera streamed directly over RTSP
// (buffer-backed livestreaming off, or a camera not capable of it) delivers a 48 kHz source regardless of type. Both 48 kHz sources exceed what HomeKit supports; since
// 16 and 24 kHz each divide 48 cleanly, we advertise both and let HomeKit choose. A buffer-backed camera's livestream delivers 16 kHz, so it advertises just that. A pure
// helper, red-green testable per population.
export function streamingSamplerates(input) {
return (input.isDoorbell || !input.usesTimeshiftLivestream) ? [AudioStreamingSamplerate.KHZ_16, AudioStreamingSamplerate.KHZ_24] : AudioStreamingSamplerate.KHZ_16;
}
//# sourceMappingURL=stream-delegate.js.map