mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-04-20 19:45:00 +00:00
Retrieve screen info once
The method getScreenInfo() is synchronized, and the result may change between calls. Call it once and store the result in a local variable.
This commit is contained in:
parent
f903cd376d
commit
12e269b9f0
1 changed files with 3 additions and 2 deletions
|
@ -62,8 +62,9 @@ public class ScreenEncoder implements Device.RotationListener {
|
|||
do {
|
||||
MediaCodec codec = createCodec();
|
||||
IBinder display = createDisplay();
|
||||
Rect contentRect = device.getScreenInfo().getContentRect();
|
||||
Rect videoRect = device.getScreenInfo().getVideoSize().toRect();
|
||||
ScreenInfo screenInfo = device.getScreenInfo();
|
||||
Rect contentRect = screenInfo.getContentRect();
|
||||
Rect videoRect = screenInfo.getVideoSize().toRect();
|
||||
setSize(format, videoRect.width(), videoRect.height());
|
||||
configure(codec, format);
|
||||
Surface surface = codec.createInputSurface();
|
||||
|
|
Loading…
Add table
Reference in a new issue