homebridge-plugin-utils
Version:
Opinionated utilities to provide common capabilities and create rich configuration webUI experiences for Homebridge plugins.
33 lines (32 loc) • 1.51 kB
TypeScript
import { EventEmitter } from "node:events";
import { HomebridgePluginLogging } from "./util.js";
/**
* Here's the problem this class solves: FFmpeg doesn't support multiplexing RTP and RTCP data on a single UDP port (RFC 5761). If it did, we wouldn't need this
* workaround for HomeKit compatibility, which does multiplex RTP and RTCP over a single UDP port.
*
* This class inspects all packets coming in from inputPort and demultiplexes RTP and RTCP traffic to rtpPort and rtcpPort, respectively.
*
* Credit to @dgreif and @brandawg93 who graciously shared their code as a starting point, and their collaboration in answering the questions needed to bring all this
* together. A special thank you to @Sunoo for the many hours of discussion and brainstorming on this and other topics.
*/
export declare class RtpDemuxer extends EventEmitter {
private heartbeatTimer;
private heartbeatMsg;
private _isRunning;
private log?;
private inputPort;
readonly socket: import("dgram").Socket;
constructor(ipFamily: ("ipv4" | "ipv6"), inputPort: number, rtcpPort: number, rtpPort: number, log: HomebridgePluginLogging);
private heartbeat;
close(): void;
private getPayloadType;
private isRtpMessage;
get isRunning(): boolean;
}
export declare class RtpPortAllocator {
private portsInUse;
constructor();
private getPort;
reserve(ipFamily?: ("ipv4" | "ipv6"), portCount?: (1 | 2), attempts?: number): Promise<number>;
cancel(port: number): void;
}