Skip to content

Commit

Permalink
fix(core): streamer: recreate a SurfaceTexture on stopStream if the e…
Browse files Browse the repository at this point in the history
…ncoder has not been changed
  • Loading branch information
ThibaultBee committed Nov 26, 2024
1 parent 6f88155 commit 7676c8c
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,20 @@ open class DefaultStreamer(

// Only reset if the encoder is the same. Otherwise, it is already configured.
if (previousVideoEncoder == videoEncoderInternal) {
/**
* Workaround to avoid spurious frame from the SurfaceTexture on the new stream when
* SurfaceTexture is not changed.
*/
surfaceProcessor?.let { processor ->
videoSourceInternal?.let { source ->
source.outputSurface?.let { surface -> processor.removeInputSurface(surface) }
source.outputSurface = processor.createInputSurface(
source.infoProvider.getSurfaceSize(
videoConfig!!.resolution, targetRotation
)
)
}
}
videoEncoderInternal?.reset()
}
}
Expand Down

0 comments on commit 7676c8c

Please sign in to comment.