fix android crash caused by outdated video frame ptr (#7996)

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages 2024-05-09 22:53:01 +08:00 committed by GitHub
parent 73662ed7d9
commit c640f7ed12
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -48,6 +48,8 @@ impl FrameRaw {
fn set_enable(&mut self, value: bool) {
self.enable = value;
self.ptr.store(std::ptr::null_mut(), SeqCst);
self.len = 0;
}
fn update(&mut self, data: *mut u8, len: usize) {
@ -141,11 +143,7 @@ pub extern "system" fn Java_ffi_FFI_setFrameRawEnable(
}
#[no_mangle]
pub extern "system" fn Java_ffi_FFI_init(
env: JNIEnv,
_class: JClass,
ctx: JObject,
) {
pub extern "system" fn Java_ffi_FFI_init(env: JNIEnv, _class: JClass, ctx: JObject) {
log::debug!("MainService init from java");
if let Ok(jvm) = env.get_java_vm() {
*JVM.write().unwrap() = Some(jvm);