Display and control your Android device
Simplify ScreenEncoder more
Romain Vimont74ece9b45b6e
diff --git a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.javaindex 2377ec02..651affde 100644--- a/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java+++ b/server/src/main/java/com/genymobile/scrcpy/ScreenEncoder.java@@ -61,7 +61,7 @@ public class ScreenEncoder implements Device.RotationListener {}private void internalStreamScreen(Device device, FileDescriptor fd) throws IOException {- MediaFormat format = createFormat(bitRate, maxFps, DEFAULT_I_FRAME_INTERVAL);+ MediaFormat format = createFormat(bitRate, maxFps);device.setRotationListener(this);boolean alive;try {@@ -151,14 +151,14 @@ public class ScreenEncoder implements Device.RotationListener {return MediaCodec.createEncoderByType(MediaFormat.MIMETYPE_VIDEO_AVC);}- private static MediaFormat createFormat(int bitRate, int maxFps, int iFrameInterval) {+ private static MediaFormat createFormat(int bitRate, int maxFps) {MediaFormat format = new MediaFormat();format.setString(MediaFormat.KEY_MIME, MediaFormat.MIMETYPE_VIDEO_AVC);format.setInteger(MediaFormat.KEY_BIT_RATE, bitRate);// must be present to configure the encoder, but does not impact the actual frame rate, which is variableformat.setInteger(MediaFormat.KEY_FRAME_RATE, 60);format.setInteger(MediaFormat.KEY_COLOR_FORMAT, MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface);- format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, iFrameInterval);+ format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, DEFAULT_I_FRAME_INTERVAL);// display the very first frame, and recover from bad quality when no new framesformat.setLong(MediaFormat.KEY_REPEAT_PREVIOUS_FRAME_AFTER, REPEAT_FRAME_DELAY_US); // µsif (maxFps > 0) {