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

DRM - Fetch keys ahead of the playback position #4133

Closed
ojw28 opened this issue Apr 16, 2018 · 11 comments
Closed

DRM - Fetch keys ahead of the playback position #4133

ojw28 opened this issue Apr 16, 2018 · 11 comments
Assignees

Comments

@ojw28
Copy link
Contributor

ojw28 commented Apr 16, 2018

Spun out from #3780. The issue is as described in the title.

@vinay-altbalaji

This comment has been minimized.

@ojw28

This comment has been minimized.

@ojw28 ojw28 changed the title Multikey DRM - Playback may pause briefly when adapting between streams with different keys DRM - Playback pauses briefly when a DRM key needs to be loaded during playback Aug 28, 2019
@ojw28
Copy link
Contributor Author

ojw28 commented Aug 28, 2019

Useful background: https://exoplayer.dev/drm.html

This issue can occur where key rotation is present in the media, where the media consists of different quality streams with different keys, and when playing playlists containing DRM protected content.

The problem is that DRM keys are only requested at the point of playback. The solution will be to request them earlier (e.g. one option is to request them at the point of buffering).

@juechemparathy
Copy link

@AquilesCanta - This seems affecting our playback experience too. Please let me know if you need any help with test streams. Thanks.

@AchibanaUkyo
Copy link

@AquilesCanta Do you consider the key rotation stream which the pssh is only in segment? some encoder/packager won't put the pssh in mpd for live key rotation stream so you can't fetch license in the MediaSource. To be able to retrieve license earlier maybe trigger the license request after demuxing before rendering?

@AquilesCanta
Copy link
Contributor

We are working on other DRM improvements at the moment, please be patient. A commit will appear below once we push something to the dev-branch.

@AquilesCanta
Copy link
Contributor

To be able to retrieve license earlier maybe trigger the license request after demuxing before rendering

@AchibanaUkyo That's what we intend to do.

@AquilesCanta AquilesCanta changed the title DRM - Playback pauses briefly when a DRM key needs to be loaded during playback DRM - Fetch keys ahead of the playback position Oct 11, 2019
@rafakob
Copy link

rafakob commented Oct 29, 2019

Hello!
Is there somewhere a work-in-progress branch? I'm implementing server side DAI for live DASH streams (multi period). When player is switching from advert period (non DRM) to content period (DRM Widevine) I can see a short buffering (around 1 sec).

Time is of the essence here and I'm wondering how I could fix that by myself. Could you give me possible solutions or point me into right direction?

@seanvi24
Copy link

We are working on other DRM improvements at the moment, please be patient. A commit will appear below once we push something to the dev-branch.

Hello, Do you have a date estimate of when the update will be committed? Thank you.

@icbaker icbaker assigned icbaker and unassigned AquilesCanta Feb 6, 2020
ojw28 pushed a commit that referenced this issue Jul 3, 2020
Issue: #7011
Issue: #6725
Issue: #7066

This also mitigates (but doesn't fix) Issue: #4133 because it
prevents a second key load after a short clear section.

PiperOrigin-RevId: 319184325
@icbaker
Copy link
Collaborator

icbaker commented Jul 3, 2020

We haven't implemented key pre-fetching, but 316f8a8 implements session keepalive inside the DefaultDrmSessionManager. By default sessions are kept for 5 minutes after the last 'release' - this can be customised with DefaultDrmSessionManager.Builder#setSessionKeepaliveMs(long).

This is enough to bridge a clear ad-break, so if the content before and after the ad is encrypted with the same keys then the session should now be re-used after the ad (e.g #4133 (comment)). This doesn't help for content with key rotation - so I'll keep the issue open to track implementing proper key-prefetching.

This is available on the dev-v2 branch - please try it out and let us know if you spot any problems!

marcbaechinger pushed a commit that referenced this issue Feb 22, 2021
This adds an optional DrmSessionManager#preacquireSession() method
and implements it on DefaultDrmSessionManager.

The manager doesn't promise to keep the preacquired sessions alive, and
will proactively release them if a ResourceBusyException suggests the
device is running out of available sessions in the underlying framework.

In a future change, SampleQueue will preacquire sessions on the loading
thread and keep track of preacquired 'references', releasing them
when seeking or clearing the queue.

Issue: #4133
PiperOrigin-RevId: 358381616
icbaker added a commit that referenced this issue Mar 12, 2021
@icbaker
Copy link
Collaborator

icbaker commented Mar 12, 2021

This is now implemented on the dev-v2 branch - it will be included in the next major release.

I'd appreciate it if people could try it out and report any issues they observe.

@icbaker icbaker closed this as completed Mar 12, 2021
@google google locked and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants