fix: Fix Android C++ SharedArray logs

This commit is contained in:
Marc Rousavy 2024-01-25 16:34:45 +01:00
parent b1fa06514f
commit bc6f954bf1
No known key found for this signature in database
GPG Key ID: 8B9C709EA0B16A6D
2 changed files with 5 additions and 3 deletions

View File

@ -1,7 +1,6 @@
project(VisionCamera) project(VisionCamera)
cmake_minimum_required(VERSION 3.9.0) cmake_minimum_required(VERSION 3.9.0)
set(CMAKE_VERBOSE_MAKEFILE ON)
set(PACKAGE_NAME "VisionCamera") set(PACKAGE_NAME "VisionCamera")
set(BUILD_DIR ${CMAKE_SOURCE_DIR}/build) set(BUILD_DIR ${CMAKE_SOURCE_DIR}/build)
set(CMAKE_VERBOSE_MAKEFILE ON) set(CMAKE_VERBOSE_MAKEFILE ON)

View File

@ -17,6 +17,7 @@ jni::local_ref<JSharedArray::javaobject> JSharedArray::create(jsi::Runtime& runt
JSharedArray::JSharedArray(jsi::Runtime& runtime, std::shared_ptr<jsi::ArrayBuffer> arrayBuffer) { JSharedArray::JSharedArray(jsi::Runtime& runtime, std::shared_ptr<jsi::ArrayBuffer> arrayBuffer) {
size_t size = arrayBuffer->size(runtime); size_t size = arrayBuffer->size(runtime);
__android_log_print(ANDROID_LOG_INFO, TAG, "Wrapping JSI ArrayBuffer with size %zu...", size);
jni::local_ref<JByteBuffer> byteBuffer = JByteBuffer::allocateDirect(size); jni::local_ref<JByteBuffer> byteBuffer = JByteBuffer::allocateDirect(size);
_arrayBuffer = arrayBuffer; _arrayBuffer = arrayBuffer;
@ -33,7 +34,7 @@ JSharedArray::JSharedArray(const jni::alias_ref<jhybridobject>& javaThis, const
#else #else
jsi::Runtime& runtime = *proxy->cthis()->getJSRuntime(); jsi::Runtime& runtime = *proxy->cthis()->getJSRuntime();
#endif #endif
__android_log_print(ANDROID_LOG_INFO, TAG, "Allocating ArrayBuffer with size %i...", byteBuffer->getDirectSize()); __android_log_print(ANDROID_LOG_INFO, TAG, "Wrapping Java ByteBuffer with size %i...", byteBuffer->getDirectSize());
_byteBuffer = jni::make_global(byteBuffer); _byteBuffer = jni::make_global(byteBuffer);
_size = _byteBuffer->getDirectSize(); _size = _byteBuffer->getDirectSize();
@ -43,7 +44,9 @@ JSharedArray::JSharedArray(const jni::alias_ref<jhybridobject>& javaThis, const
JSharedArray::JSharedArray(const jni::alias_ref<JSharedArray::jhybridobject>& javaThis, JSharedArray::JSharedArray(const jni::alias_ref<JSharedArray::jhybridobject>& javaThis,
const jni::alias_ref<JVisionCameraProxy::javaobject>& proxy, int size) const jni::alias_ref<JVisionCameraProxy::javaobject>& proxy, int size)
: JSharedArray(javaThis, proxy, JByteBuffer::allocateDirect(size)) {} : JSharedArray(javaThis, proxy, JByteBuffer::allocateDirect(size)) {
__android_log_print(ANDROID_LOG_INFO, TAG, "Allocating SharedArray with size %i...", size);
}
void JSharedArray::registerNatives() { void JSharedArray::registerNatives() {
registerHybrid({ registerHybrid({