-
Notifications
You must be signed in to change notification settings - Fork 413
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 does not start when audio is too much early than video #291
Comments
Thanks for reporting! This is in fact a known bug in the logic of |
We currently only force the first frame if the frame timestamp is greater than the stream *offset*. This is wrong for two reasons: 1. The timestamp and the offset are not comparable and it should be the stream start position. 2. The check should only be applied at stream transitions where we need to make sure that a new first frame isn't rendered until we passed the transition point. We have to fix both issues together, because fixing just issue (1) causes seeks to before the start position to no longer render the frame (and playback will be stuck). A new test covers this case. We also amend the stream transition test case to actually test what it promises to test and add a test for prerolling samples at the beginning, to ensure the first frame is still renderered. Issue: #291 PiperOrigin-RevId: 552858967
This workaround was added for TS streams that do not adjust their timestamps to start from zero. Over time, the default audio sink logic has become more robust towards unexpected timestamps and we no longer need this workaround to jump forward in time. The workaround also actively caused issues by adjusting the audio timestamps backwards if the stream starts with large negative values. See Issue: #291. This caused playback to get stuck due to another bug in the first-frame rendering logic in the video renderer that is now fixed. PiperOrigin-RevId: 553493618
We currently only force the first frame if the frame timestamp is greater than the stream *offset*. This is wrong for two reasons: 1. The timestamp and the offset are not comparable and it should be the stream start position. 2. The check should only be applied at stream transitions where we need to make sure that a new first frame isn't rendered until we passed the transition point. We have to fix both issues together, because fixing just issue (1) causes seeks to before the start position to no longer render the frame (and playback will be stuck). A new test covers this case. We also amend the stream transition test case to actually test what it promises to test and add a test for prerolling samples at the beginning, to ensure the first frame is still renderered. Issue: androidx/media#291 PiperOrigin-RevId: 552858967
This workaround was added for TS streams that do not adjust their timestamps to start from zero. Over time, the default audio sink logic has become more robust towards unexpected timestamps and we no longer need this workaround to jump forward in time. The workaround also actively caused issues by adjusting the audio timestamps backwards if the stream starts with large negative values. See Issue: androidx/media#291. This caused playback to get stuck due to another bug in the first-frame rendering logic in the video renderer that is now fixed. PiperOrigin-RevId: 553493618
[I'm posting this as a question instead of a bug, as you might not consider it a bug per-se]
I'm using ExoPlayer 2.18.1 and I've encountered a problem with a test stream (I will post link via email), whereby ExoPlayer never starts playback on multiple platforms. ExoPlayer actually never enters ready state, but if the playback position is moved manually (e.g. using progress bar in demo app), then video plays normally.
This particular stream, a capture from a real-life scenario, has a rather bumpy start, with initial AC3 audio data with a timestamp that is significantly early compared to first video frames. This difference is larger than the threshold in https://github.com/androidx/media/blob/release/libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/MediaCodecAudioRenderer.java#L664, so the audio clock is updated (backwards). But then the first video frames produced by the codec are not rendered, as they have a later timestamp, and MediaCodecVideoRenderer never enters ready state.
I've seen failure to start playback on multiple platforms:
If I increase the threshold mentioned above to 750000, then playback starts normally. Whether this is a proper fix, I don't know. There's a comment there that states it's a hack, and refers to an internal bug report.
The question is really whether ExoPlayer could handle this more gracefully than not starting playback?
The text was updated successfully, but these errors were encountered: