-
Notifications
You must be signed in to change notification settings - Fork 468
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
Player moves to next item in playlist before completing previous item. #1904
Comments
This is happening because the file has a VBRI header where the table of contents (ToC) only covers When I play this file in ExoPlayer I see a warning logged about this:
The result of this that we indicate the frame just before byte media/libraries/extractor/src/main/java/androidx/media3/extractor/mp3/Mp3Extractor.java Lines 322 to 324 in 827966b
media/libraries/extractor/src/main/java/androidx/media3/extractor/mp3/Mp3Extractor.java Lines 455 to 460 in 827966b
We are currently assuming that the ToC in the VBRI frame covers the whole file. This is perhaps an unreasonable assumption. The VBRI frame also has a In your file, the VBRI frame has
This seems incorrect, because the file on disk is only With a bit of guesswork, and noting that the VBRI frame also has a
And this now exactly matches the file on disk. Aside: We can also derive the MP3 data length from the VBRI frame size & count values: Summary: This file has a strange VBRI frame, with a ToC that only covers the first ~1:40 of the file, an incorrect average If we switch to using the |
This also results in seeking being broken/nonsensical for this file, because the VBRI ToC assumes that each of the N entries covers an Nth of the file. The result of this is that (with the |
This was hand-crafted with a 4-entry ToC by modifying `bear-vbr-xing-header.mp3` in a hex editor. The output difference from 117 samples to 116 samples is due to the calculation in `VbriSeeker` assuming that the ToC includes the VBRI frame itself, which I don't think is correct (fix is in a follow-up change). Issue: #1904 #cherrypick PiperOrigin-RevId: 700254516
The current code assumes that the first Table of Contents segment includes the `VBRI` frame, but I don't think this is correct and it should only include real/audible MP3 ata - so this change updates the logic to assume the first ToC segment starts at the frame **after** the `VBRI` frame. Issue: #1904 #cherrypick PiperOrigin-RevId: 700269811
The previous code assumed that the `VBRI` Table of Contents (ToC) covers all the MP3 data in the file. In a file with an invalid VBRI ToC where this isn't the case, this results in playback silently stopping mid-playback (and either advancing to the next item, or continuing to count up the playback clock forever). This change considers the `bytes` field to determine the end of the MP3 data, in addition to deriving it from the ToC. If they disagree we log a warning and take the max value. This is because we handle accidentally reading non-MP3 data at the end (or hitting EoF) better than stopping reading valid MP3 data partway through. Issue: #1904 #cherrypick PiperOrigin-RevId: 700319250
This invalid file is now handled more gracefully after 46578ee |
This was hand-crafted with a 4-entry ToC by modifying `bear-vbr-xing-header.mp3` in a hex editor. The output difference from 117 samples to 116 samples is due to the calculation in `VbriSeeker` assuming that the ToC includes the VBRI frame itself, which I don't think is correct (fix is in a follow-up change). Issue: #1904 #cherrypick PiperOrigin-RevId: 700254516 (cherry picked from commit 3eb36d6)
The current code assumes that the first Table of Contents segment includes the `VBRI` frame, but I don't think this is correct and it should only include real/audible MP3 ata - so this change updates the logic to assume the first ToC segment starts at the frame **after** the `VBRI` frame. Issue: #1904 PiperOrigin-RevId: 700269811 (cherry picked from commit f257e55)
The previous code assumed that the `VBRI` Table of Contents (ToC) covers all the MP3 data in the file. In a file with an invalid VBRI ToC where this isn't the case, this results in playback silently stopping mid-playback (and either advancing to the next item, or continuing to count up the playback clock forever). This change considers the `bytes` field to determine the end of the MP3 data, in addition to deriving it from the ToC. If they disagree we log a warning and take the max value. This is because we handle accidentally reading non-MP3 data at the end (or hitting EoF) better than stopping reading valid MP3 data partway through. Issue: #1904 #cherrypick PiperOrigin-RevId: 700319250 (cherry picked from commit 46578ee)
Version
Media3 1.4.1
More version details
No response
Devices that reproduce the issue
Pixel 8 running Android 15
Emulator Pixel 5 Android 14
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
Not tested
Reproduction steps
Expected result
The media plays successfully
Actual result
Either the player starts playing next item in the playlist, or the sound stops but position is increasing.
No Error shown by player.
Following warnings are there:
I am observing this issue with more mp3 files also but at different positions.
The issue is not observed by other softwares, such as Windows Media Player, Chrome Browser Player.
Media
MP3 file link
Bug Report
adb bugreport
to android-media-github@google.com after filing this issue.The text was updated successfully, but these errors were encountered: