Skip to content

Commit

Permalink
bug: 修复视频转录过程中进程挂了 TencentBlueKing#2775
Browse files Browse the repository at this point in the history
  • Loading branch information
felixncheng committed Nov 20, 2024
1 parent c212be6 commit 25d52a8
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}

Expand All @@ -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")
Expand Down

0 comments on commit 25d52a8

Please sign in to comment.