ExoPlayer icon indicating copy to clipboard operation
ExoPlayer copied to clipboard

Reuse secure decoder while moving from secured -> clear -> secure content

Open mikulbhatt opened this issue 8 years ago • 25 comments

We observe that the decoder deinit and reinit while moving from secured to plain content and plain to secure content.

Is there a way to signal exoplayer so we can avoid de-init and re-init of decoder and ask MediaCodecRenderer to reuse the secured decoder for clear content?

mikulbhatt avatar Sep 25 '18 23:09 mikulbhatt

For your use case, does the secure content before and after the clear content use the same keys (e.g. is this like inserting a clear ad into a VOD stream)? Or would the second piece of secure content need a new license request?

ojw28 avatar Sep 26 '18 16:09 ojw28

@ojw28 yes they use the same key, yes its inserting a clear ad into a live stream, and the content of live stream has same key before and after the clear ad

mikulbhatt avatar Sep 26 '18 16:09 mikulbhatt

also since the drm key and license remain same in and out of AD playing secured content. I want to avoid refetching license keys everytime.

mikulbhatt avatar Sep 27 '18 00:09 mikulbhatt

A few problems we face here are from the point of view of implementing a general solution are:

  1. Not knowing if the second secure period will use the same keys. In some cases that period might not even be present in the manifest at the point of transitioning into the clear period, so it's unclear whether we should hold the session open or not (and if we do, should we actively refresh the keys, and when should we give up and close it).
  2. If the user joins the stream during ads, it's possible we wont even know any part of the content is secure, and so will (correctly) initialize a non-secure decoder. I can't see much we can do to avoid at least one decoder re-init in this case, when we encounter the first period containing secure content.

Are you aware of any signalling in the DASH manifest to help with this? I'd rather not have the application side-load all this information, since it feels like something the content should be able to tell us directly.

ojw28 avatar Oct 03 '18 12:10 ojw28

The PSSH data for key is unique per key, so if you get new unique PSSH data in the manifest that could be considered a manifest signal that the key has changed. You could keep using the the secure decoder until you see an new unique PSSH element in the manifest.

In the second case I could see being unable to determine that a secure period would come in the future in that case I think you are right, at least one re-init would be required.

TheJohnBowers avatar Oct 08 '18 17:10 TheJohnBowers

So what do you think about the idea of detecting the need for a new license by watching PSSH blocks and associating them with licenses? As soon as a new one pops into the live window you could send the license request, but if there isn't a new one for a period because a) The period didn't have one at all or b) because it didn't change -- Then you would keep using the existing license until it expires.

TheJohnBowers avatar Oct 17 '18 23:10 TheJohnBowers

I think this is one thing we're planning to do, except "as soon as a new one pops into the live window" is something more like "as soon as we start to buffer it" / "X seconds before we're going to play it".

ojw28 avatar Oct 18 '18 10:10 ojw28

yes, agreed! thats what we want @ojw28 . Let us know of any updates on this thread! thanks 👍

mikulbhatt avatar Oct 24 '18 00:10 mikulbhatt

@ojw28 any update on this, is it being prioritized? thanks.

mikulbhatt avatar Nov 07 '18 23:11 mikulbhatt

@tonihei any update on this issue?

BetweenTwoBits avatar Aug 20 '19 21:08 BetweenTwoBits

Is this prioritized ?

mikulbhatt avatar Aug 20 '19 21:08 mikulbhatt

I am working on this.

Any content you can send to us would be valuable. If you don't want to make it public, please send it to [email protected]. If you send an e-mail, please post a message below and I'll check it out.

AquilesCanta avatar Aug 21 '19 10:08 AquilesCanta

@AquilesCanta you can use following profile as a test stream:

{  
   "name":"Live - Uplynk DASH Encrypted with UnEncrypted Ads",
   "uri":"https://content.uplynk.com/channel/3c367669a83b4cdab20cceefac253684.mpd?ad=cleardashnew",
   "drm_scheme":"widevine",
   "drm_multi_session":true,
   "drm_license_url":"https://content.uplynk.com/wv",
   "drm_key_request_properties":{  
      "X-DASH-SEND-ALL-KEYS":"1"
   },
   "extension":"mpd"
}

mikulbhatt avatar Aug 21 '19 17:08 mikulbhatt

let me know if this stream is sufficient to reproduce the issue and validate your fixes. We can help you get streams with different scenarios! combination of secure/nonsecure content on live/vod streams

mikulbhatt avatar Aug 21 '19 17:08 mikulbhatt

Hi @AquilesCanta , is the stream provided here useful to you? let me know if you are looking for specific use case and i can try to get you a test stream for that.

mikulbhatt avatar Aug 26 '19 17:08 mikulbhatt

Super useful. I've started looking into this, we should be able to push it to the dev branch relatively soon.

AquilesCanta avatar Aug 30 '19 18:08 AquilesCanta

Awesome!

mikulbhatt avatar Aug 30 '19 18:08 mikulbhatt

@mikulbhatt, do you think you can provide a VOD stream with at least one encrypted to clear and one clear to encrypted transition? That would ease the testing process.

AquilesCanta avatar Sep 02 '19 17:09 AquilesCanta

@AquilesCanta I have some VOD HLS widevine content if that would be helpful for you

cory-zachman-mk avatar Sep 02 '19 18:09 cory-zachman-mk

That'd be useful too. We just need the clear/encrypted transitions.

AquilesCanta avatar Sep 02 '19 18:09 AquilesCanta