From 54da4aae79118d4802f3640956e2dda5e6897146 Mon Sep 17 00:00:00 2001 From: seiki7788 Date: Mon, 17 Mar 2025 09:34:31 +0900 Subject: [PATCH] =?UTF-8?q?=EC=B9=B4=EB=A9=94=EB=9D=BC2=EB=B2=88=20?= =?UTF-8?q?=EC=97=B0=EA=B2=B0=20=EC=8B=9C=20=EC=9E=90=EB=8F=99=20=EC=A0=88?= =?UTF-8?q?=EC=B2=B4=20=EC=BB=A8=ED=85=90=EC=B8=A0=20=EC=9E=AC=EC=83=9D=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC=20=ED=95=B4=EC=A0=9C=EC=8B=9C=201=EB=B2=88?= =?UTF-8?q?=20=EC=B9=B4=EB=A9=94=EB=9D=BC=20=EC=A0=88=EC=B2=B4=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=20v2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/tutpro/baresip/plus/BaresipService.kt | 81 +++++++++++++++---- .../com/tutpro/baresip/plus/CallHistory.kt | 1 + 2 files changed, 66 insertions(+), 16 deletions(-) diff --git a/app/src/main/kotlin/com/tutpro/baresip/plus/BaresipService.kt b/app/src/main/kotlin/com/tutpro/baresip/plus/BaresipService.kt index 69065f1..97158db 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/plus/BaresipService.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/plus/BaresipService.kt @@ -703,24 +703,52 @@ class BaresipService: Service() { var updateDate = LocalDateTime.now() while (running) { if(File("/mnt/obb/camera_near.rgb565.done").exists() && !File("/mnt/obb/camera_near.jpg").exists()) { - val nearBuf = Utils.readFileToByteBuffer("/mnt/obb/camera_near.rgb565") - Utils.saveRGB565AsJPG( - applicationContext, - nearBuf, - 1280, - 720, - "/mnt/obb/camera_near.jpg" - ) + try { + val nearBuf = Utils.readFileToByteBuffer("/mnt/obb/camera_near.rgb565") + val bufSize : Int = nearBuf.capacity() / 2 + var width : Int = 1280 + var height : Int = 720 + if(bufSize == 1280 * 720) { + width = 1280 + height = 720 + } else if(bufSize == 1920 * 1080) { + width = 1920 + height = 1080 + } + Utils.saveRGB565AsJPG( + applicationContext, + nearBuf, + width, + height, + "/mnt/obb/camera_near.jpg" + ) + } catch(e : Exception) { + e.printStackTrace() + } } if(File("/mnt/obb/camera_far.rgb565.done").exists() && !File("/mnt/obb/camera_far.jpg").exists()) { - val farBuf = Utils.readFileToByteBuffer("/mnt/obb/camera_far.rgb565") - Utils.saveRGB565AsJPG( - applicationContext, - farBuf, - 1280, - 720, - "/mnt/obb/camera_far.jpg" - ) + try { + val farBuf = Utils.readFileToByteBuffer("/mnt/obb/camera_far.rgb565") + val bufSize : Int = farBuf.capacity() / 2 + var width : Int = 1280 + var height : Int = 720 + if(bufSize == 1280 * 720) { + width = 1280 + height = 720 + } else if(bufSize == 1920 * 1080) { + width = 1920 + height = 1080 + } + Utils.saveRGB565AsJPG( + applicationContext, + farBuf, + width, + height, + "/mnt/obb/camera_far.jpg" + ) + } catch(e : Exception) { + e.printStackTrace() + } } //delay(800) // 1초마다 실행 @@ -845,7 +873,23 @@ class BaresipService: Service() { val camera1 = Utils.checkCameraConnection(0) val camera2 = Utils.checkCameraConnection(1) Utils.propertySet("sys.ritosip.camera1.status", camera1) + //call.setVideoSource(!BaresipService.cameraFront) + val prevCamera2 = Utils.propertyGet("sys.ritosip.camera2.status") Utils.propertySet("sys.ritosip.camera2.status", camera2) + if(camera2 != prevCamera2) { + if(uas.size > 0) { + val ua = uas[0] + val call = ua.currentCall() + + if(call != null) { + if(camera2 == "plugin") { + call.setVideoSource(false) + } else { + call.setVideoSource(true) + } + } + } + } delay(100) // 1초마다 실행 @@ -1015,6 +1059,11 @@ class BaresipService: Service() { "ritosip v${BuildConfig.VERSION_NAME} " + "(Android ${VERSION.RELEASE}/${System.getProperty("os.arch") ?: "?"})" ) + + + Api.log_level_set(0) + Log.logLevelSet(0) + Api.uag_enable_sip_trace(true) }.start() isServiceRunning = true diff --git a/app/src/main/kotlin/com/tutpro/baresip/plus/CallHistory.kt b/app/src/main/kotlin/com/tutpro/baresip/plus/CallHistory.kt index f70eb3c..279ed52 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/plus/CallHistory.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/plus/CallHistory.kt @@ -67,6 +67,7 @@ class CallHistoryNew(val aor: String, val peerUri: String, val direction: String RandomAccessFile(file, "rw").use { raf -> raf.fd.sync() // eMMC에 확실히 기록 + raf.close() } } catch (e: IOException) { Log.e(TAG, "OutputStream exception: $e")