Skip to content

Commit

Permalink
Use reinterpret_cast for uint8_t casting
Browse files Browse the repository at this point in the history
  • Loading branch information
mrousavy committed Aug 6, 2021
1 parent bc1b1f6 commit 44e3e0a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/expo-av/android/src/main/cpp/JAVManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ void JAVManager::installJSIBindings(jlong jsRuntimePointer,
auto size = sampleBuffer->size();

// TODO: Avoid copy by directly using ArrayBuffer? Or accessing values in the sampleBuffer?
// copies the JNI array into a vector and reinterprets it as an unsigned 8 bit int (u_byte)
// copies the JNI array (signed 8 bit int (byte)) into a vector and reinterprets it as an unsigned 8 bit int (u_byte)
std::vector<uint8_t> buffer(size);
sampleBuffer->getRegion(0, size, (int8_t*)buffer.data());
sampleBuffer->getRegion(0, size, reinterpret_cast<int8_t*>(buffer.data()));

// TODO: Run per channel instead of flat array?
auto channels = jsi::Array(runtime, channelsCount);
Expand Down

0 comments on commit 44e3e0a

Please sign in to comment.