AndroidDeviceCodecs' codec-name aliases and its assume-supported fallthrough have no test #86
Closed
opened 2026-08-25 03:21:56 +00:00 by JMR-dev
·
4 comments
No Branch/Tag Specified
main
fix/102-picker-back-press-overshoot
fix/268-saf-picker-determinism
feat/ogg-vorbis-libvorbis
feat/expedited-conversion-work
fix/gate-cache-in-worktrees
chore/gate-runs-shellcheck
test/publish-delete-arm-real-provider
docs/e8-instrumented-coverage
docs/api37-carrier-count-drift
docs/e7-second-constraint
test/publish-to-a-real-saf-destination
fix/api37-report-match-line
fix/api37-task-snapshot-crash
test/join-failure-message-on-device
docs/e2e-read-findings-e7
test/cancelling-a-running-export
test/reattach-to-a-running-job
test/content-uri-reaches-ffmpeg
fix/launcher-wiring-waits-for-the-pick
fix/cancel-tests-need-a-slower-encode
test/cancelling-a-running-join
test/cancelling-a-running-session
test/notification-cancel-action
test/ffmpeg-progress-is-observed
test/fallback-asserts-the-path
test/flac-and-opus-assert-their-format
docs/e2e-read-findings
docs/wave4-coverage-numbers
fix/injectable-startup-sweep-scope
test/session-outcome-seam
test/launcher-callback-identity
test/theme-follows-system-dark
test/audio-drop-arm
fix/rotation-waits-for-recreation
fix/convert-guards-on-ready
test/retry-save-mime
test/hardware-progress-reaches-workmanager
test/ffprobe-mapping-seam
test/device-codec-enumeration-seam
test/unknown-container-row
test/null-message-fallbacks
test/cancel-reaches-workmanager
docs/coverage-wave3-recovery
test/concat-engine-seam
docs/coverage-wave3
test/mediaprobe-merge-seam
test/adaptive-shell-wiring
test/aac-audio-args
test/notification-progress-text
test/media3-muxer-guard
test/hardware-fallback-and-cancellation
test/unprobeable-join-clip
test/one-branch-outcomes
test/foreground-type-regimes
fix/bound-wedge-diagnostics
docs/coverage-wave2
test/screen-wiring
test/viewmodel-setters
test/join-state-mapping
test/conversion-state-mapping
test/dedupe-user-messages
fix/restore-stack-merges
test/refused-jobs
test/concatworker-failure-arms
test/container-capabilities-audio
test/readspec-enum-fallbacks
test/outputpublisher-seams
test/mediaprobe-track-seam
test/outputpublisher-partial-branches
test/fake-provider-scaffolding
docs/coverage-read-findings
chore/gitignore-kotlin
test/bound-the-hangs
docs/coverage-remeasure
ci/baseline-counter-precision
fix/invalid-suggestion-chip
ci/wedged-leg-report
fix/reattachment-overwrites-pick
test/theme-live-branches
fix/failed-save-retry
fix/empty-composition-crash
ci/advisory-failure-report
docs/seven-run-counts
test/release-permission-guard
ci/build-workflow-permissions
docs/api37-point-release
docs/benchmark-populate-path
fix/dead-assertion-probe-test
ci/actionlint
test/device-codecs-encode-consequence
fix/sdkmanager-pipefail
docs/readme-restart-claim
fix/saf-picker-root-discovery
fix/probe-dispatcher-seam
test/media3engine-mime-tables
test/mediaprobe-pure-helpers
fix/codec-vocabulary-drift
docs/robolectric-rationale-correction
docs/api37-advisory-counts
test/r38-8-saf-e2e
test/r38-7-join-states
test/r38-6-conversion-states
test/r38-5-state-seam
fix/jacoco-robolectric-coverage
docs/instrumented-tests-correction
test/r38-2-filecard
test/r38-4-advanced-picker
test/r38-3-pickers
tools/file-issue-script
tools/api-37-emulator
fix/review-app-gaps
docs/review-corrections
No results found.
Labels
Clear labels
above-cut
accessibility
backlog
bug
confirmed
documentation
duplicate
enhancement
good first issue
help wanted
invalid
plausible
question
sev:high
sev:low
sev:medium
wontfix
Worked autonomously overnight: local, JVM-verifiable, no product decision
Barrier affecting people with disabilities
Held for manual review: product/UX call, CI/workflow, hardware, or unverifiable here
Something isn't working
Reviewer demonstrated the defect
Improvements or additions to documentation
This issue or pull request already exists
New feature or request
Good for newcomers
Extra attention is needed
This doesn't seem right
Reviewer could not fully demonstrate it; treat as unproven
Further information is requested
High severity
Low severity
Medium severity
This will not be worked on
Milestone
No items
No Milestone
Projects
Clear projects
No projects
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: JMR-dev/LibreMediaConverter#86
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Filed from a coverage read on
ad28293.AndroidDeviceCodecs.Companionreports 0/37 on the JVM.The half that must stay device-bound
probe()(18/18) queries the realMediaCodecListfor what this hardware can encode and decode. That is the class's whole purpose and it cannot be answered on the JVM.ConversionWorkerTestandRealMediaBenchmarkexercise it on a device; JaCoCo measurestestDebugUnitTestonly, so its 0% is a boundary, not a gap.ConversionRouterTestalready tests the decisions against fabricatedDeviceCodecsprofiles, which is the right seam and is whyforTestingexists.The half that is a gap
Pure lookups, no device.
mimeForCodecNamehandles aliases —avc/avc1,hvc1,av01— which is exactly the kind of table that goes wrong quietly, and itselse -> nullarm carries a documented policy:That policy has a cost — a wasted hardware attempt — so which names fall through it is a decision worth pinning, not an accident worth inheriting.
mimeFor'sCOPY, NONE -> nullarm likewise encodes a reasoned choice ("a copied or absent track places no demand on the hardware"), and nothing checks thatcanEncodestill answerstruefor it.Done means
Both lookups tested arm by arm including the alias spellings and both
nullarms, and one test that pins theCOPY/NONE→canEncode == trueconsequence rather than just the mapping.Mutation: drop
"avc1"from the H.264 arm and the alias test goes red; makemimeForreturn a MIME forCOPYand thecanEncodetest goes red.Read this first
These tables have already drifted from
CodecNames— see the linked ticket. Test the two together or the tests will encode the disagreement instead of catching it.Read #87 before writing these tests. The tables this ticket covers have already drifted from
CodecNames— five codec names resolve in one and not the other, in both directions.Testing this table arm-by-arm in isolation would encode the disagreement rather than catch it. #87 carries the comparison and the mutation that actually bites (add an alias to one table only, and the cross-check goes red).
PR #90 (#87 + #74) covers most of this ticket's "done means", because it had to: this ticket's own
"read this first" is what #87 measured. Recording what is now pinned so nobody writes it twice —
and, more to the point, so nobody writes the per-arm version this ticket originally asked for,
which would encode the disagreement rather than catch it.
Already pinned, in
app/src/test/java/org/libremediaconverter/codec/CodecVocabularyTest.kt:avc/avc1/hvc1/av01— but cross-checked againstCodecNames.VIDEO_ALIASESrather than asserted arm by arm. Both tables are maps now (awhencannot be enumerated), so the test walks both key sets in both directions and also asserts they
agree on each name's meaning. Mutation: adding
"avc3"to one side alone reddens it whileCodecNamesTeststays green at 8 tests, 0 failures.else -> nullpolicy, at the seam that uses it:a device without the decoder now says so for the aliases it used to wave throughbuilds anAndroidDeviceCodecs.forTesting(...)witha known decoder set and asserts
canDecode("cinepak")is stilltrue— the documented "assumethe platform can handle it" answer — while
canDecode("x264")on a device with no AVC decoderis now
false. That last one is #87's behaviour change; four names that used to fall throughthe policy no longer do.
"video/avc", so the comparisonscannot pass as
null == nullifMediaFormat's constants ever stop being inlined into theunit-test classpath.
mimeFor,mimeForCodecName,NAME_TO_MIMEandDECODE_ONLY_NAMESareinternalnow ratherthan
private, per #57's precedent (MainActivity.kt:36-38).Still open, and it is the half #90 did not touch:
mimeFor'sCOPY, NONE -> nullarm and theconsequence it exists for —
canEncodemust answertruefor both, because a copied or absenttrack places no demand on the hardware. Nothing asserts that today. The mutation from this ticket
still applies unchanged: make
mimeForreturn a MIME forCOPYand thecanEncodetest must gored. That is a few lines against
AndroidDeviceCodecs.forTesting(encoders = emptySet(), ...).Two things from the sibling work that change this ticket's shape. Read both before starting.
1. Most of the original scope is already pinned by #87 (PR #90). That PR turned
mimeForCodecNameandmimeForfromwhenexpressions into enumerable maps, widened them tointernal, and addedCodecVocabularyTestcovering the aliases, theelse -> nullpolicy at thecanDecodeseam, and a literal-MIME guard against vacuity. Awhencannot be enumerated, which is why no cross-check was possible before.What is still open, and deliberately not taken there:
mimeFor'sCOPY, NONE -> nullarm and thecanEncode == trueconsequence that follows from it. That is the remaining bite here.2. There is a fifth enum-to-MIME pairing on the same axis, and nothing checks that it agrees. From #85 (PR #91):
AndroidDeviceCodecs.mimeFor(VideoCodec)andMedia3Engine.videoMimeTypeFor(VideoCodec)are bothVideoCodec -> MIME. They agree by value today. Nothing asserts it, and #85 deliberately left that cross-check here rather than reaching into a file another agent owned.Both are now
internal, so the assertion is available to write.Audio has no partner yet.
AndroidDeviceCodecsis video-only, soMedia3Engine.audioMimeTypeForhas nothing to cross-check against. That is a gap rather than a decision — worth naming in whatever lands, instead of leaving the asymmetry unexplained.Suggested acceptance, on top of the original: make the two
VideoCodec -> MIMEtables disagree on one codec and confirm the cross-check goes red. Per-table arm tests will not catch that — the same argument #87 made and then demonstrated.Correcting a premise I put in this ticket, before it propagates further.
My comment above said the two
VideoCodec -> MIMEtables "agree by value today". They do not. Verified againstorigin/main:AndroidDeviceCodecs.mimeForMedia3Engine.videoMimeTypeForThey agree on four of seven.
I relayed that claim from #85's report rather than reading the two functions, which is the same mistake this session has produced several times over — and the reason it matters here is that acting on it would have been a regression. The obvious way to "make the tables agree" is to flatten
mimeForto null for VP8/VP9/AV1;canEncode(VP9)would then answertrueon hardware with no VP9 encoder.The divergence is legitimate and has a reason on each side:
setVideoMimeTyperejects those three so the router never asks Media3, whilecanEncodestill has to answer truthfully about the device's own encoder. PR #98 records that by name in the test rather than forcing agreement, which is the right call and the opposite of what my comment implied.For anyone reading the ticket history: the cross-check is still the deliverable and #87's argument still holds — PR #98's mutation (c) demonstrates it, by changing a table and its per-table expectation in lockstep and showing that only the cross-check goes red. What was wrong was the premise about the starting state, not the plan.