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

Offline License LicenseDurationRemaining is 0 in Samsung GT-N7105 #3150

Closed
bluesneed opened this issue Aug 8, 2017 · 7 comments
Closed

Offline License LicenseDurationRemaining is 0 in Samsung GT-N7105 #3150

bluesneed opened this issue Aug 8, 2017 · 7 comments
Assignees

Comments

@bluesneed
Copy link

Issue description

Offline License acquired success
but return LicenseDurationRemaining is 0 and PlaybackDurationRemaining is 00
In Samsung GT-N7105, Android API 19,
Which causing the download playback failed (KeysExpiredException)
Same device if Streaming, it works.

Kindly see the detail of license information.
LicenseType>>>>>Offline
PersistAllowed>>>>>True
RenewalServerUrl>>>>>
LicenseDurationRemaining>>>>>0
RenewAllowed>>>>>True
PlaybackDurationRemaining>>>>>00
PlayAllowed>>>>>True

We tried same asset on other devices:
Sony E6653(Api 22), Samsung SM-T670 (Api 22), HUAWEI MHA-L29(Api 24), Sony-SGP771 (Api 21)
They all get the correct PlaybackDurationRemaining, kindly see one of the sample below:

PersistAllowed>>>>>True
RenewAllowed>>>>>True
LicenseType>>>>>Offline
PlaybackDurationRemaining>>>>>9223372036854775807
PlayAllowed>>>>>True
RenewalServerUrl>>>>>
LicenseDurationRemaining>>>>>9223372036854775807

Reproduction steps

We use OfflineLicenseHelper following the test class to download license.

Link to test content

I test our production asset as well as this demo asset to test in different, always fails on Samsung GT-N7105
{
"name": "WV: Secure video path required (MP4,H264)",
"uri": "https://storage.googleapis.com/wvmedia/cenc/h264/tears/tears.mpd",
"drm_scheme": "widevine",
"drm_license_url": "https://proxy.uat.widevine.com/proxy?video_id=0894c7c8719b28a0&provider=widevine_test"
}

Version of ExoPlayer being used

We tried the players below:
V2.3.0
V2.5.0

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

Here is info of the issue device:
Samsung GT-N7105
Android Version: 4.4.2 (API 19)
BaseBand Version: N7105XXUFFND3
Widevine Security Leve:l L3

@bluesneed
Copy link
Author

Hi,
Is there any update, or do you need more information?
Thanks!

@bluesneed
Copy link
Author

Hi,

I managed to find the root cause and fixed it. It's likely to be platform/firmware issue.

This is caused by the very large PlaybackDurationRemaining & LicenseDurationRemaining 9223372036854775807, which is the maximum positive value for a 64-bit integer.

After we downloaded the license and use the method
mediaDrm.queryKeyStatus(sessionId)
to query the PlaybackDurationRemaining & LicenseDurationRemaining, I believe some device overflow and returning 0.

So when the playback mode is MODE_QUERY, in the method below will check the license status, cause the LicenseDurationRemaining is 0, it will cause KeysExpiredException();
private void doLicense() {
switch (mode) {
...
case MODE_QUERY:
if (offlineLicenseKeySetId == null) {
postKeyRequest(sessionId, MediaDrm.KEY_TYPE_STREAMING);
} else {
if (restoreKeys()) {
long licenseDurationRemainingSec = getLicenseDurationRemainingSec();
if (mode == MODE_PLAYBACK
&& licenseDurationRemainingSec <= MAX_LICENSE_DURATION_TO_RENEW) {
Log.d(TAG, "Offline license has expired or will expire soon. "
+ "Remaining seconds: " + licenseDurationRemainingSec);
postKeyRequest(sessionId, MediaDrm.KEY_TYPE_OFFLINE);
} else if (licenseDurationRemainingSec <= 0) {
onError(new KeysExpiredException());
} else {
.....
}
}

But actually the license is still valid and can be used to decrypt the key.

By shortening the license duration can fixed this issue. But not sure whether there is another way to avoid this overflow issue.

Thanks & Regards,
Kevin

@wvpaf
Copy link

wvpaf commented Aug 29, 2017

Kevin, thank you for your detailed update.

as a note here is similar report; #3112

@stellabei
Copy link
Contributor

I found the same issue happening for widevine with API 19 and 18. Solved it by ignoring this error in the case that phone is running on API 19 and 18 since we can not change the license duration at the server.

@sylvain-toptal
Copy link

@stellabei How dd you ignore the error? I can't playback downloaded content on API19 because of this issue.

@stellabei
Copy link
Contributor

stellabei commented Dec 18, 2017

@sylvain-toptal It requires a change in Exoplayer code. We are using DefaultDrmSessionManager.java. In this class doLicense() method, licenseDurationRemainingSec = getLicenseDurationRemainingSec(); The licenseDurationRemainingSec will be return as 0 instead of MAX_INT, then you should just ignore and proceed as a normal case. I used optionalKeyRequestParameters to add the flag for the special case treatment so you do not need to change the interface.

@sylvain-toptal
Copy link

Thanks @stellabei

@google google locked and limited conversation to collaborators Dec 28, 2017
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

5 participants