Conversation
9992a4c to
3d2c02f
Compare
9582215 to
f2ecfc6
Compare
|
@glennguy are you still here? please let me know for now it would be enough to have it working by using this PR (Kodi 22) by using "InputStream adaptive samples" addon, im pretty sure that following stream was working: EDIT: fixed by #1790 |
f2ecfc6 to
cacc7f4
Compare
|
I did a quick test and the only regression I noticed is that UrnToKeySystem returns "" if |
|
in this case the target DRM is unknown because "urn:mpeg:dash:mp4protection:2011" means only CENC protection that should be compatible with all drm's |
|
@Uukrull fixup added let me know |
|
Working fine here. Many thanks! |
1cb4c67 to
d944d8d
Compare
|
@Sandmann79 i have updated code, but i tested only on windows, can you give a feedback also on android? i added new PS -- OT: EDIT: perfect on android is full broken |
|
Sorry for the late reply, can you please check the Windows OS again, I have the problem again that several attempts are necessary to start a stream. Even though force_single_ Thanks for the tip about the service not terminating. I'll have to take a look at that. |
|
@Sandmann79 hi i was trying investigate in these hours req_data = "widevine2Challenge={CHA-B64U}&includeHdcpTestKeyInLicense=true"
drm_cfg = {'com.widevine.alpha':
{'license':
{'server_url': licURL,
'req_headers': urlencode(lic_headers),
'req_data': base64.b64encode(req_data.encode('utf-8')).decode(),
'wrapper': "none",
'unwrapper': 'json,base64',
'unwrapper_params': {'path_data': 'license', 'path_data_traverse': True,
'path_hdcp': 'hdcpEnforcementResolutionPixels', 'path_hdcp_traverse': True}
}
}
}
listitem.setProperty('inputstream.adaptive.drm', json.dumps(drm_cfg))with these 2 fixes, playback on windows works with old and new drm properties |
|
I am currently using the following DRM config, with which playback was possible: However, the above-mentioned effect also occurs when using the old properties. |
|
ok discovered now that some videos works and others not |
|
Okay, i think i found the problem affect windows, in short am@zon have some of his audio streams that require CDM "secure path" since on ISA its missing "secure path" implementation for audio media inputstream.adaptive/src/decrypters/widevine/WVCencSingleSampleDecrypter.cpp Lines 202 to 207 in 2364435 and silently also remove all audio streams!! inputstream.adaptive/src/Session.cpp Lines 556 to 558 in 2364435 inputstream.adaptive/src/common/Period.cpp Lines 69 to 83 in 2364435 over the years i have forgotten about this oddity in the removal of repr, also because i didn't know where to get a suitable test stream this lead to BIG PROBLEMS:
audio "secure path" is old feature lack in ISA forgotten over all the years, |
|
@Sandmann79 ok i pushed changes, need some cleaning but should be ok unfortunately this lack in a single decryptor (widevine CDM for non-android) affects the whole DRM management, i had to reintroduce the old hack in a different way (of course that messes up a bit the code again) but at least now its more clear and print on log the disabled (unsupported) audio streams I tested a couple of videos on windows and android and now it seems to be working fine with old and new props on windows/android please do some tests so you can give me a feedback i confirm also that add |
6d83cfb to
aaee5ca
Compare
|
@Sandmann79 i pushed last cleanups, tested again seem ok |
|
I've tested several videos on different systems and couldn't find any issues. Thanks for the really good work and your patience. |
|
Thank you i finally got to the end of this colossal PR |
|
hmf too soon i found now that at least on android there are still problems with some videos |
|
ok, i found that enable 4K on am@zon addon cause decryption problems, whats weird thing |
|
Hi, thanks for the tireless work here. Could it be that with this PR the previous Python addons no longer work? In my specific case it is the simpliTV addon With a slightly older Kodi 22 alpha version with correspondingly older binary addons, however, streaming works perfectly, so it must be due to some new commits By the way, the version of libwidevine.so is 4.10.2662.3 |
|
Can you try #1824? |
|
@mirh |
|
@mirh but the libcdm_aarch64_loader.so file is present hth |
|
there was wrong filename "cdm_aarch64_loader.so" |
|
Yeah, great 😄 Works again |
Description
This is the last big step of my drm rework
This PR completely rewrites the code of how DRM info provided by manifests are handled, and how DRM/CDM are initialized and managed.
The main goal is to introduce a common place where manage DRM info and CDM so in the DRMEngine,
this avoids the need for each manifest parser to have the task of choosing and managing DRM info (which parsers should not do, as is self-explained by the name) and along this introduce the automatic selection of DRM.
To reach this point, i started working on this 2 years ago, initially with the RFC test PR #1415, then with PR #1672 and in between other minor PRs not mentioned here, thousands of changes were needed to achieve something of acceptable quality with this PR, although there are some poor code parts that require more attention and much more time.
The amount of work to achieve this is very high, and despite my efforts to do dozens of tests, i will never have the opportunity to verify every single use case, so it is possible that this imlementation introduces some bugs that do not allow correct playback. It would be oppurtune to have some feedback from some users who use ISA with some video add-ons, if you read this please give your feedback.
Main changes:
DRM auto-selection (new)
This requires a manifest that supports multiple DRMs,
in this case you will have to provide each DRM configuration by using the new property:
inputstream.adaptive.drmas explained on Wiki https://github.com/xbmc/inputstream.adaptive/wiki/Integration-DRM (that i will update later time)
therefore ISA will automatically determine which DRM to use, but you will also be able to give some sort of priority to the type of DRM to be used by making use of the
priorityparameter.HDCP (breaking changes)
In my research it seems to me (but i could be wrong since i haven't found comprehensive docs) that a media player should not have a way to handle HDCP, take task is inherent possibly in the DRM (CDM), which should block non-usable Keys and nothing more.
The possibility of managing the rejection of keys seem not so good handled on ISA, and cannot be done on this PR, also because there is a problem in stream ID selection in Kodi core, that prevent a fallback an appropriate stream ID when one fails, which should be fixed before that.
Breaking changes 1:
The ISA setting "Ignore HDCP status" is now removed,
the current behavior is that the HDCP "status" is never verified, but can be re-enabled by using the new
check_hdcp, read below.Breaking changes 2:
In the
unwrapper_params, child parameter of thelicenseparameter,the
path_hdcpandpath_hdcp_traversehas been renamed intopath_hdcp_resandpath_hdcp_res_traverse(that handle resolution limit),and there is a new
path_hdcp_verandpath_hdcp_ver_traverse, that handle an HDCP Version comparison with the manifest value.Details on wiki page https://github.com/xbmc/inputstream.adaptive/wiki/HDCP-resolution-limit
New property parameters
The
inputstream.adaptive.confighave two new parameters:resolution_limit- Allow to limit the playable resolutions provided by manifests. This is a kind of workaround since currently we cant handle appropriately HDCP use cases. Just set the max resolution that can be used e.g. "1024x768"check_hdcp- Allows to enable the check of the HDCP values provided in the license response. Details on wiki page https://github.com/xbmc/inputstream.adaptive/wiki/HDCP-resolution-limitThe
inputstream.adaptive.drmhave a new parameter:force_single_session- Allow to enforce a single DRM session, when possible. (while with new "drm" prop this is disabled by default, in the old properties and "drm_legacy" still use the enforced single session. more details below)DRM configuration changes
When a manifest include DRM protections that dont require additional configurations, it will be played directly, so there is no need to set
inputstream.adaptive.drmorinputstream.adaptive.drm_legacyproperty.This is the case for example for PlayReady, or ClearKey case that embed its license url in the manifest.
In the ClearKey configuration with
inputstream.adaptive.drmorinputstream.adaptive.drm_legacy, its not only supported to set the license URL, but now its also supported to set a URI with "data" scheme. The data follow the W3C standard, so:data:application/json;base64,REPLACE_WITH_CK_LICENSE_RESPONSE_AS_BASE64DRM Sessions (breaking change)
With older ISA versons (older kodi versions) sessions created most of time was a single one (when license provide all KIDs) and on android was always enforced into a single session, that was leading to possible decryption problems by displaying corrupted/pixellated videos.
Now by using the new properties to configure the DRM so
inputstream.adaptive.drmandinputstream.adaptive.drm_legacythe DRM sessions sessions are distinguished by media type and will be reused when:
or when:
So if there are multiple DRM sessions opened means also multiple license requests,
if this is a problem for your provider and you are sure that the license response provide all KIDs in a single request,
you can enforce the use of a single session, by using
force_single_sessionparameter ofinputstream.adaptive.drm,this way you can also save the time it takes to request multiple licenses and start playback faster.
Brief summary session breaking-changes:
inputstream.adaptive.drm_legacyunlike Kodi 21, it no longer forces single sessioninputstream.adaptive.drmnever force a single session, if not specified by usingforce_single_sessionparameterStream selector type: Ask quality (improvement)
In multi-codec manifests, all codec variants will now be shown. I had to include this change here out of test necessity.
Deprecated old DRM properties
All following old DRM properties:
Are now --officially-- deprecated, in favor of the more advanced methods:
inputstream.adaptive.drm_legacyandinputstream.adaptive.drmIts recommended to use the new properties from Kodi v22, see Wiki for more details.
Old properties still work, for now, but will be removed on future Kodi versions.
Other changes under the hood
Now the initialization of DRM/CDM Sessions are done on streams to be played only. where previously sessions were created for all streams even if unused, this improve also the playback start speed (with the exception of HDCP license based is enabled).Changes restored to old behavior due to lack of Widevine CDM Secure decoder for audio media preventing code optimizationTo do / tests
[x] Rework drm info on Dash parser
[x] Rework drm info on HLS parser
[x] Rework drm info on Smoothstreaming parser
[x] Reimplement CheckHDCP
[x] Adapt test project, if needed
[x] Enable multi-drm support to "drm" property
[x] Deprecate old properties
[x] Test stream with single drm widevine
[x] Test stream with single drm playready
[x] Test stream with clearkey
[x] Test stream with widevine "to" clearkey
[x] Test multi drm's stream widevine+playready, between windows and android
[x] Test HLS AES-128
[x] Test HLS AES-128 - key on each segment
[x] Test HLS multi-period, encryption transitions: unencrypted->AES-128->unencrypted
[x] Some tests on android (tested SS+PR, some widevine)
[x] Some tests on linux (under Ubuntu widevine)
fix #1585 about to separate audio/video sessions
Motivation and context
This PR will finish the multi-drm configuration support for
inputstream.adaptive.drmpropertyWhat is auto selection of DRM?
in this case we are talking about manifests (usually HLS/DASH) that support multiple DRMs at same time.
Until now, every python video add-on was forced to manually set the appropriate DRM for the type of operating system in use
by setting appropriate
inputstream.adaptive.license_typeandinputstream.adaptive.license_key(and all other properties).for example a manifest that support playready and widevine,
on Windows OS is needed that the python addon set the drm configuration for widevine, and on android could be for playready.
This implementation allows a video add-ons to provide all the DRM configurations supported by the provider in a distinct way, so that ISA can automatically select a DRM by finding a match between DRM supported in the operating system in use and the manifest, so a video add-on will no longer have to check if a DRM is compatible with the operating system in use, to configure ISA.
This will be even more useful in the future when a support to new DRMs can be implemented.
Types of change
Checklist: