mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-12-13 03:28:03 +00:00
android: for software encoding and screen size > 1200, display size reduced to half (#8167)
Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
@@ -55,6 +55,8 @@ const val MIME_TYPE = MediaFormat.MIMETYPE_VIDEO_VP9
|
||||
|
||||
// video const
|
||||
|
||||
const val MAX_SCREEN_SIZE = 1200
|
||||
|
||||
const val VIDEO_KEY_BIT_RATE = 1024_000
|
||||
const val VIDEO_KEY_FRAME_RATE = 30
|
||||
|
||||
@@ -170,6 +172,14 @@ class MainService : Service() {
|
||||
Log.d(logTag, "from rust:stop_capture")
|
||||
stopCapture()
|
||||
}
|
||||
"is_hardware_codec" -> {
|
||||
val isHwCodec = arg1.toBoolean()
|
||||
if (isHardwareCodec != isHwCodec) {
|
||||
isHardwareCodec = isHwCodec
|
||||
updateScreenInfo(resources.configuration.orientation)
|
||||
}
|
||||
|
||||
}
|
||||
else -> {
|
||||
}
|
||||
}
|
||||
@@ -245,6 +255,7 @@ class MainService : Service() {
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
private var isHardwareCodec: Boolean? = null;
|
||||
private fun updateScreenInfo(orientation: Int) {
|
||||
var w: Int
|
||||
var h: Int
|
||||
@@ -277,6 +288,12 @@ class MainService : Service() {
|
||||
Log.d(logTag,"updateScreenInfo:w:$w,h:$h")
|
||||
var scale = 1
|
||||
if (w != 0 && h != 0) {
|
||||
if (isHardwareCodec == false && (w > MAX_SCREEN_SIZE || h > MAX_SCREEN_SIZE)) {
|
||||
scale = 2
|
||||
w /= scale
|
||||
h /= scale
|
||||
dpi /= scale
|
||||
}
|
||||
if (SCREEN_INFO.width != w) {
|
||||
SCREEN_INFO.width = w
|
||||
SCREEN_INFO.height = h
|
||||
|
||||
Reference in New Issue
Block a user