encodesFlacLosslessAudio and encodesOpus pass on any non-empty file, unlike their five siblings #228

Closed
opened 2026-09-06 02:53:20 +00:00 by JMR-dev · 0 comments
JMR-dev commented 2026-09-06 02:53:20 +00:00 (Migrated from github.com)

Filed from the 2026-09-05 e2e read of the instrumented suite on main @ 4b02294.

Two of FFmpegEngineTest's nine tests assert only that a non-empty file appeared. Five of their siblings check what is actually in it.

app/src/androidTest/java/org/libremediaconverter/ffmpeg/FFmpegEngineTest.kt:113,127
@Test
fun encodesFlacLosslessAudio() {
    val out = convert(OutputFormat.FLAC)
    assertTrue("no FLAC produced", out.exists() && out.length() > 0)
}

@Test
fun encodesOpus() {
    val out = convert(OutputFormat.OPUS)
    assertTrue("no Opus produced", out.exists() && out.length() > 0)
}

The asymmetry is the argument

Every other format test in the same file checks the format:

test assertion
encodesWav first four bytes are RIFF
encodesGifWithAGeneratedPalette first three bytes are GIF
encodesMatroskaWhichMedia3CannotMux EBML magic 1A 45 DF A3
encodesMp3WhichAndroidCannotDoAtAnyApiLevel a track MIME starting audio/ containing mp
bestQualityProducesAPlayableH264File / …H265File track MIME is video/avc / video/hevc

FLAC and Opus are the only two that stop at "a file exists". These are not exotic: FLAC is fLaC in the first four bytes, and OutputFormat.OPUS writes an Ogg container, so OggS. Four bytes each, in the idiom encodesWav already establishes two lines away.

Why it is worth fixing rather than shrugging at

convert() throws on a non-zero FFmpeg return code, so these two do prove the command ran. What they cannot distinguish is the command running and producing the wrong thing — which is the failure mode FFmpegCommandBuilder has already had once. F1 in docs/coverage-read-findings.md records a live Vorbis arm that ContainerCapabilities says cannot exist; a codec/container mismatch reaching either of these two formats would ship green.

Mutation: point OutputFormat.FLAC's arm in FFmpegCommandBuilder.audioArgs at pcm_s16le. The file is non-empty, the return code is zero, and the test passes. Same for Opus with any other audio encoder the container accepts.

Scope

Two assertions, no new fixture, no new dependency, runs on every leg. Deliberately not widened into "audit every assertion in the suite" — the other seven in this file are fine, and the read that produced this ticket found no other instance of the pattern.

_Filed from the 2026-09-05 e2e read of the instrumented suite on `main` @ `4b02294`._ Two of `FFmpegEngineTest`'s nine tests assert only that a non-empty file appeared. Five of their siblings check what is actually in it. ``` app/src/androidTest/java/org/libremediaconverter/ffmpeg/FFmpegEngineTest.kt:113,127 ``` ```kotlin @Test fun encodesFlacLosslessAudio() { val out = convert(OutputFormat.FLAC) assertTrue("no FLAC produced", out.exists() && out.length() > 0) } @Test fun encodesOpus() { val out = convert(OutputFormat.OPUS) assertTrue("no Opus produced", out.exists() && out.length() > 0) } ``` ## The asymmetry is the argument Every other format test in the same file checks the format: | test | assertion | |---|---| | `encodesWav` | first four bytes are `RIFF` | | `encodesGifWithAGeneratedPalette` | first three bytes are `GIF` | | `encodesMatroskaWhichMedia3CannotMux` | EBML magic `1A 45 DF A3` | | `encodesMp3WhichAndroidCannotDoAtAnyApiLevel` | a track MIME starting `audio/` containing `mp` | | `bestQualityProducesAPlayableH264File` / `…H265File` | track MIME is `video/avc` / `video/hevc` | FLAC and Opus are the only two that stop at "a file exists". These are not exotic: FLAC is `fLaC` in the first four bytes, and `OutputFormat.OPUS` writes an Ogg container, so `OggS`. Four bytes each, in the idiom `encodesWav` already establishes two lines away. ## Why it is worth fixing rather than shrugging at `convert()` throws on a non-zero FFmpeg return code, so these two do prove the command ran. What they cannot distinguish is the command running and producing **the wrong thing** — which is the failure mode `FFmpegCommandBuilder` has already had once. `F1` in `docs/coverage-read-findings.md` records a live Vorbis arm that `ContainerCapabilities` says cannot exist; a codec/container mismatch reaching either of these two formats would ship green. *Mutation:* point `OutputFormat.FLAC`'s arm in `FFmpegCommandBuilder.audioArgs` at `pcm_s16le`. The file is non-empty, the return code is zero, and the test passes. Same for Opus with any other audio encoder the container accepts. ## Scope Two assertions, no new fixture, no new dependency, runs on every leg. Deliberately **not** widened into "audit every assertion in the suite" — the other seven in this file are fine, and the read that produced this ticket found no other instance of the pattern.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: JMR-dev/LibreMediaConverter#228