mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2025-03-17 13:22:40 +01:00
initialize capture library in service thread, fix sigsegv fault
This commit is contained in:
parent
7de63b2b5f
commit
d8877a259c
@ -87,7 +87,7 @@ dependencies {
|
|||||||
implementation('com.fasterxml.jackson.core:jackson-databind:2.17.2')
|
implementation('com.fasterxml.jackson.core:jackson-databind:2.17.2')
|
||||||
implementation('com.sparrowwallet:hummingbird:1.7.4')
|
implementation('com.sparrowwallet:hummingbird:1.7.4')
|
||||||
implementation('co.nstant.in:cbor:0.9')
|
implementation('co.nstant.in:cbor:0.9')
|
||||||
implementation('org.openpnp:openpnp-capture-java:0.0.28-3')
|
implementation('org.openpnp:openpnp-capture-java:0.0.28-4')
|
||||||
implementation("io.matthewnelson.kotlin-components:kmp-tor:${vTor}-${vKmpTor}") {
|
implementation("io.matthewnelson.kotlin-components:kmp-tor:${vTor}-${vKmpTor}") {
|
||||||
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-common'
|
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib-common'
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ public class WebcamService extends ScheduledService<Image> {
|
|||||||
|
|
||||||
private static final int QR_SAMPLE_PERIOD_MILLIS = 200;
|
private static final int QR_SAMPLE_PERIOD_MILLIS = 200;
|
||||||
|
|
||||||
private final OpenPnpCapture capture;
|
private OpenPnpCapture capture;
|
||||||
private CaptureStream stream;
|
private CaptureStream stream;
|
||||||
private PropertyLimits zoomLimits;
|
private PropertyLimits zoomLimits;
|
||||||
private long lastQrSampleTime;
|
private long lastQrSampleTime;
|
||||||
@ -82,7 +82,6 @@ public class WebcamService extends ScheduledService<Image> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public WebcamService(WebcamResolution requestedResolution, CaptureDevice requestedDevice) {
|
public WebcamService(WebcamResolution requestedResolution, CaptureDevice requestedDevice) {
|
||||||
this.capture = new OpenPnpCapture();
|
|
||||||
this.resolution = requestedResolution;
|
this.resolution = requestedResolution;
|
||||||
this.device = requestedDevice;
|
this.device = requestedDevice;
|
||||||
this.lastQrSampleTime = System.currentTimeMillis();
|
this.lastQrSampleTime = System.currentTimeMillis();
|
||||||
@ -96,6 +95,8 @@ public class WebcamService extends ScheduledService<Image> {
|
|||||||
@Override
|
@Override
|
||||||
protected Image call() throws Exception {
|
protected Image call() throws Exception {
|
||||||
try {
|
try {
|
||||||
|
createCapture();
|
||||||
|
|
||||||
if(stream == null) {
|
if(stream == null) {
|
||||||
devices = capture.getDevices();
|
devices = capture.getDevices();
|
||||||
|
|
||||||
@ -178,6 +179,12 @@ public class WebcamService extends ScheduledService<Image> {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private synchronized void createCapture() {
|
||||||
|
if(capture == null) {
|
||||||
|
capture = new OpenPnpCapture();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reset() {
|
public void reset() {
|
||||||
stream = null;
|
stream = null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user