mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-04-20 03:25:03 +00:00
Use camera prepare() step
For consistency with screen capture.
Refs b60e174780
This commit is contained in:
parent
91373d906b
commit
df74cceb6f
2 changed files with 13 additions and 12 deletions
|
@ -80,14 +80,21 @@ public class CameraCapture extends SurfaceCapture {
|
|||
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);
|
||||
if (size == null) {
|
||||
throw new IOException("Could not select camera size");
|
||||
}
|
||||
|
||||
Ln.i("Using camera '" + cameraId + "'");
|
||||
cameraDevice = openCamera(cameraId);
|
||||
} catch (CameraAccessException | InterruptedException e) {
|
||||
} catch (CameraAccessException e) {
|
||||
throw new IOException(e);
|
||||
}
|
||||
}
|
||||
|
@ -232,13 +239,7 @@ public class CameraCapture extends SurfaceCapture {
|
|||
}
|
||||
|
||||
this.maxSize = maxSize;
|
||||
try {
|
||||
size = selectSize(cameraId, null, maxSize, aspectRatio, highSpeed);
|
||||
return size != null;
|
||||
} catch (CameraAccessException e) {
|
||||
Ln.w("Could not select camera size", e);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@SuppressLint("MissingPermission")
|
||||
|
|
|
@ -46,7 +46,7 @@ public abstract class SurfaceCapture {
|
|||
/**
|
||||
* Called once before each capture starts, before {@link #getSize()}.
|
||||
*/
|
||||
public void prepare() throws ConfigurationException {
|
||||
public void prepare() throws ConfigurationException, IOException {
|
||||
// empty by default
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue