fix(ffmpeg): serialize native FFmpegKit sessions - #1153
Open
3316891527 wants to merge 2 commits into
Open
Conversation
Fixes AAswordman#1151. FFmpegKit's bundled libavcodec can abort on Android 17 when overlapping execute/probe calls destroy the same pthread mutex twice. Route all native sessions through one process lock.
3316891527
marked this pull request as ready for review
September 8, 2026 17:03
2 tasks
FFprobeKit.getMediaInformation returns MediaInformationSession, not FFprobeSession. Keep the original two-backslash scale filter string so Kotlin compiles.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
变更说明 / Description
视频剪辑闪退的崩溃栈在
libavcodec.so对已销毁 mutex 再次pthread_mutex_destroy,Android 17 FORTIFY 会直接 SIGABRT。FFmpegKit 自带 native 不保证并发 session 安全,这次把所有 execute/probe 收到一把进程锁里。背景与动机 / Context and motivation
Fixes #1151. tombstone 四次都是:
FORTIFY: pthread_mutex_destroy called on a destroyed mutex,下一帧在 APK 自带libavcodec.so。FFmpegKit 官方有同样的并发崩溃记录(arthenica/ffmpeg-kit#120)。应用里ffmpeg_execute、ffmpeg_info、ffmpeg_convert、file_info探针和媒体转码都会直接进 native,没有排队。改动范围 / Changes
FFmpegUtil以synchronized串行化FFmpegKit.execute/FFprobeKit.getMediaInformationStandardFFmpegTool不再直接调 FFmpegKit;转码成功后不再重复 probe 一次FFmpegUtilTest覆盖 scale filter 转义libavcodec.so兼容性与风险 / Compatibility and risks
重叠的 FFmpeg/FFprobe 会排队而不是并行,剪辑时间可能变长。这不修 native 里的双重 destroy 本身;若单 session 内部仍然会 abort,需要换 FFmpegKit 构建。
关联 Issue / Related issue
Fixes #1151
验证方式 / Verification
检查清单 / Checklist
dev