UNPKG

rtp.js

Version:

RTP stack for Node.js and browser written in TypeScript

112 lines 2.9 kB
import { Packet } from '../Packet'; import type { PacketDump } from '../Packet'; import { RtcpPacket, type RtcpPacketDump } from './RtcpPacket'; /** * RTCP Compound packet info dump. * * @category RTCP */ export type CompoundPacketDump = PacketDump & { packets: RtcpPacketDump[]; }; /** * RTCP Compound packet. * * @category RTCP * * @see * - [RFC 3550](https://datatracker.ietf.org/doc/html/rfc3550) */ export declare class CompoundPacket extends Packet { #private; /** * @param view - If given it will be parsed. Otherwise an empty RTCP Compound * packet will be created. * * @throws * - If given `view` does not contain a valid RTCP Compound packet. */ constructor(view?: DataView); /** * Dump RTCP Compound packet info. */ dump(): CompoundPacketDump; /** * @inheritDoc */ getByteLength(): number; /** * Not implemented in RTCP Compound packet. * * @hidden */ getPadding(): number; /** * Not implemented in RTCP Compound packet. * * @hidden */ padTo4Bytes(): void; /** * @inheritDoc */ needsSerialization(): boolean; /** * @inheritDoc */ serialize(buffer?: ArrayBufferLike, byteOffset?: number): void; /** * @inheritDoc */ clone(buffer?: ArrayBufferLike, byteOffset?: number, serializationBuffer?: ArrayBufferLike, serializationByteOffset?: number): CompoundPacket; /** * Return the {@link RtcpPacket} entries in this RTCP Compound packet. * * @remarks * - The returned value is an array of {@link RtcpPacket}, which is an * abstract class. * - By inspecting {@link RtcpPacket.getPacketType} we can cast each packet * to its specific class. * * @example * ```ts * import { packets } from 'rtp.js'; * const { CompoundPacket, RtcpPacketType, SdesPacket } = packets; * * const compoundPacket = new CompoundPacket(view); * * for (const packet of compoundPacket.getPackets()) * { * switch (packet.getPacketType()) * { * case RtcpPacketType.SDES: * { * const sdesPacket = packet as SdesPacket; * * console.log(sdesPacket.getChunks()); * * break; * } * * // etc. * } * } * ``` */ getPackets(): RtcpPacket[]; /** * Set the {@link RtcpPacket} entries in this RTCP Compound packet. * * @remarks * - Serialization is needed after calling this method. */ setPackets(packets: RtcpPacket[]): void; /** * Add a new {@link RtcpPacket} at the end of this RTCP Compound packet. * * @remarks * - Serialization is needed after calling this method. */ addPacket(packet: RtcpPacket): void; } //# sourceMappingURL=CompoundPacket.d.ts.map