카메라2번 연결 시 자동 절체 컨텐츠 재생 처리

해제시 1번 카메라 절체 처리 v2
This commit is contained in:
seiki7788 2025-03-17 09:34:31 +09:00
parent 936d804d1d
commit 54da4aae79
2 changed files with 66 additions and 16 deletions

View File

@ -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()) {
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,
1280,
720,
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()) {
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,
1280,
720,
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

View File

@ -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")