Display and control your Android device
Request limited color range by default
Simon Chanbf625790facc
diff --git a/server/src/main/java/com/genymobile/scrcpy/SurfaceEncoder.java b/server/src/main/java/com/genymobile/scrcpy/SurfaceEncoder.javaindex 28435c09..8eda8231 100644--- a/server/src/main/java/com/genymobile/scrcpy/SurfaceEncoder.java+++ b/server/src/main/java/com/genymobile/scrcpy/SurfaceEncoder.java@@ -3,6 +3,7 @@ package com.genymobile.scrcpy;import android.media.MediaCodec;import android.media.MediaCodecInfo;import android.media.MediaFormat;+import android.os.Build;import android.os.Looper;import android.os.SystemClock;import android.view.Surface;@@ -220,6 +221,9 @@ public class SurfaceEncoder implements AsyncProcessor {// 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);+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {+ format.setInteger(MediaFormat.KEY_COLOR_RANGE, MediaFormat.COLOR_RANGE_LIMITED);+ }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); // µs