Wrong MP3 length, restore position and setTime issues
Description
Some files have wrong duration and it's changing during playback. This has several unfortunate consequences.
-
You can't restore saved position if initial duration is less than real and saved position is greater than initial duration. For example, this file has initial duration 34:17, real duration 59:58 (actually it should be 1h). If you stop listening at 40:00 and close VLC, you can't continue from the same spot.
-
You can't seek to the right spot (set player's time). Duration is fluctuating while playing. It can be couple minutes off the real value at first and sometimes it takes couple minutes to start fluctuating around the real value. Then you can set time with more precision. That's really confusing.
For example, see this file. You can start playing it and set playback time to 18:23:20 (that's where Chapter 9 starts) - it will get you to a wrong spot (different wrong spot if you try to set the same time multiple times or rewind).
If you start playback and wait for couple minutes then you can seek to Chapter 9 at 18:23:20 correctly. If you stop playback at 18:23:20, close VLC and then try to play it again, it will start far from 18:23:20 (I mean not Chapter 9 though it shows the right timestamp).
It is reproducable on VLC Android and partially on Windows. Other android players I've tried read duration correctly and don't have problems with setting the right playback time.
Also I've found this open ticket about using setPosition instead of setTime #2439 With those samples above it could be a disaster because when you have wrong duration and it's changing, your position is going to be random. setTime is far better though still not accurate enough.
Expected behavior
Length is right. Ability to continue playback where I left it. Ability set the right playback time.
Actual behavior
Length is wrong. Can't continue playback where I left it. Can't set the right playback time.