Skip to content
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

Exception with ClippingMediaSource on encrypted HLS #3888

Closed
rajab57 opened this issue Feb 23, 2018 · 8 comments
Closed

Exception with ClippingMediaSource on encrypted HLS #3888

rajab57 opened this issue Feb 23, 2018 · 8 comments
Assignees

Comments

@rajab57
Copy link

rajab57 commented Feb 23, 2018

Issue description

Exception for a clipped HLS Video with AES-128 encryption.
When playing as a mediaSource, the video plays fine, but when clipped using ClippingMediaSource throws an exception

com.google.android.exoplayer2.source.ClippingMediaSource$IllegalClippingException
 at com.google.android.exoplayer2.source.ClippingMediaSource$ClippingTimeline.<init>(ClippingMediaSource.java:217)
 at com.google.android.exoplayer2.source.ClippingMediaSource.onChildSourceInfoRefreshed(ClippingMediaSource.java:180)
 at com.google.android.exoplayer2.source.ClippingMediaSource.onChildSourceInfoRefreshed(ClippingMediaSource.java:37)
 at com.google.android.exoplayer2.source.CompositeMediaSource$1.onSourceInfoRefreshed(CompositeMediaSource.java:99)
 at com.google.android.exoplayer2.source.hls.HlsMediaSource.onPrimaryPlaylistRefreshed(HlsMediaSource.java:392)
 at com.google.android.exoplayer2.source.hls.playlist.HlsPlaylistTracker.onPlaylistUpdated(HlsPlaylistTracker.java:376)
 at com.google.android.exoplayer2.source.hls.playlist.HlsPlaylistTracker.access$1000(HlsPlaylistTracker.java:41)
 at com.google.android.exoplayer2.source.hls.playlist.HlsPlaylistTracker$MediaPlaylistBundle.processLoadedPlaylist(HlsPlaylistTracker.java:587)
 at com.google.android.exoplayer2.source.hls.playlist.HlsPlaylistTracker$MediaPlaylistBundle.onLoadCompleted(HlsPlaylistTracker.java:534)
 at com.google.android.exoplayer2.source.hls.playlist.HlsPlaylistTracker$MediaPlaylistBundle.onLoadCompleted(HlsPlaylistTracker.java:461)
 at com.google.android.exoplayer2.upstream.Loader$LoadTask.handleMessage(Loader.java:377)
 at android.os.Handler.dispatchMessage(Handler.java:102)
 at android.os.Looper.loop(Looper.java:148)
 at android.os.HandlerThread.run(HandlerThread.java:61)

Reproduction steps

MediaSource mediaSource = new ClippingMediaSource(mediaSources[0], 5000000, 25000000, true); Made this change in PlayerActivity.java in the Exoplayer demo app

Version of ExoPlayer being used

2.7.0

Device(s) and version(s) of Android being used

Nexus 6P Android 8.0.0
Nexus 5 Android 6.0.1 API 23

Link to test content

sent to dev.exoplayer@gmail.com

BugReport

sent to dev.exoplayer@gmail.com

@ojw28
Copy link
Contributor

ojw28 commented Feb 25, 2018

This happens when the HLS media playlists contain a EXT-X-PROGRAM-DATE-TIME, and is a result of restrictions that ClippingMediaSource has around what type of content it's able to clip.

@andrewlewis - I wonder whether it would be possible to relax the ClippingMediaSource requirement that the single period needs to start at the beginning of its parent window? Also, should we set message on IllegalClippingExceptions that includes the reason value?

@rajab57
Copy link
Author

rajab57 commented Feb 26, 2018

@ojw28
Is there documentation what the restrictions are in the content that ClippingMediaSource can clip ?

@ojw28
Copy link
Contributor

ojw28 commented Feb 26, 2018

As per the ClippingMediaSource documentation here:

The wrapped source must consist of a single period that starts at the beginning of the corresponding window.

The problem is more that it's not obvious a HlsMediaSource will violate this requirement when the media playlists contain EXT-X-PROGRAM-DATE-TIME. It's pretty hard to document this kind of thing in a clear way. We'd be better off just relaxing the restriction, as per my question to @andrewlewis above.

andrewlewis added a commit that referenced this issue Mar 2, 2018
ClippingMediaSource provides a timeline where the period and window have the
same start/end positions, so when clipping a child timeline with a non-zero
offset between the window and period it is necessary to clear the offset then
apply the offset to the start/end positions used in the ClippingMediaPeriod.

Also add a message to clipping exceptions.

Also fix adjustment of seeks to the start of the clipped view.

Issue: #3888

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=187292506
@andrewlewis
Copy link
Collaborator

@rajab57 38914f0 removes the restriction on clipping child sources that have an offset window and adds a message to clipping errors to make the error more obvious, and, in addition, in 4373e63 we've also changed HLS timelines so that the period and window both start from zero when first loading the stream. Please try this out on the development branch and let us know if there are any problems with the fixes. Thanks!

@rajab57
Copy link
Author

rajab57 commented Mar 2, 2018

@andrewlewis Works !!
Thanks

@ojw28
Copy link
Contributor

ojw28 commented Mar 7, 2018

This was also fixed (independently) by 4373e63. In other words, either 38914f0 or 4373e63 fix this issue. We'll be picking up 4373e63 in our next release (2.7.1).

@rajab57
Copy link
Author

rajab57 commented Mar 8, 2018

@ojw28
With more testing, noticing this issue #3966

@ojw28
Copy link
Contributor

ojw28 commented Mar 9, 2018

Our planned 2.7.1 release (https://github.com/google/ExoPlayer/tree/dev-v2-r2.7.1) should fix this issue without causing #3966, so I think that release will be fine. We'll also be fixing #3966 in the dev-v2 branch shortly.

@google google locked and limited conversation to collaborators Aug 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants