Open benunderwood opened 4 months ago
hmm. That's going to be tricky. Could you remove RTMP protocol dependency there: https://github.com/ThibaultBee/StreamPack/blob/908f7f0e92f7a0d9777dfd0698ff045e337265d1/demos/camera/build.gradle#L54? You will have to remove RTMP classes as well. It is just for a test. Do you need both RTMP and SRT? RTMP and SRT are both shipped with a version of libssl/libcrypto and I suspect that gradle picked one that is missing API.
Thanks for the reply.
I'm just doing some exploration at the moment so I'm not sure if I'll be using RTMP or SRT, I think either is suitable.
I've tried removing the RTMP dependency, and I find it still has the same error.
If I put back the RTMP dependency and remove the SRT dependency I get another error, which looks similar, but is from librtmp this time:
16:14:12.787 E createStreamer failed
java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "DH_get0_pub_key" referenced by "/data/app/io.github.thibaultbee.streampack.sample-qXWgmifSgqUjLEmSW0FTSQ==/base.apk!/lib/armeabi-v7a/librtmp.so"...
at java.lang.Runtime.loadLibrary0(Runtime.java:1016)
at java.lang.System.loadLibrary(System.java:1669)
at video.api.rtmpdroid.RtmpNativeLoader.
I don't have a clue why this is happening 🤔 Might be because you are using a custom phone and something is missing in the implementation.
I made a test where I enforce loadLibrary
of ssl and crypto: https://github.com/ThibaultBee/StreamPack/tree/test/openssl
Could you test it?
Hopefully it will be called before loading rtmpdroid
and srtdroid
.
For RTMP, you could try something like that the dependencies:
implementation("video.api:rtmpdroid:1.2.1-packed")
implementation project(':extension-rtmp') {
exclude group: 'video.api', module: 'rtmpdroid'
// exclude the transitive dependency to use packed version to avoid conflict with libssl.so and libcrypto.so
}
Also found this relevant info: https://developer.android.com/training/articles/perf-jni.html#native-libraries
I've tried the test/openssl branch you created, and that fixes the problem for me, thank you!
I suspect you are correct that it is something missing on the device, and it's not a general issue. It's currently beyond my understanding, but if I work out what is happening I'll let you know.
Ok, I will add this is in native dependencies (srtdroid
and rtmpdroid
):
System.loadLibrary("crypto")
System.loadLibrary("ssl")
Already in rtmpdroid
: https://github.com/apivideo/api.video-rtmpdroid/commit/d7eb771f960ab4131409b0cd1bcdb93741ef6f85
But it will take a while.
Version
2.6.0
Environment that reproduces the issue
Custom device running Android 9 (api 28).
RTMP/SRT/... Server
N/A
Audio configuration
N/A
Video configuration
N/A
Is it reproducible in the demos application?
Yes
Reproduction steps
Running the "demo-camera" app results in an immediate crash.
Expected result
App doesn't crash.
Actual result
The app crashes with "java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "CRYPTO_ctr128_encrypt".
Additional context
This only happens on the custom device mentioned.
Relevant logs output