-
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
HLS Playlist with PlaylistType=Event cannot be loaded properly #9067
Comments
Thanks for the detailed report! We've been provided with another bug report that looks similar to this one, and can be fixed in the same way (although I don't think that's quite the right fix). It's hard to be completely certain that both issues are exactly the same, since you haven't provided a test stream for us to check with, but we can probably work under the assumption that they are. I'll update this issue when the fix is in |
The problem occurs when the primary media playlist URL switches from one whose latest snapshot has not yet got the ended tag, to one whose latest snapshot already has the ended tag. In this case: - We trigger a redundant load of the ended playlist. - When the redundant load completes, MediaPlaylistBundle.processLoadedPlaylist detects that the playlist is unchanged from the one it already has, and so doesn't call onPlaylistUpdated. - PrimaryPlaylistListener.onPrimaryPlaylistRefreshed is never called with the new primary. Hence the externally visible primary is still the one that hasn't ended. HlsMediaSource therefore thinks the event hasn't ended, which in turn prevents the player from transitioning to the ended state. This commit detects when the new primary already has the ended tag. In this case, we call onPrimaryPlaylistRefreshed directly and remove the unnecessary playlist load. Issue: #9067 #minor-release PiperOrigin-RevId: 380680532
Closing on the assumption that the commit above fixes the issue, but please check and let us know if this is not the case. Thanks! |
Thanks @ojw28 , I'll try the fix as soon as possible and update you with the result! |
I've did some checks on top of 2.14.1, this solution works fine.
and it also worked fine in the application. |
The problem occurs when the primary media playlist URL switches from one whose latest snapshot has not yet got the ended tag, to one whose latest snapshot already has the ended tag. In this case: - We trigger a redundant load of the ended playlist. - When the redundant load completes, MediaPlaylistBundle.processLoadedPlaylist detects that the playlist is unchanged from the one it already has, and so doesn't call onPlaylistUpdated. - PrimaryPlaylistListener.onPrimaryPlaylistRefreshed is never called with the new primary. Hence the externally visible primary is still the one that hasn't ended. HlsMediaSource therefore thinks the event hasn't ended, which in turn prevents the player from transitioning to the ended state. This commit detects when the new primary already has the ended tag. In this case, we call onPrimaryPlaylistRefreshed directly and remove the unnecessary playlist load. Issue: #9067 #minor-release PiperOrigin-RevId: 380680532
Preconditions
To reproduce the issue it's required to have the
.m3u8
master playlist with a list of several media playlist (i.e., one of them is for subtitles, all others are to cover different bandwidth).Further by
service
I mean the one which prepares the playlist by request, and which ExoPlayer communicates directly withDescription
The issue happens with the HLS playlist which has
PlaylistType=Event
(EXT-X-PLAYLIST-TYPE:EVENT
). The specific of such a playlist in the service implementation is that when it's requested first time from the service, the service returns partial playlist, which doens't have the EndTag (EXT-X-ENDLIST
). Depending on the service load, after the second request the service might return either the full stream (which hasEXT-X-ENDLIST
), or another partial playlist but with more data, and this will continue till the list withEXT-X-ENDLIST
tag received. [let's further call such playlists as HLS Event Stream [playlists]].Since it's
HLS Event Stream
, the data could be appended to the end of the playlist (according to https://datatracker.ietf.org/doc/html/rfc8216)Issue
When the playback of such a playlist starts, ExoPlayer cannot receive the full playlist and therefore, cannot get required metadata (like duration etc).
When the playback starts, the ExoPlayer starts loading different media playlist from the master playlist, and even though the loading happens properly (according to Web debugging proxy tool), the received data is not delivered properly inside the ExoPlayer framework.
Investigation
While investigating the ExoPlayer framework (using the ExoPlayer Demo app of the version 2.14.1), the code which causes the described behaviour was found in the
![Screenshot 2021-06-16 at 19 45 02](https://user-images.githubusercontent.com/20107387/122260005-74f05800-cedb-11eb-9680-2f742ae8e6f3.png)
DefaultHlsPlaylistTracker
.The following happens: different playlist are downloaded, the method
processLoadedPlaylist
is called, which callsonPlaylistUpdated
(as expected). But inside theonPlaylistUpdated
there's a checkif (url.equals(primaryMediaPlaylistUrl))
which isfalse
all the time. After some debugging, it turned out thatHlsChunkSource
callsgetPlaylistSnapshot
, this one callsmaybeSetPrimaryUrl
method, which might override theprimaryMediaPlaylistUrl
value (which basically happens always).The method
maybeSetPrimaryUrl
is called many times, but it always called right afteronPlaylistUpdated
for the same url, which makes theif
condition be false almost all the time (becauseprimaryMediaPlaylistUrl
remains the same after the previousmaybeSetPrimaryUrl
call).(attaching some logs showing this behaviour)
Because of not calling
primaryPlaylistListener.onPrimaryPlaylistRefreshed(newSnapshot);
(which is inside theif
check), theSinglePeriodTimeline
couldn't be created inside theHlsMediaSource::onPrimaryPlaylistRefreshed
, which is a single place to create the timeline for Hls Playlist.After creating the own implementation of
DefaultHlsPlaylistTracker
and removing theif (url.equals(primaryMediaPlaylistUrl))
check, the issue dissappeared, however, it couldn't be considered as a proper fix (unless you could confirm that it is).Thanks in advance
Additional info
The text was updated successfully, but these errors were encountered: