/** Callback used to park and flush a suspendable decoder owner before reclaiming its leases. */ export type MediaDecoderSuspendCallback = () => void | Promise; /** One logical decoder-session request. */ export interface MediaDecoderLeaseRequest { readonly owner: string; readonly session?: string; readonly priority?: number; readonly suspend?: MediaDecoderSuspendCallback; } /** An atomic group of logical decoder sessions admitted through one serialized callback. */ export interface MediaDecoderGroupRequest { readonly owner: string; readonly sessions: readonly string[]; readonly priority?: number; readonly suspend?: MediaDecoderSuspendCallback; } /** One member of an individual or grouped decoder reservation. */ export interface MediaDecoderLease { readonly groupId: number; readonly owner: string; readonly session: string; readonly priority: number; readonly released: boolean; release(): void; } /** Handle spanning every member lease in one atomic coordinator transaction. */ export interface MediaDecoderGroupLease { readonly id: number; readonly owner: string; readonly priority: number; readonly leases: readonly MediaDecoderLease[]; readonly released: boolean; release(): void; } /** Successful value and retained lease returned by a committed group transaction. */ export interface MediaDecoderGroupAcquisition { readonly lease: MediaDecoderGroupLease; readonly value: TValue; } /** Explicit request to reclaim lower-priority, suspendable owners. */ export interface MediaDecoderReclaimRequest { readonly priority: number; readonly count: number; } export type MediaDecoderAttemptKind = 'individual' | 'group'; export type MediaDecoderAttemptStatus = 'pending' | 'committed' | 'rolled-back'; export type MediaDecoderFailurePhase = 'acquire' | 'reclaim'; /** Immutable active-owner diagnostic. */ export interface MediaDecoderActiveGroupDiagnostic { readonly id: number; readonly attemptId: number; readonly kind: MediaDecoderAttemptKind; readonly owner: string; readonly priority: number; readonly sessions: readonly string[]; readonly suspendable: boolean; } /** Immutable transaction diagnostic retained after commit or rollback. */ export interface MediaDecoderAttemptDiagnostic { readonly id: number; readonly groupId: number; readonly kind: MediaDecoderAttemptKind; readonly owner: string; readonly priority: number; readonly sessions: readonly string[]; readonly status: MediaDecoderAttemptStatus; readonly error?: unknown; } /** Immutable failure diagnostic retaining the original exception. */ export interface MediaDecoderFailureDiagnostic { readonly attemptId: number; readonly groupId: number; readonly owner: string; readonly phase: MediaDecoderFailurePhase; readonly error: unknown; } /** Immutable record of an owner reclaimed through its explicit suspension callback. */ export interface MediaDecoderReclaimedOwnerDiagnostic { readonly groupId: number; readonly owner: string; readonly priority: number; readonly requestedPriority: number; readonly sessions: readonly string[]; } /** Point-in-time coordinator diagnostics. Every collection and entry is frozen. */ export interface MediaDecoderCoordinatorDiagnostics { readonly activeGroups: readonly MediaDecoderActiveGroupDiagnostic[]; readonly attempts: readonly MediaDecoderAttemptDiagnostic[]; readonly failures: readonly MediaDecoderFailureDiagnostic[]; readonly reclaimedOwners: readonly MediaDecoderReclaimedOwnerDiagnostic[]; } /** * Internal logical decoder coordinator. Group callbacks run one at a time and either commit every * member lease or roll all of them back. Active rendering objects remain entirely owner-managed. */ export declare class MediaDecoderCoordinator { #private; acquire(request: MediaDecoderLeaseRequest): Promise; /** * Run one atomic group admission callback. Success commits every member; a thrown/rejected * callback releases the whole logical group, records the original failure, and rethrows it. */ acquireGroup(request: MediaDecoderGroupRequest, callback: (lease: MediaDecoderGroupLease) => TValue | Promise): Promise>; /** * Ask lower-priority owners to suspend until at least `count` logical sessions are reclaimed. * A successful callback is the only authority to release that owner's logical group. */ reclaim(request: MediaDecoderReclaimRequest): Promise; /** Return a deeply frozen point-in-time diagnostic snapshot. */ getDiagnostics(): Readonly; } /** Symbol-keyed friend channel used by internal AFDecoder group integrations. */ export declare const MEDIA_DECODER_COORDINATOR_LEASE: unique symbol; /** Symbol-keyed friend channel used to identify standalone product decoder sessions. */ export declare const MEDIA_DECODER_COORDINATOR_REQUEST: unique symbol; /** Acquire one logical session from the page-wide coordinator. */ export declare function acquireMediaDecoderLease(request: MediaDecoderLeaseRequest): Promise; /** Run one atomic transaction through the page-wide coordinator. */ export declare function acquireMediaDecoderGroup(request: MediaDecoderGroupRequest, callback: (lease: MediaDecoderGroupLease) => TValue | Promise): Promise>; /** Reclaim lower-priority shared leases through their registered suspension callbacks. */ export declare function reclaimMediaDecoderLeases(request: MediaDecoderReclaimRequest): Promise; /** Read immutable diagnostics from the page-wide coordinator. */ export declare function getMediaDecoderCoordinatorDiagnostics(): Readonly; /** * @internal Test-only scoped singleton injection. The returned idempotent callback restores the * previous coordinator, so no mutable coordinator slot is exposed as product API. */ export declare function installMediaDecoderCoordinatorForTesting(coordinator: MediaDecoderCoordinator): () => void;