File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed
lib_ass_media/src/main/java/io/github/peerless2012/ass/media Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,10 @@ import io.github.peerless2012.ass.media.type.AssRenderType
2828 * @param renderType The subtitle render type.
2929 */
3030@OptIn(UnstableApi ::class )
31- class AssHandler (val renderType : AssRenderType ) : Listener {
31+ class AssHandler (
32+ val renderType : AssRenderType ,
33+ val config : AssHandlerConfig = AssHandlerConfig ()
34+ ) : Listener {
3235
3336 /* * The ASS instance used for creating tracks and renderers. This is lazy to avoid loading
3437 * libass if the played media does not have ASS tracks. */
@@ -259,11 +262,9 @@ class AssHandler(val renderType: AssRenderType) : Listener {
259262 render.setFrameSize(videoSize.width, videoSize.height)
260263 }
261264 }
262- val totalMemoryBytes = Runtime .getRuntime().maxMemory()
263- val cacheSize = ((totalMemoryBytes / (1024 * 1024 )) / 4 ).toInt()
264- Log .i(" AssHandler" , " Ass cacheSize: ${cacheSize} MB" )
265- // https://github.com/peerless2012/libass-android/issues/48#issuecomment-3086561167
266- render.setCacheLimit(1024 , cacheSize)
265+ Log .i(" AssHandler" , " Ass cacheSize: ${config.cacheSize} MB" )
266+ Log .i(" AssHandler" , " Ass glyphSize: ${config.glyphSize} " )
267+ render.setCacheLimit(config.glyphSize, config.cacheSize)
267268 }
268269 renderCallback?.invoke(render)
269270 }
Original file line number Diff line number Diff line change 1+ package io.github.peerless2012.ass.media
2+
3+ data class AssHandlerConfig (
4+ val glyphSize : Int = 1024 ,
5+ val cacheSize : Int = 128 ){
6+ }
You can’t perform that action at this time.
0 commit comments