-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Playback starts from a negative position with multi-period DASH #10941
Comments
Hmm, I can not repro this. The DASH URI that was part of the patch you sent by email (thank you), still worked and when I play this I can't see any anomalies. The Can you confirm you are seeing this problem when playing with a normal |
Thank you for looking into the issue! Yes, I can reproduce it every time, though in some cases at the time of I tried to pinpoint who is changing the value to -21 (or -21333 us to be exact). I got as far as DefaultMediaClock, which jumped from
To double-check that this is unlikely to be specific to the device, I tested on Xiaomi MiBox 4 (Android 9) and the issue could be reproduced there, too. Edit: I checked which renderer it's using to clock and it's |
I narrowed down the version on which the issue started occurring - it's |
Yep, I see this as well when
|
I see that the position is adjusted in @tonihei Can you look into this? We have introduced this with cl/291923069. I'm not sure where this start presentationTimeUs is coming from. I'd say from the media but not sure and you can probably answer more efficiently and see whether we need to fix/adjust something to always start with 0. |
Thanks for the detailed analysis above! The change between 2.15.1 and 2.16.0 that causes this to happen is 4e6960e. However, this isn't really the problem, it just helped to surface it. The first fMP4 audio segment contains an edit list instructing the player to move timestamps by -43ms. So the timestamps of the first samples in the fMP4 container become: [-43, -21, 0, 21, 43, 64, ....]. ExoPlayer knows that playback should start at position 0 and advances to the last sample where the timestamp is less than the intended start time. So it just drops the first sample with -43 and then attempts to start playback at the sample with timestamp -21. It should actually also skip the sample at -21 and start with the one at 0. So why is the commit above relevant? Some decoders are known to have unexpected behavior when fed with negative timestamps. And in this case the decoder decided to "correct" the timestamp to zero after decoding and the problem was never really visible. 4e6960e was done to avoid issues with negative timestamps in decoders, which can be achieved by adding a large offset to all times. At this point the decoder started working correctly and returned the timestamp we fed in to it. So now, we started observing the -21ms timestamp of the sample we should have skipped. |
When seeking in fMP4, we try to extract as little samples as possible by only starting at the preceding sync frame. This comparison should use <= to allow sync frames at exactly the seek position. Issue: #10941 #minor-release PiperOrigin-RevId: 505098172
When seeking in fMP4, we try to extract as little samples as possible by only starting at the preceding sync frame. This comparison should use <= to allow sync frames at exactly the seek position. Issue: google/ExoPlayer#10941 #minor-release PiperOrigin-RevId: 505098172
When seeking in fMP4, we try to extract as little samples as possible by only starting at the preceding sync frame. This comparison should use <= to allow sync frames at exactly the seek position. Issue: google/ExoPlayer#10941 PiperOrigin-RevId: 505098172 (cherry picked from commit 00436a0)
ExoPlayer Version
2.18.1
Devices that reproduce the issue
Probably any device. I used Samsung Galaxy S10 (Android 12) and Google TV HD (Android 11) for development.
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
Yes
Reproduction steps
I haven't tested all versions in between, but the issue could not be reproduced on version 2.14.1.
Reproduced using a multi-period DASH (example sent by e-mail).
When checking
player.getCurrentPosition()
after the player has prepared, the first value is -21.It seems more than coincidental that the negative offset is -21ms as this represents a (floored) duration of a single frame of audio (21.667mS - hence why a pair of priming frames make 43ms, which is the difference between expected and actual segment duration for the first segment).
Expected result
Playback starts at 0
Actual result
Playback starts at -21 (when using
onPlaybackStateChanged
to read currentPosition, sometimes this is not visible, but should happen often enough).Media
I will send a sample by email. The samples are tagged for issue 10940
Bug Report
adb bugreport
to [email protected] after filing this issue.The text was updated successfully, but these errors were encountered: