Refactor to call getSize() only once
Avoid to call capture.getSize() (provided by the SurfaceCapture implementation) twice. PR #5370 <https://github.com/Genymobile/scrcpy/pull/5370>
This commit is contained in:
parent
5f0480c039
commit
68e54d9b0b
@ -68,12 +68,16 @@ public class SurfaceEncoder implements AsyncProcessor {
|
||||
capture.init();
|
||||
|
||||
try {
|
||||
streamer.writeVideoHeader(capture.getSize());
|
||||
|
||||
boolean alive;
|
||||
boolean headerWritten = false;
|
||||
|
||||
do {
|
||||
Size size = capture.getSize();
|
||||
if (!headerWritten) {
|
||||
streamer.writeVideoHeader(size);
|
||||
headerWritten = true;
|
||||
}
|
||||
|
||||
format.setInteger(MediaFormat.KEY_WIDTH, size.getWidth());
|
||||
format.setInteger(MediaFormat.KEY_HEIGHT, size.getHeight());
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user