mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 17:27:45 +00:00
Fixed Camera capture crash on API <= 19.
On older versions of Android, TextureView#getBitmap() needs to be called on the main thread. On mid range phones, this is ~50ms. Normally that'd be bad, but the UI isn't doing anything at that point anyway. Fixes #8232
This commit is contained in:
parent
2c5fa155ae
commit
34770a2333
@ -193,12 +193,12 @@ public class Camera1Fragment extends Fragment implements TextureView.SurfaceText
|
|||||||
shutterSound.play();
|
shutterSound.play();
|
||||||
orderEnforcer.reset();
|
orderEnforcer.reset();
|
||||||
|
|
||||||
LifecycleBoundTask.run(getLifecycle(), () -> {
|
|
||||||
Stopwatch fastCaptureTimer = new Stopwatch("Fast Capture");
|
Stopwatch fastCaptureTimer = new Stopwatch("Fast Capture");
|
||||||
|
|
||||||
Bitmap preview = cameraPreview.getBitmap();
|
Bitmap preview = cameraPreview.getBitmap();
|
||||||
fastCaptureTimer.split("captured");
|
fastCaptureTimer.split("captured");
|
||||||
|
|
||||||
|
LifecycleBoundTask.run(getLifecycle(), () -> {
|
||||||
Bitmap full = preview;
|
Bitmap full = preview;
|
||||||
if (Build.VERSION.SDK_INT < 28) {
|
if (Build.VERSION.SDK_INT < 28) {
|
||||||
PointF scale = getScaleTransform(cameraPreview.getWidth(), cameraPreview.getHeight(), properties.getPreviewWidth(), properties.getPreviewHeight());
|
PointF scale = getScaleTransform(cameraPreview.getWidth(), cameraPreview.getHeight(), properties.getPreviewWidth(), properties.getPreviewHeight());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user