google / google/ExoPlayer

Playback position jumps backwards when crossing DASH period boundary

Open
#8,954 12 comments 0 reactions 1 assignee Claimed by @icbaker View on GitHub
bug
Dominant language
Java
Stars
21.9k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

We are using ExoPlayer 2.12.3

We have a DASH content which contains several periods. The first period has no ContentProtection, however, the rest of the periods have it. When we play this content the playback position advances through the first period as expected, however, when the second period starts the playback position jumps backwards by 300-400 milliseconds (which brings the position to the first period) and then continues to play normally.

This does not cause any big problem to the playback per se, however, this first period is "special" and for us it is important to record each time the user is playing this period and due to the problem described above this is recorded twice.

We traced the problem to the DRM keyRequest call to get the key for the second period which is happening on the ExoPlayer thread very close to the end of the first period and blocks the thread for 300-400 milliseconds. The result is that in AudioTrackPositionTracker.getCurrentPositionUs() the value of
```java
positionUs = timestampPositionUs + elapsedSinceTimestampUs;
```
becomes higher (by about the time the thread was blocked) then the value which getPlaybackHeadPositionUs() would return.

When the second period starts maybeSampleSyncParams() recalculates smoothedPlayheadOffsetUs using getPlaybackHeadPositionUs() and the result is that positionUs jumps backwards.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.