You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Playback freeze at the end of the first period on multi-period Dash streams #9969
Based on my debugging analysis the freeze happens at the end of the first period.
I have observed that when BufferInfo->presentationTimeUs reach 1000008704000 value (first period duration="PT8.72S") android.media.MediaCodec#dequeueOutputBuffer() returns -1 for an indefinite period of time and the playback gets stuck at this position.
com/google/android/exoplayer2/mediacodec/SynchronousMediaCodecAdapter.java:122
screenshot with my logs:
Logs I have added:
With the previous Exoplayer version we have used 2.12.1 this behavior is different and there is no freeze, dequeueOutputBuffer() returns -1 for a short period, and then presentationTimeUs jumps to 8736000.
As per the DASH specification Event@presentationTime values are relative to the start of their containing period. This means the event occurs at 295958438769600/180000 = 1644213548s after the start of the period, however the period is only 8.72s long, so this is clearly incorrect. It looks like @presentationTime is being incorrectly set to be relative to the epoch, rather than to the start of the period.
This is a problem for ExoPlayer, because the player is waiting until it's finished playing the period before advancing to the next one. This includes outputting this event at its specified time, and so the player is stuck waiting to do that.
We should change ExoPlayer to discard events that are beyond the end of their containing period. We already clip audio and video at the period end point, which is in line with DASH-IF interoperability recommendations. The only reason we haven't done this for events defined in the manifest is because there's no legitimate reason for a manifest to ever include such events in the first place (where-as there are valid technical reasons why the final audio/video segments may contain media beyond the end point of the period).
Marking as bad media, but also as a bug, since we'll implement clipping of such events. I suggest that you also fix your manifests, particularly if it's important to you that the events are output at the correct times.
Activity
ojw28 commentedon Feb 12, 2022
The issue occurs because the manifest contains incorrect event presentation timestamps. For example, the first period in your manifest contains this:
As per the DASH specification
Event@presentationTimevalues are relative to the start of their containing period. This means the event occurs at295958438769600/180000 = 1644213548safter the start of the period, however the period is only8.72slong, so this is clearly incorrect. It looks like@presentationTimeis being incorrectly set to be relative to the epoch, rather than to the start of the period.This is a problem for ExoPlayer, because the player is waiting until it's finished playing the period before advancing to the next one. This includes outputting this event at its specified time, and so the player is stuck waiting to do that.
We should change ExoPlayer to discard events that are beyond the end of their containing period. We already clip audio and video at the period end point, which is in line with DASH-IF interoperability recommendations. The only reason we haven't done this for events defined in the manifest is because there's no legitimate reason for a manifest to ever include such events in the first place (where-as there are valid technical reasons why the final audio/video segments may contain media beyond the end point of the period).
Marking as
bad media, but also as abug, since we'll implement clipping of such events. I suggest that you also fix your manifests, particularly if it's important to you that the events are output at the correct times.