-
Notifications
You must be signed in to change notification settings - Fork 476
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AAC with channel config 0 fails to play from TS files #695
Comments
The original MKV works. And when converting the TS back to an MKV, that MKV also works. The AAC streams are exactly the same in each container (copied with ffmpeg). From limited debugging, it seems that the initializationData set inside the Format object (that is ultimately passed to MediaCodec inside a MediaFormat as "csd-0") differs between MKV and TS. For this piece of media, "csd-0" receives The AdtsReader always builds this 2 byte version using the Digging a bit deeper, it seems that these extra bytes are needed when the channel config is set to 0. A channel config of 0 means that the channel config is defined inside the AAC stream itself in a program config element (PCE). In fact, the extra bytes are merely the appended PCE payload! What would be the best way to handle this? An "easy" solution would be for the AdtsReader to delay submitting the Format object to the output when the channel config is 0 until after it has found and appended a PCE from the AAC frame. Note that the exception in MediaCodec's AAC decoder is thrown before MediaCodec ever receives any sample data from the stream! It happens during the first function call after the config and start. This indicates that it will always fail upon receiving a 2 byte "csd-0" when the channel config is 0, meaning all AAC streams with a channel config of 0 will fail when inside a TS container. |
Did you ever figure out how to fix this error? I'm getting it with an mkv that is probably not supported due to a codec but the |
The problem doesn't happen when playing an MKV or MP4. Only TS files (e.g. from an HLS stream). Are you by any chance using software that's remuxing the MKV into an HLS? If so, then yes I have partially fixed it. See my PR #722. |
No, I just have an mkv getting this error. Every so often it throws a codec error but most of the time this runtime error. When it gives a codec error it says |
Version
Media3
main
branchMore version details
a879bae
Devices that reproduce the issue
Chromecast with Google TV HD (Android TV 12)
Pixel 3a (Android 12)
Emulator (Android 14)
Devices that do not reproduce the issue
None?
Reproducible in the demo app?
Yes
Reproduction steps
Expected result
The media plays successfully
Actual result
Playback fails straight away, every time, with:
Media
Media will be emailed
Bug Report
adb bugreport
to [email protected] after filing this issue.The text was updated successfully, but these errors were encountered: