Skip to content

Commit

Permalink
[opt] fix a native memory leak when repeat open close camera
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangdg committed Jul 15, 2022
1 parent c8c944e commit 22f117c
Show file tree
Hide file tree
Showing 11 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ dependencies {
implementation "com.tencent.bugly:nativecrashreport:$bugly_native_version"

// For debug online
// implementation project(':libausbc')
implementation project(':libausbc')

// demo
implementation 'com.github.jiangdongguo.AndroidUSBCamera:libausbc:3.1.7'
// implementation 'com.github.jiangdongguo.AndroidUSBCamera:libausbc:3.1.7'
}
3 changes: 3 additions & 0 deletions libuvc/src/main/jni/UVCCamera/UVCPreview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,9 @@ void UVCPreview::addCaptureFrame(uvc_frame_t *frame) {
}
captureQueu = frame;
pthread_cond_broadcast(&capture_sync);
} else {
// Add this can solve native leak
recycle_frame(frame);
}
pthread_mutex_unlock(&capture_mutex);
}
Expand Down
Binary file modified libuvc/src/main/libs/arm64-v8a/libUVCCamera.so
Binary file not shown.
Binary file modified libuvc/src/main/libs/arm64-v8a/libjpeg-turbo1500.so
Binary file not shown.
Binary file modified libuvc/src/main/libs/arm64-v8a/libusb100.so
Binary file not shown.
Binary file modified libuvc/src/main/libs/arm64-v8a/libuvc.so
Binary file not shown.
Binary file modified libuvc/src/main/libs/armeabi-v7a/libUVCCamera.so
Binary file not shown.
Binary file modified libuvc/src/main/libs/armeabi-v7a/libjpeg-turbo1500.so
Binary file not shown.
Binary file modified libuvc/src/main/libs/armeabi-v7a/libusb100.so
Binary file not shown.
Binary file modified libuvc/src/main/libs/armeabi-v7a/libuvc.so
Binary file not shown.
10 changes: 5 additions & 5 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
include ':app'

// For debug online
//include ':libausbc'
//include ':libuvc'
//include ':libpush'
//include ':libnative'
//include ':libuvccommon'
include ':libausbc'
include ':libuvc'
include ':libpush'
include ':libnative'
include ':libuvccommon'

0 comments on commit 22f117c

Please sign in to comment.