From ed331f2f69a4207d1d3dd1ef10be107d38bf9aca Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Wed, 24 Jul 2024 19:26:29 -0600 Subject: [PATCH] Fix last segment issue --- .../main/java/com/mrousavy/camera/core/ChunkedRecorder.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/package/android/src/main/java/com/mrousavy/camera/core/ChunkedRecorder.kt b/package/android/src/main/java/com/mrousavy/camera/core/ChunkedRecorder.kt index ea1439b..a304d37 100644 --- a/package/android/src/main/java/com/mrousavy/camera/core/ChunkedRecorder.kt +++ b/package/android/src/main/java/com/mrousavy/camera/core/ChunkedRecorder.kt @@ -95,16 +95,14 @@ class ChunkedRecordingManager(private val encoder: MediaCodec, private val outpu fun finish() { muxer.stop() muxer.release() + this.callbacks.onVideoChunkReady(filepath, chunkIndex) } } private var muxerContext: MuxerContext? = null private fun createNextMuxer(bufferInfo: BufferInfo) { - muxerContext?.let { - it.finish() - this.callbacks.onVideoChunkReady(it.filepath, it.chunkIndex) - } + muxerContext?.finish() chunkIndex++ val newFileName = "$chunkIndex.mp4"