fix: suppress ASS GL thread crash, update ass-media to 0.4.0

This commit is contained in:
edde746
2026-03-10 06:41:43 +01:00
parent 166e73cdaa
commit af2ac2c993
3 changed files with 22 additions and 3 deletions
+3 -3
View File
@@ -141,8 +141,8 @@ dependencies {
// FFmpeg audio decoder for unsupported codecs (ALAC, DTS, TrueHD, etc.)
implementation("org.jellyfin.media3:media3-ffmpeg-decoder:1.9.0+1")
// libass-android for ASS/SSA subtitle rendering (fork with font buffering fix)
implementation(files("libs/ass-media.aar"))
// libass-android for ASS/SSA subtitle rendering
implementation("io.github.peerless2012:ass-media:0.4.0")
// ass-kt core library (needed for AssRender.setFontScale)
implementation("io.github.peerless2012:ass-kt:0.4.0-beta01")
implementation("io.github.peerless2012:ass-kt:0.4.0")
}
Binary file not shown.
@@ -95,6 +95,8 @@ class ExoPlayerCore(private val activity: Activity) : Player.Listener {
// Codec capability caches — codec support doesn't change at runtime
private val hwAudioDecoderCache = HashMap<String, Boolean>()
private val tunneledPlaybackCache = HashMap<String, Boolean>()
private var assGlCrashHandlerInstalled = false
}
private var surfaceView: SurfaceView? = null
@@ -446,6 +448,23 @@ class ExoPlayerCore(private val activity: Activity) : Player.Listener {
// Initialize handler (registers as Player.Listener, creates Handler)
handler.init(exoPlayer!!)
// Suppress ass-media GL thread crash when EGL init partially fails (e.g. Tegra).
// AssRender.onSurfaceDestroyed() accesses uninitialized glProgram lateinit property
// during error cleanup, which is a bug in the library. The render thread dying only
// affects ASS subtitle GPU rendering; non-ASS subtitles are unaffected.
if (!assGlCrashHandlerInstalled) {
assGlCrashHandlerInstalled = true
val previousHandler = Thread.getDefaultUncaughtExceptionHandler()
Thread.setDefaultUncaughtExceptionHandler { thread, throwable ->
if (thread.name.contains("AssTexRenderThread") &&
throwable is UninitializedPropertyAccessException) {
Log.e(TAG, "ASS GL thread crash suppressed (EGL init failure)", throwable)
} else {
previousHandler?.uncaughtException(thread, throwable)
}
}
}
exoPlayer!!.addListener(this)
exoPlayer!!.addAnalyticsListener(decoderHangListener)
surfaceView?.let { exoPlayer!!.setVideoSurfaceView(it) }