API Reference audio_proxy v#0.4.0

Copy Markdown View Source

Modules

An imgproxy-style on-the-fly audio transcoding proxy.

OTP application entry point.

Variant identity: the object key under which a rendered variant is cached.

Runtime configuration, read from AP_-prefixed environment variables.

Raised when an AP_-prefixed variable holds an unusable value.

The §5 error contract as one table: structured error in, response out.

Normalized options → ffmpeg argument vector (API doc §3).

One render: a subprocess spawned from an argv list, its stdout streamed to a consumer as ordered chunks.

Supervises the running renders — one child per subprocess.

One probe: ffprobe run against a source, its JSON collected, and the §4 contract filtered out of it.

Turns telemetry into the log an operator reads: one line per request, plus the render lifecycle behind it.

The four operator signals, aggregated from telemetry and exposed to a scraper: saturation, latency, cache efficiency, errors.

The Prometheus text exposition format (version 0.0.4), as string assembly.

The scrape surface, and nothing else.

A rejected options segment, as data (API doc §3, §5).

The processing-options grammar (API doc §3): parse, validate, normalize.

Raw s16le PCM in, waveform peaks out (API doc §3.3).

A peaks render: probe, decode, reduce, serialize — behind AudioProxy.Ffmpeg.Render's contract.

Picks the action at the end of the signed chain: render, or info.

The info endpoint's action (API doc §2, §4): stat, probe, JSON.

Splits the verified rest-of-path into its options half and source half, and parses the options (API doc §1, §3).

The render endpoint's action: everything between "every check passed" and bytes on the socket.

The signed chain (API doc §2): verify, parse, resolve, act.

Parses the source half of the path into a typed source and authorizes it (API doc §1, §5).

Gate for the signed URL space (API doc §1/§2).

One ffprobe per in-flight source, shared by everyone who asks about it.

The probe budget: at most AP_MAX_PROBE_CONCURRENCY ffprobe processes at once, and no queue behind them.

Whether this node should be sent new work — the state behind GET /ready.

One render per in-flight cache key, shared by everyone who asks for it.

Top-level HTTP router.

The five S3 operations this proxy needs, over ex_aws_s3.

ex_aws's HTTP client behaviour, over OTP's :httpc.

The render-slot budget: at most AP_MAX_CONCURRENCY renders at once, with at most AP_QUEUE_SIZE waiting behind them.

URL signature generation and verification (API doc §1).

The source segment (API doc §1): encodings, decoding, dispatch, identity.

AP_SOURCE_ALLOWLIST: which buckets and hosts a remote source may name.

The https:// source type: audio fetched from an origin over TLS.

The local:// source type: files under one configured directory.

The s3:// source type: an object in a bucket.

The contract a source type implements (API doc §1).

The render lifecycle as :telemetry events — the one instrumentation point every consumer reads.

Serving a variant that is already in the store — everything a client can observe about a cache HIT.

The contract a variant store backend implements, and the dispatch to the configured one.

The file:// variant store: a directory tree under the configured root.

The s3:// variant store: one object per variant in a bucket.

The write-back: a coordinator subscriber that streams a render into the variant store.

Raised inside the tee's chunk stream when the render fails, is cancelled, or goes silent — the signal put_stream/3 turns into discard-and-return. Never an error worth reporting: the render's own path already has.