An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.
Rust androidanydeskdartflatpakflutterflutter-appsioslinuxmacosp2prdpremote-controlremote-desktoprustrust-langteamviewervncwaylandwindows
fix android mediacodec encoding align (#8121)
21pages49b0630752ce
diff --git a/Cargo.lock b/Cargo.lockindex b48763554..7f7f0be6a 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -3037,8 +3037,8 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"[[package]]name = "hwcodec"-version = "0.4.10"-source = "git+https://github.com/21pages/hwcodec#9cb895fdaea198dd72bd75980109dbd05a059a60"+version = "0.4.11"+source = "git+https://github.com/21pages/hwcodec#a5864080e41836b94feb9f73732280c651162fec"dependencies = ["bindgen 0.59.2","cc",diff --git a/flutter/android/app/src/main/kotlin/com/carriez/flutter_hbb/MainActivity.kt b/flutter/android/app/src/main/kotlin/com/carriez/flutter_hbb/MainActivity.ktindex 230d8ec71..6ab9db6e8 100644--- a/flutter/android/app/src/main/kotlin/com/carriez/flutter_hbb/MainActivity.kt+++ b/flutter/android/app/src/main/kotlin/com/carriez/flutter_hbb/MainActivity.kt@@ -265,6 +265,9 @@ class MainActivity : FlutterActivity() {w = dm.widthPixelsh = dm.heightPixels}+ val align = 64+ w = (w + align - 1) / align * align+ h = (h + align - 1) / align * aligncodecs.forEach { codec ->val codecObject = JSONObject()codecObject.put("name", codec.name)@@ -281,21 +284,23 @@ class MainActivity : FlutterActivity() {hw = true}}+ if (hw != true) {+ return@forEach+ }codecObject.put("hw", hw)var mime_type = ""codec.supportedTypes.forEach { type ->- if (listOf("video/avc", "video/hevc", "video/x-vnd.on2.vp8", "video/x-vnd.on2.vp9", "video/av01").contains(type)) {+ if (listOf("video/avc", "video/hevc").contains(type)) { // "video/x-vnd.on2.vp8", "video/x-vnd.on2.vp9", "video/av01"mime_type = type;}}if (mime_type.isNotEmpty()) {codecObject.put("mime_type", mime_type)val caps = codec.getCapabilitiesForType(mime_type)- var usable = true;if (codec.isEncoder) {// Encoder‘s max_height and max_width are interchangeableif (!caps.videoCapabilities.isSizeSupported(w,h) && !caps.videoCapabilities.isSizeSupported(h,w)) {- usable = false+ return@forEach}}codecObject.put("min_width", caps.videoCapabilities.supportedWidths.lower)@@ -307,7 +312,7 @@ class MainActivity : FlutterActivity() {val nv12 = caps.colorFormats.contains(COLOR_FormatYUV420SemiPlanar)codecObject.put("nv12", nv12)if (!(nv12 || surface)) {- usable = false+ return@forEach}codecObject.put("min_bitrate", caps.videoCapabilities.bitrateRange.lower / 1000)codecObject.put("max_bitrate", caps.videoCapabilities.bitrateRange.upper / 1000)@@ -316,9 +321,10 @@ class MainActivity : FlutterActivity() {codecObject.put("low_latency", caps.isFeatureSupported(MediaCodecInfo.CodecCapabilities.FEATURE_LowLatency))}}- if (usable) {- codecArray.put(codecObject)+ if (!codec.isEncoder) {+ return@forEach}+ codecArray.put(codecObject)}}val result = JSONObject()diff --git a/libs/scrap/src/android/ffi.rs b/libs/scrap/src/android/ffi.rsindex 02f73667a..5a511a5dd 100644--- a/libs/scrap/src/android/ffi.rs+++ b/libs/scrap/src/android/ffi.rs@@ -178,8 +178,8 @@ pub struct MediaCodecInfo {#[derive(Debug, Deserialize, Clone)]pub struct MediaCodecInfos {pub version: usize,- pub w: usize,- pub h: usize,+ pub w: usize, // aligned+ pub h: usize, // alignedpub codecs: Vec<MediaCodecInfo>,}