Merge Media3's MP4-only correction into the remux branch
CI on the parent branch proved that four of the five containers the router claimed for Media3 cannot be written by Transformer at all: WebmMuxer, OggMuxer, WavMuxer and AacMuxer each throw UnsupportedOperationException from addMetadataEntry, which MuxerWrapper calls for every metadata entry on the track format. Consequences here beyond the merge itself: - MEDIA3_MUXABLE_VIDEO and MEDIA3_MUXABLE_AUDIO drop to a single MP4 entry. Every other container is already on its way to FFmpeg before those maps are consulted. - Reason.WEBM_CODEC_UNSUPPORTED is removed. WebM now fails the container check first, so nothing could ever produce that reason, and a routing reason no code path can reach is worse than no reason at all. - Media3Muxers gains null branches for the six containers this branch adds. MOV is among them despite being MP4's own family: Mp4Muxer exposes no QuickTime file format. - The README no longer claims Media3 writes five containers. The remux behaviour this branch exists for is unaffected: MKV -> MP4 was always the hardware direction, because Media3 reads Matroska but has never been able to write it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -109,48 +109,6 @@ class Media3EngineTest {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* WAV output, which reaches Media3 for the same reason M4A does.
|
||||
*
|
||||
* `Container.WAV` is in the router's Media3 set, but until the engine passed a muxer factory
|
||||
* the only muxer Transformer ever used was the MP4 one — so asking for WAV produced an MP4.
|
||||
* Asserting the RIFF header proves the container, not merely that a file appeared; this
|
||||
* follows what `FFmpegEngineTest` already does for its formats.
|
||||
*/
|
||||
@Test
|
||||
fun wavExportWritesARiffHeader(): Unit = runBlocking {
|
||||
val wav = File(context.cacheDir, "out_audio.wav")
|
||||
wav.delete()
|
||||
try {
|
||||
engine.transcode(Uri.fromFile(input), wav, ConversionRequest(OutputFormat.WAV.spec))
|
||||
|
||||
assertTrue("export produced no file", wav.exists() && wav.length() > 0)
|
||||
assertEquals("RIFF", String(wav.readBytes().copyOfRange(0, 4), Charsets.US_ASCII))
|
||||
} finally {
|
||||
wav.delete()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Ogg/Opus output, the third container the router claims for Media3.
|
||||
*
|
||||
* Asserted by magic bytes rather than `MediaExtractor`: platform extractor support for raw
|
||||
* Ogg is inconsistent across the API levels in the CI matrix, and "OggS" is unambiguous.
|
||||
*/
|
||||
@Test
|
||||
fun opusExportWritesAnOggHeader(): Unit = runBlocking {
|
||||
val ogg = File(context.cacheDir, "out_audio.opus")
|
||||
ogg.delete()
|
||||
try {
|
||||
engine.transcode(Uri.fromFile(input), ogg, ConversionRequest(OutputFormat.OPUS.spec))
|
||||
|
||||
assertTrue("export produced no file", ogg.exists() && ogg.length() > 0)
|
||||
assertEquals("OggS", String(ogg.readBytes().copyOfRange(0, 4), Charsets.US_ASCII))
|
||||
} finally {
|
||||
ogg.delete()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Regression guard for the Transformer threading trap.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user