Commit 6c82e4e3 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

call: cleanup

Change-Id: Icdf1397ad0a3fd4cbfc2e35921ae44ff96c3d027
parent e401080f
......@@ -94,6 +94,7 @@ import net.jami.services.HardwareService.AudioState
import net.jami.services.NotificationService
import java.util.*
import javax.inject.Inject
import kotlin.math.max
import kotlin.math.min
@AndroidEntryPoint
......@@ -1041,10 +1042,7 @@ class CallFragment : BaseSupportFragment<CallPresenter, CallView>(), CallView,
val bufferRect = RectF(0f, 0f, mPreviewHeight.toFloat(), mPreviewWidth.toFloat())
bufferRect.offset(centerX - bufferRect.centerX(), centerY - bufferRect.centerY())
matrix.setRectToRect(viewRect, bufferRect, Matrix.ScaleToFit.FILL)
val scale = Math.max(
viewHeight.toFloat() / mPreviewHeight,
viewWidth.toFloat() / mPreviewWidth
)
val scale = max(viewHeight.toFloat() / mPreviewHeight, viewWidth.toFloat() / mPreviewWidth)
matrix.postScale(scale, scale, centerX, centerY)
matrix.postRotate((90 * (rotation - 2)).toFloat(), centerX, centerY)
} else if (Surface.ROTATION_180 == rotation) {
......
......@@ -327,7 +327,7 @@ class HardwareServiceImpl(
videoSurfaces[id]?.get()?.let { holder ->
shm.window = startVideo(id, holder.surface, width, height)
if (shm.window == 0L) {
Log.w(TAG, "DJamiService.decodingStarted() no window !")
Log.w(TAG, "decodingStarted() no window !")
} else {
videoEvents.onNext(VideoEvent(shm.id, started = true, w = shm.w, h = shm.h))
}
......@@ -431,7 +431,7 @@ class HardwareServiceImpl(
if (mIsCapturing && mCapturingId != null && mCapturingId == camId) {
return
}
val cam = camId ?: if (mCapturingId != null) mCapturingId else cameraService.switchInput(true)
val cam = camId ?: mCapturingId ?: cameraService.switchInput(true)
val videoParams = cameraService.getParams(cam)
if (videoParams == null) {
Log.w(TAG, "startCapture: no video parameters ")
......@@ -456,10 +456,10 @@ class HardwareServiceImpl(
videoParams.codec = null
}
}
Log.w(TAG, "startCapture: call " + cam + " " + videoParams.codec + " useHardwareCodec:" + useHardwareCodec + " bitrate:" + mPreferenceService.bitrate)
Log.w(TAG, "startCapture: cam " + cam + " " + videoParams.codec + " useHardwareCodec:" + useHardwareCodec + " bitrate:" + mPreferenceService.bitrate)
mIsCapturing = true
mCapturingId = videoParams.id
Log.d(TAG, "startCapture: startCapture " + videoParams.id + " " + videoParams.width + "x" + videoParams.height + " rot" + videoParams.rotation)
Log.d(TAG, "startCapture: openCamera " + videoParams.id + " " + videoParams.width + "x" + videoParams.height + " rot" + videoParams.rotation)
mUiScheduler.scheduleDirect {
cameraService.openCamera(videoParams, surface,
object : CameraListener {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment