Error playing FLAC file
Version
Media3 main branch
More version details
No response
Devices that reproduce the issue
Any
Devices that do not reproduce the issue
N/A
Reproducible in the demo app?
Yes
Reproduction steps
Play the file that will be send by mail.
Will error with Caused by: androidx.media3.common.ParserException: First frame does not start with sync code.{contentIsMalformed=true, dataType=1}
Expected result
The file should play as it can be played in any other app, the parser is maybe too strict.
Actual result
playerFailed [eventTime=2960.95, mediaPos=0.00, window=0, period=0, errorCode=ERROR_CODE_PARSING_CONTAINER_MALFORMED (Ask Gemini)
androidx.media3.exoplayer.ExoPlaybackException: Source error
at androidx.media3.exoplayer.ExoPlayerImplInternal.handleIoException(ExoPlayerImplInternal.java:736)
at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:706)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loopOnce(Looper.java:232)
at android.os.Looper.loop(Looper.java:317)
at android.os.HandlerThread.run(HandlerThread.java:85)
Caused by: androidx.media3.common.ParserException: First frame does not start with sync code.{contentIsMalformed=true, dataType=1}
at androidx.media3.extractor.FlacMetadataReader.getFrameStartMarker(FlacMetadataReader.java:242)
at androidx.media3.extractor.flac.FlacExtractor.getFrameStartMarker(FlacExtractor.java:240)
at androidx.media3.extractor.flac.FlacExtractor.read(FlacExtractor.java:177)
at androidx.media3.exoplayer.source.BundledExtractorsAdapter.read(BundledExtractorsAdapter.java:147)
at androidx.media3.exoplayer.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:1082)
at androidx.media3.exoplayer.upstream.Loader$LoadTask.run(Loader.java:421)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
at java.lang.Thread.run(Thread.java:1012)
]
2024-08-28 14:18:44.677 2460-2485 MusicPlayer app.symfonik.music.player.debug E
Media
Sent by mail.
Bug Report
- [ ] You will email the zip file produced by
adb bugreportto [email protected] after filing this issue.
I can reproduce the issue with the provided file. @rohitjoins could you take a look if our parsing is doing something odd here or could be more lenient?
@Tolriq,
The parser expects the frame start marker to include the sync code, which is missing in this case. While we typically follow the spec without making direct comparisons to other apps, this file appears to be corrupted or malformed. As a result, it cannot be played, even in Audacity.
You can verify this by using the flac command line tool to analyze the file, which will produce the following output:
> flac -a ~/Downloads/Teminite\ -\ Stardust\ In\ The\ Universe.flac
flac git-ad9618c5 20221018
Copyright (C) 2000-2009 Josh Coalson, 2011-2022 Xiph.Org Foundation
flac comes with ABSOLUTELY NO WARRANTY. This is free software, and you are
welcome to redistribute it under certain conditions. Type `flac' for details.
Teminite - Stardust In The Universe.flac: *** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
Teminite - Stardust In The Universe.flac: ERROR while decoding data
state = FLAC__STREAM_DECODER_ABORTED
I don't see a reason to relax this check/requirement as that would require adding hacks to work around this malformed file. Please feel free to reopen the ticket if you think otherwise.