Skip to content

Commit

Permalink
Let startCamera access availableSurfaceTexture directly.
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-zhengcheng authored Jun 24, 2020
1 parent b3d7134 commit 1cae414
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public class LegacyCameraConnectionFragment extends Fragment {
public void onSurfaceTextureAvailable(
final SurfaceTexture texture, final int width, final int height) {
availableSurfaceTexture = texture;
startCamera(texture);
startCamera();
}

@Override
Expand Down Expand Up @@ -118,7 +118,7 @@ public void onResume() {
// the SurfaceTextureListener).

if (textureView.isAvailable()) {
startCamera(availableSurfaceTexture);
startCamera();
} else {
textureView.setSurfaceTextureListener(surfaceTextureListener);
}
Expand Down Expand Up @@ -148,7 +148,7 @@ private void stopBackgroundThread() {
}
}

private void startCamera(final SurfaceTexture texture) {
private void startCamera() {
int index = getCameraId();
camera = Camera.open(index);

Expand All @@ -171,7 +171,7 @@ private void startCamera(final SurfaceTexture texture) {
parameters.setPreviewSize(previewSize.getWidth(), previewSize.getHeight());
camera.setDisplayOrientation(90);
camera.setParameters(parameters);
camera.setPreviewTexture(texture);
camera.setPreviewTexture(availableSurfaceTexture);
} catch (IOException exception) {
camera.release();
}
Expand Down

0 comments on commit 1cae414

Please sign in to comment.