diff --git a/src/backend/media/biz-media/src/main/kotlin/com/tencent/bkrepo/media/stream/RemuxRecordingListener.kt b/src/backend/media/biz-media/src/main/kotlin/com/tencent/bkrepo/media/stream/RemuxRecordingListener.kt index 21f435dcc3..26e9e72b9f 100644 --- a/src/backend/media/biz-media/src/main/kotlin/com/tencent/bkrepo/media/stream/RemuxRecordingListener.kt +++ b/src/backend/media/biz-media/src/main/kotlin/com/tencent/bkrepo/media/stream/RemuxRecordingListener.kt @@ -52,7 +52,12 @@ class RemuxRecordingListener( * */ private var fileName: String? = null + private var startFailed = AtomicBoolean(false) + override fun handler(packet: StreamPacket) { + if (startFailed.get()) { + return + } pipeOut.write(packet.getData()) } @@ -65,7 +70,12 @@ class RemuxRecordingListener( tempFilePath = Paths.get(path, tempFileName) mux = Mux(pipeIn, tempFilePath!!.toFile()) val remuxFuture = threadPool.submit { - mux!!.start() + try { + mux!!.start() + } catch (e: Exception) { + logger.error("Mux start failed", e) + startFailed.set(true) + } } if (remuxFuture.isDone) { throw IllegalStateException("Remux start error")