mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-12-17 05:24:19 +01:00
Use camera prepare() step
For consistency with screen capture.
Refs b60e174780
This commit is contained in:
@@ -80,14 +80,21 @@ public class CameraCapture extends SurfaceCapture {
|
|||||||
throw new IOException("No matching camera found");
|
throw new IOException("No matching camera found");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ln.i("Using camera '" + cameraId + "'");
|
||||||
|
cameraDevice = openCamera(cameraId);
|
||||||
|
} catch (CameraAccessException | InterruptedException e) {
|
||||||
|
throw new IOException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void prepare() throws IOException {
|
||||||
|
try {
|
||||||
size = selectSize(cameraId, explicitSize, maxSize, aspectRatio, highSpeed);
|
size = selectSize(cameraId, explicitSize, maxSize, aspectRatio, highSpeed);
|
||||||
if (size == null) {
|
if (size == null) {
|
||||||
throw new IOException("Could not select camera size");
|
throw new IOException("Could not select camera size");
|
||||||
}
|
}
|
||||||
|
} catch (CameraAccessException e) {
|
||||||
Ln.i("Using camera '" + cameraId + "'");
|
|
||||||
cameraDevice = openCamera(cameraId);
|
|
||||||
} catch (CameraAccessException | InterruptedException e) {
|
|
||||||
throw new IOException(e);
|
throw new IOException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -232,13 +239,7 @@ public class CameraCapture extends SurfaceCapture {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.maxSize = maxSize;
|
this.maxSize = maxSize;
|
||||||
try {
|
return true;
|
||||||
size = selectSize(cameraId, null, maxSize, aspectRatio, highSpeed);
|
|
||||||
return size != null;
|
|
||||||
} catch (CameraAccessException e) {
|
|
||||||
Ln.w("Could not select camera size", e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("MissingPermission")
|
@SuppressLint("MissingPermission")
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public abstract class SurfaceCapture {
|
|||||||
/**
|
/**
|
||||||
* Called once before each capture starts, before {@link #getSize()}.
|
* Called once before each capture starts, before {@link #getSize()}.
|
||||||
*/
|
*/
|
||||||
public void prepare() throws ConfigurationException {
|
public void prepare() throws ConfigurationException, IOException {
|
||||||
// empty by default
|
// empty by default
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user