Skip to content

Commit

Permalink
fix: Fix Android C++ SharedArray logs
Browse files Browse the repository at this point in the history
  • Loading branch information
mrousavy committed Jan 25, 2024
1 parent b1fa065 commit bc6f954
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 0 additions & 1 deletion package/android/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
project(VisionCamera)
cmake_minimum_required(VERSION 3.9.0)

set(CMAKE_VERBOSE_MAKEFILE ON)
set(PACKAGE_NAME "VisionCamera")
set(BUILD_DIR ${CMAKE_SOURCE_DIR}/build)
set(CMAKE_VERBOSE_MAKEFILE ON)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
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);

_arrayBuffer = arrayBuffer;
Expand All @@ -33,7 +34,7 @@ JSharedArray::JSharedArray(const jni::alias_ref<jhybridobject>& javaThis, const
#else
jsi::Runtime& runtime = *proxy->cthis()->getJSRuntime();
#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);
_size = _byteBuffer->getDirectSize();

Expand All @@ -43,7 +44,9 @@ JSharedArray::JSharedArray(const jni::alias_ref<jhybridobject>& javaThis, const

JSharedArray::JSharedArray(const jni::alias_ref<JSharedArray::jhybridobject>& javaThis,
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() {
registerHybrid({
Expand Down

1 comment on commit bc6f954

@vercel
Copy link

@vercel vercel bot commented on bc6f954 Jan 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.