Skip to content

Commit

Permalink
Update ScreenEncoder.java
Browse files Browse the repository at this point in the history
  • Loading branch information
cagnulein committed Oct 30, 2024
1 parent 2d3b7e7 commit 018d0ab
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,18 @@ private static void setSize(MediaFormat format, int width, int height) {
}

private static void setDisplaySurface(IBinder display, Surface surface, Rect deviceRect, Rect displayRect) {
Ln.d("setDisplaySurface 1");
SurfaceControl.openTransaction();
try {
Ln.d("setDisplaySurface 2");
SurfaceControl.setDisplaySurface(display, surface);
Ln.d("setDisplaySurface 3");
SurfaceControl.setDisplayProjection(display, 0, deviceRect, displayRect);
Ln.d("setDisplaySurface 4");
SurfaceControl.setDisplayLayerStack(display, 0);
Ln.d("setDisplaySurface 5");
} finally {
Ln.d("setDisplaySurface 6");
SurfaceControl.closeTransaction();
}
}
Expand Down Expand Up @@ -134,7 +140,9 @@ public void streamScreen(Device device, OutputStream outputStream) throws IOExce
try {
boolean secure = Build.VERSION.SDK_INT < Build.VERSION_CODES.R || (Build.VERSION.SDK_INT == Build.VERSION_CODES.R && !"S".equals(
Build.VERSION.CODENAME));
Ln.d("Creating display...");
display = createDisplay("scrcpy", secure);
Ln.d("Display created " + display.toString());
setDisplaySurface(display, surface, deviceRect, videoRect);
Ln.d("Display: using SurfaceControl API");
} catch (Exception surfaceControlException) {
Expand Down

0 comments on commit 018d0ab

Please sign in to comment.