Skip to content

Commit

Permalink
fix(core): avoid instantiation of transform matrix each frames
Browse files Browse the repository at this point in the history
  • Loading branch information
ThibaultBee committed Nov 16, 2023
1 parent 56c552c commit 0626392
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ class VideoMediaCodecEncoder(
private val executor = Executors.newSingleThreadExecutor()
private var isRunning = false
private var surfaceTexture: SurfaceTexture? = null
private val stMatrix = FloatArray(16)

val inputSurface: Surface?
get() = surfaceTexture?.let { Surface(surfaceTexture) }

Expand Down Expand Up @@ -193,12 +195,10 @@ class VideoMediaCodecEncoder(
if (!isRunning) {
return
}

executor.execute {
eglSurface?.let {
it.makeCurrent()
surfaceTexture.updateTexImage()
val stMatrix = FloatArray(16)
surfaceTexture.getTransformMatrix(stMatrix)

// Use the identity matrix for MVP so our 2x2 FULL_RECTANGLE covers the viewport.
Expand Down

0 comments on commit 0626392

Please sign in to comment.