forJrking / KLuban

Lifecycle + Kotlin 协程 + flow + LiveData + Glide 识别和内存优化 + Luban采样算法 = KLuban图片压缩
354 stars 34 forks source link

InputStream mark问题 #32

Open gaowch opened 1 year ago

gaowch commented 1 year ago

Mark has been invalidated, pos: 1300464 markLimit: 5242880

xiaoyvyv commented 1 year ago

+1

xiaoyvyv commented 1 year ago

选取大图 2250x4000 9MB 时报错: Mark has been invalidated, pos: xxx markLimit: xxx


com.forjrking.lubankt.io.BufferedInputStreamWrap$InvalidMarkException: Mark has been invalidated, pos: 1701080 markLimit: 5242880
    at com.forjrking.lubankt.io.BufferedInputStreamWrap.reset(BufferedInputStreamWrap.java:318)
    at com.forjrking.lubankt.Checker$getOrientation$reader$1.getOrientation(Checker.kt:137)
    at com.forjrking.lubankt.Checker.getOrientationInternal(Checker.kt:147)
    at com.forjrking.lubankt.Checker.getOrientation(Checker.kt:141)
    at com.forjrking.lubankt.Checker.getRotateDegree(Checker.kt:167)
    at com.forjrking.lubankt.CompressEngine.compress(CompressEngine.kt:48)
    at com.forjrking.lubankt.AbstractFileBuilder$compress$2.invokeSuspend(Luban.kt:294)
    at com.forjrking.lubankt.AbstractFileBuilder$compress$2.invoke(Unknown Source:10)
    at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:78)
    at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:167)
    at kotlinx.coroutines.BuildersKt.withContext(Unknown Source:1)
    at com.forjrking.lubankt.AbstractFileBuilder.compress(Luban.kt:272)
    at com.forjrking.lubankt.SingleRequestBuild$asyncRun$1$1.invokeSuspend(Luban.kt:320)
    at com.forjrking.lubankt.SingleRequestBuild$asyncRun$1$1.invoke(Unknown Source:10)
    at kotlinx.coroutines.flow.SafeFlow.collectSafely(Builders.kt:61)
    at kotlinx.coroutines.flow.AbstractFlow.collect(Flow.kt:230)
    at kotlinx.coroutines.flow.internal.ChannelFlowOperatorImpl.flowCollect(ChannelFlow.kt:195)
    at kotlinx.coroutines.flow.internal.ChannelFlowOperator.collectTo$suspendImpl(ChannelFlow.kt:157)
    at kotlinx.coroutines.flow.internal.ChannelFlowOperator.collectTo(Unknown Source:0)
    at kotlinx.coroutines.flow.internal.ChannelFlow$collectToFun$1.invokeSuspend(ChannelFlow.kt:60)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
    at java.lang.Thread.run(Thread.java:1012)
    at com.forjrking.lubankt.CompressThreadFactory$newThread$thread$1.run(Luban.kt:403)
forJrking commented 1 year ago

选取大图 2250x4000 9MB 时报错: Mark has been invalidated, pos: xxx markLimit: xxx

com.forjrking.lubankt.io.BufferedInputStreamWrap$InvalidMarkException: Mark has been invalidated, pos: 1701080 markLimit: 5242880
  at com.forjrking.lubankt.io.BufferedInputStreamWrap.reset(BufferedInputStreamWrap.java:318)
  at com.forjrking.lubankt.Checker$getOrientation$reader$1.getOrientation(Checker.kt:137)
  at com.forjrking.lubankt.Checker.getOrientationInternal(Checker.kt:147)
  at com.forjrking.lubankt.Checker.getOrientation(Checker.kt:141)
  at com.forjrking.lubankt.Checker.getRotateDegree(Checker.kt:167)
  at com.forjrking.lubankt.CompressEngine.compress(CompressEngine.kt:48)
  at com.forjrking.lubankt.AbstractFileBuilder$compress$2.invokeSuspend(Luban.kt:294)
  at com.forjrking.lubankt.AbstractFileBuilder$compress$2.invoke(Unknown Source:10)
  at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:78)
  at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:167)
  at kotlinx.coroutines.BuildersKt.withContext(Unknown Source:1)
  at com.forjrking.lubankt.AbstractFileBuilder.compress(Luban.kt:272)
  at com.forjrking.lubankt.SingleRequestBuild$asyncRun$1$1.invokeSuspend(Luban.kt:320)
  at com.forjrking.lubankt.SingleRequestBuild$asyncRun$1$1.invoke(Unknown Source:10)
  at kotlinx.coroutines.flow.SafeFlow.collectSafely(Builders.kt:61)
  at kotlinx.coroutines.flow.AbstractFlow.collect(Flow.kt:230)
  at kotlinx.coroutines.flow.internal.ChannelFlowOperatorImpl.flowCollect(ChannelFlow.kt:195)
  at kotlinx.coroutines.flow.internal.ChannelFlowOperator.collectTo$suspendImpl(ChannelFlow.kt:157)
  at kotlinx.coroutines.flow.internal.ChannelFlowOperator.collectTo(Unknown Source:0)
  at kotlinx.coroutines.flow.internal.ChannelFlow$collectToFun$1.invokeSuspend(ChannelFlow.kt:60)
  at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
  at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
  at java.lang.Thread.run(Thread.java:1012)
  at com.forjrking.lubankt.CompressThreadFactory$newThread$thread$1.run(Luban.kt:403)

你好可以提供下原图么?

xiaoyvyv commented 12 months ago

选取大图 2250x4000 9MB 时报错: Mark has been invalidated, pos: xxx markLimit: xxx

com.forjrking.lubankt.io.BufferedInputStreamWrap$InvalidMarkException: Mark has been invalidated, pos: 1701080 markLimit: 5242880
    at com.forjrking.lubankt.io.BufferedInputStreamWrap.reset(BufferedInputStreamWrap.java:318)
    at com.forjrking.lubankt.Checker$getOrientation$reader$1.getOrientation(Checker.kt:137)
    at com.forjrking.lubankt.Checker.getOrientationInternal(Checker.kt:147)
    at com.forjrking.lubankt.Checker.getOrientation(Checker.kt:141)
    at com.forjrking.lubankt.Checker.getRotateDegree(Checker.kt:167)
    at com.forjrking.lubankt.CompressEngine.compress(CompressEngine.kt:48)
    at com.forjrking.lubankt.AbstractFileBuilder$compress$2.invokeSuspend(Luban.kt:294)
    at com.forjrking.lubankt.AbstractFileBuilder$compress$2.invoke(Unknown Source:10)
    at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:78)
    at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:167)
    at kotlinx.coroutines.BuildersKt.withContext(Unknown Source:1)
    at com.forjrking.lubankt.AbstractFileBuilder.compress(Luban.kt:272)
    at com.forjrking.lubankt.SingleRequestBuild$asyncRun$1$1.invokeSuspend(Luban.kt:320)
    at com.forjrking.lubankt.SingleRequestBuild$asyncRun$1$1.invoke(Unknown Source:10)
    at kotlinx.coroutines.flow.SafeFlow.collectSafely(Builders.kt:61)
    at kotlinx.coroutines.flow.AbstractFlow.collect(Flow.kt:230)
    at kotlinx.coroutines.flow.internal.ChannelFlowOperatorImpl.flowCollect(ChannelFlow.kt:195)
    at kotlinx.coroutines.flow.internal.ChannelFlowOperator.collectTo$suspendImpl(ChannelFlow.kt:157)
    at kotlinx.coroutines.flow.internal.ChannelFlowOperator.collectTo(Unknown Source:0)
    at kotlinx.coroutines.flow.internal.ChannelFlow$collectToFun$1.invokeSuspend(ChannelFlow.kt:60)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
    at java.lang.Thread.run(Thread.java:1012)
    at com.forjrking.lubankt.CompressThreadFactory$newThread$thread$1.run(Luban.kt:403)

你好可以提供下原图么?

1700394551507

ACmodel commented 2 weeks ago

+1

ACmodel commented 2 weeks ago

@xiaoyvyv Bro,你解决了这个问题了吗,如果解决了,能麻烦告诉一下这个问题解决思路吗