When using ConcatenatingMediaSource and playback speed is not 1, player.getCurrentPosition() reports the wrong value. It happens when transitioning into the next audio. It starts by first reporting a nonzero number at the start of audio, then repeating this same number until the real-life audio progress catches up to that number. When that happens getCurrentPosition will start reporting correctly.
for example:
If track 1 finishes playing, track 2 will start playing and it _should_ start by reporting 0 when player.getCurrentPosition() is called, but instead it reports 2000. 2000 is repeatedly reported until 2000 ms of playback has elapsed in real life for track 2, and then the player will start reporting correctly every time it gets polled again (until the next track).
Other notes:
Clone this repo, build, install, launch. Click the button to play. Then pay close attention to the TextView that reports progress. Specifically notice when the index increases, you'll see the bug very clearly when the progress stalls before picking back up. I see this bug (barely) when transitioning from index 0 to 1 (there's a ~1 sec stall) - it's really easy to miss. However, it is very apparent from index 1 to 2 (there's a ~5-45 sec stall). As more track transitions happen, the problems range from none to a lot. When the errors do happen, they are pretty consistent - ie: I am able to reproduce the errors at roughly the same track transitions.
btw, the content is slliiiightly NSFW, so I hope you are wearing earphones. (some context on why this content was chosen: I work for Audm, we hire professional voice actors to read articles. This was one of the more problematic articles that we ran into, unfortunately it is also one of the more provocative. To be fair, it's a pretty interesting read.)
My impl uses a SimpleExoPlayer instance and prepares a ConcatenatingMediaSource with 20 ProgressiveMediaSources (m4a audio from assets). The playback rate is set to 2.
Content is in assets
bugreport-NYC-2019-07-01-22-45-55.zip
2.10.2
interesting to note: this did not happen in 2.9.x
physical devices - Pixel 3a api28, Galaxy S9 api28
emulator - Pixel XL api28 and 25
reproducible all the time.
Thanks for reporting. I can reproduce in our demo app and will investigate.
We'll push a fix soon. It was basically a very severe rounding error.
you are amazing! thanks for the quick turnaround :)
Most helpful comment
We'll push a fix soon. It was basically a very severe rounding error.