add enable directx option, android software encoding half resolution option (#8435)

* add option enable directx capture screen, default true

Signed-off-by: 21pages <sunboeasy@gmail.com>

* option android software encoding half scale, check isStart flag

Signed-off-by: 21pages <sunboeasy@gmail.com>

---------

Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
21pages
2024-06-21 18:54:32 +08:00
committed by GitHub
parent ff2e055a5a
commit 0f6538c1a7
50 changed files with 133 additions and 30 deletions

View File

@@ -103,6 +103,9 @@ class MainService : Service() {
put("scale",SCREEN_INFO.scale)
}.toString()
}
"is_start" -> {
isStart.toString()
}
else -> ""
}
}
@@ -172,10 +175,10 @@ class MainService : Service() {
Log.d(logTag, "from rust:stop_capture")
stopCapture()
}
"is_hardware_codec" -> {
val isHwCodec = arg1.toBoolean()
if (isHardwareCodec != isHwCodec) {
isHardwareCodec = isHwCodec
"half_scale" -> {
val halfScale = arg1.toBoolean()
if (isHalfScale != halfScale) {
isHalfScale = halfScale
updateScreenInfo(resources.configuration.orientation)
}
@@ -251,7 +254,7 @@ class MainService : Service() {
super.onDestroy()
}
private var isHardwareCodec: Boolean? = null;
private var isHalfScale: Boolean? = null;
private fun updateScreenInfo(orientation: Int) {
var w: Int
var h: Int
@@ -284,7 +287,7 @@ 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)) {
if (isHalfScale == true && (w > MAX_SCREEN_SIZE || h > MAX_SCREEN_SIZE)) {
scale = 2
w /= scale
h /= scale