Skip to content

Audio encoder tier-3 fallback can select an experimental-only encoder #625

Description

@crippledgeek

Follow-up to #618 (core fix on branch bugfix/container-audio-defaults-618).

Problem

select_audio_encoder_for_container resolves a container's default audio encoder in four tiers. Tier 3 treats the muxer-declared codec name as a literal encoder when it is not a key in AUDIO_CODEC_PREFERENCES:

is_audio_encoder_available(codec).then_some(codec)

is_audio_encoder_available is find_by_name(..).is_some() (codec_registry.rs:139), which happily finds FFmpeg's native vorbis and opus encoders. Both carry AV_CODEC_CAP_EXPERIMENTAL and fail at open unless strict_std_compliance is set to experimental — and no rdlp call site sets it. (The two FF_COMPLIANCE_NORMAL uses at ffi_helpers/mod.rs:256 and thumbnail/mod.rs:186 are avformat_query_codec muxer queries, not encoder contexts.)

So on a build without libvorbis, Nut and WebM resolve to "vorbis" and fail at encoder open, where the tier-4 AAC fallback would previously have worked.

Why it was deferred rather than fixed

Scope

Smaller than the deferring comment claimed. The linked ffmpeg-the-third 4.1.0+ffmpeg-8.0 already exposes Codec::capabilities() -> Capabilities (src/codec/codec.rs:162) with Capabilities::EXPERIMENTAL (src/codec/capabilities.rs:15), so tier 3 can self-filter in roughly three lines. No plumbing to the encoder-open site is required.

Acceptance

  • Tier 3 rejects an encoder carrying Capabilities::EXPERIMENTAL, so such a codec falls through to tier 4 instead of being selected.
  • A test proves an experimental-only encoder is not selected, and that the tier-4 fallback still fires with its warning.
  • The inaccurate "materially bigger change" rationale in audio_encoder_registry.rs is removed.

Refs #618

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions