[2.46][CDMProxyThunder] Pass CAPS to decrypt function#1489
[2.46][CDMProxyThunder] Pass CAPS to decrypt function#1489asurdej-comcast wants to merge 1 commit intoWebPlatformForEmbedded:wpe-2.46from
Conversation
Use new version of decrypt function opencdm_gstreamer_session_decrypt_buffer() to handle CAPS/stream properties
| // Decrypt cipher. | ||
| OpenCDMError errorCode = opencdm_gstreamer_session_decrypt(session->get(), input.dataBuffer, input.subsamplesBuffer, input.numSubsamples, | ||
| input.ivBuffer, input.keyIDBuffer, 0); | ||
| OpenCDMError errorCode = opencdm_gstreamer_session_decrypt_buffer(session->get(), input.dataBuffer, input.caps.get()); |
There was a problem hiding this comment.
This cannot be upstreamed as-is, we would need some kind of Thunder version check and an ifdef here. I'll take a look next week.
There was a problem hiding this comment.
Can you try this PR please? WebKit/WebKit#44057
There was a problem hiding this comment.
The patch fails to detect new API because of missing header. (cmake logs below). It uses C compiler. Replaced with "check_cxx_symbol_exists()" but it failed again with undefined decrypt_buffer() symbol as THUNDER libraries are WebCore local. Otherwise it seems fine, encrypted playback works as expected
Here are my modifications:
include(CheckCXXSymbolExists)
...
# globaly add thunder libraries:
set(CMAKE_REQUIRED_LIBRARIES ${THUNDER_LIBRARIES})
check_cxx_symbol_exists(opencdm_gstreamer_session_decrypt_buffer ${THUNDER_INCLUDE_DIR}/open_cdm_adapter.h HAS_OCDM_DECRYPT_BUFFER)
...
logs:
Determining if the opencdm_gstreamer_session_decrypt_buffer exist failed with the following output:
Change Dir: /home/asurdej/work/hisense_25Q2/build-hisense-v2/tmp/work/armv7at2hf-neon-rdk-linux-gnueabi/wpe-webkit/2.46+gitAUTOINC+15440d15c6-r0/build/CMakeFiles/CMakeTmp
Run Build Command(s):ninja cmTC_65fac && [1/2] Building C object CMakeFiles/cmTC_65fac.dir/CheckSymbolExists.c.o
FAILED: CMakeFiles/cmTC_65fac.dir/CheckSymbolExists.c.o
ccache /home/asurdej/work/hisense_25Q2/build-hisense-v2/tmp/work/armv7at2hf-neon-rdk-linux-gnueabi/wpe-webkit/2.46+gitAUTOINC+15440d15c6-r0/recipe-sysroot-native/usr/bin/arm-rdk-linux-gnueabi/arm-rdk-linux-gnueabi-gcc -D_GNU_SOURCE=1 -fdiagnostics
In file included from /home/asurdej/work/hisense_25Q2/build-hisense-v2/tmp/work/armv7at2hf-neon-rdk-linux-gnueabi/wpe-webkit/2.46+gitAUTOINC+15440d15c6-r0/recipe-sysroot/usr/include/WPEFramework/ocdm/open_cdm_adapter.h:23,
from /home/asurdej/work/hisense_25Q2/build-hisense-v2/tmp/work/armv7at2hf-neon-rdk-linux-gnueabi/wpe-webkit/2.46+gitAUTOINC+15440d15c6-r0/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:2:
/home/asurdej/work/hisense_25Q2/build-hisense-v2/tmp/work/armv7at2hf-neon-rdk-linux-gnueabi/wpe-webkit/2.46+gitAUTOINC+15440d15c6-r0/recipe-sysroot/usr/include/WPEFramework/ocdm/open_cdm.h:61:10: fatal error: string: No such file or directory
61 | #include <string>
| ^~~~~~~~
compilation terminated.
ninja: build stopped: subcommand failed.
File /home/asurdej/work/hisense_25Q2/build-hisense-v2/tmp/work/armv7at2hf-neon-rdk-linux-gnueabi/wpe-webkit/2.46+gitAUTOINC+15440d15c6-r0/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include </home/asurdej/work/hisense_25Q2/build-hisense-v2/tmp/work/armv7at2hf-neon-rdk-linux-gnueabi/wpe-webkit/2.46+gitAUTOINC+15440d15c6-r0/recipe-sysroot/usr/include/WPEFramework/ocdm/open_cdm_adapter.h>
int main(int argc, char** argv)
{
(void)argv;
#ifndef opencdm_gstreamer_session_decrypt_buffer
return ((int*)(&opencdm_gstreamer_session_decrypt_buffer))[argc];
#else
(void)argc;
return 0;
#endif
}
There was a problem hiding this comment.
Replaced with "check_cxx_symbol_exists()" but it failed again with undefined decrypt_buffer() symbol as THUNDER libraries are WebCore local.
Can you share the log for that?
There was a problem hiding this comment.
I've just realized that include is our local modification, there is also a in open_cdm.h but unused so easy to remove.
Without that it hits the same undefined reference as CXX case:
/usr/src/debug/wpe-webkit/2.46+gitAUTOINC+15440d15c6-r0/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:13: undefined reference to `opencdm_gstreamer_session_decrypt_buffer'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
There was a problem hiding this comment.
Seems like thunder include/lib options can be added in the check, https://cmake.org/cmake/help/latest/module/CheckCXXSymbolExists.html
There was a problem hiding this comment.
I got back to C version check_symbol_exists(). We have couple of local modifications that fails with C compiler but we can fix that I think. Or we can go with CXX version that will be easier to maintain
On undefined reference (C version): and Yes, in my case it works with
set(CMAKE_REQUIRED_LIBRARIES ${THUNDER_LIBRARIES})
Determining if the opencdm_gstreamer_session_decrypt_buffer exist failed with the following output:
Change Dir: /home/asurdej/work/hisense_25Q2/build-hisense-v2/tmp/work/armv7at2hf-neon-rdk-linux-gnueabi/wpe-webkit/2.46+gitAUTOINC+15440d15c6-r0/build/CMakeFiles/CMakeTmp
Run Build Command(s):ninja cmTC_dbd4f && [1/2] Building C object CMakeFiles/cmTC_dbd4f.dir/CheckSymbolExists.c.o
[2/2] Linking C executable cmTC_dbd4f
FAILED: cmTC_dbd4f
: && /home/asurdej/work/hisense_25Q2/build-hisense-v2/tmp/work/armv7at2hf-neon-rdk-linux-gnueabi/wpe-webkit/2.46+gitAUTOINC+15440d15c6-r0/recipe-sysroot-native/usr/bin/arm-rdk-linux-gnueabi/arm-rdk-linux-gnueabi-gcc -fdiagnostics-color=always -Wext
/home/asurdej/work/hisense_25Q2/build-hisense-v2/tmp/work/armv7at2hf-neon-rdk-linux-gnueabi/wpe-webkit/2.46+gitAUTOINC+15440d15c6-r0/recipe-sysroot-native/usr/bin/arm-rdk-linux-gnueabi/../../libexec/arm-rdk-linux-gnueabi/gcc/arm-rdk-linux-gnueabi/1
/usr/src/debug/wpe-webkit/2.46+gitAUTOINC+15440d15c6-r0/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:13: undefined reference to `opencdm_gstreamer_session_decrypt_buffer'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
File /home/asurdej/work/hisense_25Q2/build-hisense-v2/tmp/work/armv7at2hf-neon-rdk-linux-gnueabi/wpe-webkit/2.46+gitAUTOINC+15440d15c6-r0/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include </home/asurdej/work/hisense_25Q2/build-hisense-v2/tmp/work/armv7at2hf-neon-rdk-linux-gnueabi/wpe-webkit/2.46+gitAUTOINC+15440d15c6-r0/recipe-sysroot/usr/include/WPEFramework/ocdm/open_cdm_adapter.h>
int main(int argc, char** argv)
{
(void)argv;
#ifndef opencdm_gstreamer_session_decrypt_buffer
return ((int*)(&opencdm_gstreamer_session_decrypt_buffer))[argc];
#else
(void)argc;
return 0;
#endif
}
There was a problem hiding this comment.
So, iiuc, with set(CMAKE_REQUIRED_LIBRARIES ${THUNDER_LIBRARIES}) and CXX check it works? If so, I don't mind going with that :)
There was a problem hiding this comment.
That’s correct. Here is my snippet
include(CheckCXXSymbolExists)
...
# globaly add thunder libraries:
set(CMAKE_REQUIRED_LIBRARIES ${THUNDER_LIBRARIES})
check_cxx_symbol_exists(opencdm_gstreamer_session_decrypt_buffer ${THUNDER_INCLUDE_DIR}/open_cdm_adapter.h HAS_OCDM_DECRYPT_BUFFER)
...
There was a problem hiding this comment.
Thanks, let's see how the PR review goes. Might not be reviewed until next week due to Easter.
|
Fixed with b709dd2 |
Use new version of decrypt function
opencdm_gstreamer_session_decrypt_buffer()
to handle CAPS/stream properties
New API is available in all Thunder releases, R2, R3, R4 and newer:
OpenCDMError opencdm_gstreamer_session_decrypt_buffer(struct OpenCDMSession* session, GstBuffer* buffer, GstCaps* caps);
It takes all decryption info from protection meta structure attached to GstBuffer - pretty similar to what WebKitCommonEncryptionDecryptorGStreamer::transformInPlace() does.
I'm not sure if there is/or can be any other implementation of WebKit Decryptor interface other than Thunder, especially decrypt() function. But if thunder is the only one then most of transformInPlace() impl can be removed, parts to parse protection_meta as it is done inside opencdm_gstreamer_session_decrypt_buffer() now
30c7ea0