Fix retry opening camera if there is an exception during getParameters in Camera1Session
Bug: webrtc:8258 Change-Id: I27190bc57d9e80df3a40aac9e7114554289c2563 Reviewed-on: https://webrtc-review.googlesource.com/47820 Reviewed-by: Magnus Jedvert <magjed@webrtc.org> Commit-Queue: Magnus Jedvert <magjed@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23210}
This commit is contained in:
committed by
Commit Bot
parent
5f2bb62f71
commit
df3630d65d
@ -86,12 +86,17 @@ class Camera1Session implements CameraSession {
|
||||
final android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo();
|
||||
android.hardware.Camera.getCameraInfo(cameraId, info);
|
||||
|
||||
final android.hardware.Camera.Parameters parameters = camera.getParameters();
|
||||
final CaptureFormat captureFormat =
|
||||
findClosestCaptureFormat(parameters, width, height, framerate);
|
||||
final Size pictureSize = findClosestPictureSize(parameters, width, height);
|
||||
|
||||
updateCameraParameters(camera, parameters, captureFormat, pictureSize, captureToTexture);
|
||||
final CaptureFormat captureFormat;
|
||||
try {
|
||||
final android.hardware.Camera.Parameters parameters = camera.getParameters();
|
||||
captureFormat = findClosestCaptureFormat(parameters, width, height, framerate);
|
||||
final Size pictureSize = findClosestPictureSize(parameters, width, height);
|
||||
updateCameraParameters(camera, parameters, captureFormat, pictureSize, captureToTexture);
|
||||
} catch (RuntimeException e) {
|
||||
camera.release();
|
||||
callback.onFailure(FailureType.ERROR, e.getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!captureToTexture) {
|
||||
final int frameSize = captureFormat.frameSize();
|
||||
|
||||
Reference in New Issue
Block a user