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

Keep DrmSession open when moving between secure content and clear ads using IMA extension #7011

Closed
dbrain opened this issue Feb 25, 2020 · 2 comments
Assignees

Comments

@dbrain
Copy link
Contributor

dbrain commented Feb 25, 2020

Use case description

When playing secure content with ads via the IMA extension the secure session is released. This means when the ad completes the drm session needs to be reacquired causing multiple network requests to the license URL (in case of widevine with http callback), and a spinner filled transition from ad to content for the user.

#4867 was closed recently, which solves the issue for specific scenarios I.E. multi period dash with a mixture of clear ads and DRM content, but the issue still persists with the IMA extension as the ads and the content are contained in separate MediaSources juggled in an AdsMediaSource.

Recipe to reproduce

  • One dash of secure content, widevine with a http callback is easiest to see
  • A couple of splashes of IMA ads, at least one midroll is easiest, DRM -> ad (clear) -> DRM
  • Mix them together with the IMA extension
  • See the widevine http callback hit on playback start, then again after every ad

Proposed solution

No perfect solution comes to mind, but I'd imagine it would involve AdsMediaSource/CompositeMediaSource retaining the DrmSession somehow. Or maybe preventing the content MediaSource being released while the ad MediaSource is playing if we know it is due to play after the ad.

Alternatives considered

Our current workaround is essentially proxying the DrmSessionManager and the DrmSessions it hands out to block release calls until we know the entire playback session is complete. This prevents multiple license calls and makes the ad to contente playback smooth.

The workaround seems to work ok, but it's a bit of a maintenance problem. Moving from 2.10 to 2.11 was a bit of a mess. I also wouldn't be surprised if we're leaking sessions etc.

@ojw28
Copy link
Contributor

ojw28 commented Jun 9, 2020

@icbaker is taking a look at this.

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

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 available on the dev-v2 branch - please try it out and let us know if you spot any problems!

@icbaker icbaker closed this as completed Jul 3, 2020
@google google locked and limited conversation to collaborators Sep 2, 2020
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

4 participants