mirror of
https://github.com/samsonjs/media.git
synced 2026-03-29 10:05:48 +00:00
Instantiate SurfaceView on main thread
On some devices/builds it seems that the `SurfaceView` constructor tries to create a handler. Move instantiation to the main thread when getting the debug surface view so that handler creation succeeds. PiperOrigin-RevId: 505745387
This commit is contained in:
parent
d7cc12c0da
commit
506aa2c999
1 changed files with 1 additions and 2 deletions
|
|
@ -738,9 +738,9 @@ public final class TransformerActivity extends AppCompatActivity {
|
|||
|
||||
// Update the UI on the main thread and wait for the output surface to be available.
|
||||
CountDownLatch surfaceCreatedCountDownLatch = new CountDownLatch(1);
|
||||
SurfaceView surfaceView = new SurfaceView(/* context= */ TransformerActivity.this);
|
||||
runOnUiThread(
|
||||
() -> {
|
||||
surfaceView = new SurfaceView(/* context= */ TransformerActivity.this);
|
||||
AspectRatioFrameLayout debugFrame = checkNotNull(TransformerActivity.this.debugFrame);
|
||||
debugFrame.addView(surfaceView);
|
||||
debugFrame.setAspectRatio((float) width / height);
|
||||
|
|
@ -772,7 +772,6 @@ public final class TransformerActivity extends AppCompatActivity {
|
|||
Thread.currentThread().interrupt();
|
||||
return null;
|
||||
}
|
||||
this.surfaceView = surfaceView;
|
||||
return surfaceView;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue