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 21, 2024
1 parent d84ce74 commit 5898adf
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,16 @@ class Mux {
)
ifmtCtx!!.pb(avio)
}
check(avformat.avformat_open_input(ifmtCtx, fileName, null, null) >= 0) { "open failed" }
check(avformat.avformat_find_stream_info(ifmtCtx, null as? PointerPointer<*>) >= 0) {
"can't find stream info"
}
var ret = avformat.avformat_open_input(ifmtCtx, fileName, null, null)
check(ret >= 0) { "open failed [$ret]" }
ret = avformat.avformat_find_stream_info(ifmtCtx, null as? PointerPointer<*>)
check(ret >= 0) { "can't find stream info [$ret]" }
if (logger.isDebugEnabled) {
avformat.av_dump_format(ifmtCtx, 0, fileName, 0)
}
val outputFilePath = outputFile!!.absolutePath
check(avformat.avformat_alloc_output_context2(ofmtCtx, null, null, outputFilePath) >= 0) {
"create output ctx error"
}
ret = avformat.avformat_alloc_output_context2(ofmtCtx, null, null, outputFilePath)
check(ret >= 0) { "create output ctx error [$ret]" }
val streamMapping = mutableMapOf<Int, Int>()
var streamIndex = 0

Expand Down Expand Up @@ -271,6 +270,7 @@ class Mux {
val b = ByteArray(buf_size)
val size = inputStream.read(b)
return if (size < 0) {
logger.info("input end")
avutil.AVERROR_EOF
} else {
buf.put(b, 0, size)
Expand Down

0 comments on commit 5898adf

Please sign in to comment.