java.lang.IllegalStateException: configure() is valid only at Initialized state; currently during configure()
维护者通常 3 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 22/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
调研方向
The trace runs from StreamBase.stopStream (StreamBase.kt:252) into prepareEncoders (StreamBase.kt:575) and then VideoEncoder.prepareVideoEncoder (VideoEncoder.java:172), where MediaCodec.configure() is called while a configure is already in progress. Start by reading how stopStream and prepareEncoders manage encoder state, then reproduce with a quick stop during streaming. Done means stopping a stream no longer throws this exception, and the existing stream tests still pass.
由索引模型根据 Issue 内容生成。
描述
Describe the bug
The application crashes with an IllegalStateException when attempting to stop a screen sharing stream. The error occurs because MediaCodec.configure() is called from an invalid state (during configure()) instead of the required Initialized state.
To Reproduce
Steps to reproduce the behavior:
- Start screen sharing using
ShareScreenService - Initiate stream stop procedure
if (genericStream.isStreaming) {
GlobalScope.launch(Dispatchers.Main) { // Or a custom scope
withContext(Dispatchers.IO) { // Perform blocking operation on IO dispatcher
genericStream.stopStream()
}
}
}
- Observe crash with the following stack trace
Expected behavior
The stream should stop cleanly without throwing an IllegalStateException.
Error Log
configure() is valid only at Initialized state; currently during configure()
2025-12-18 14:29:06.518 30621-30665 VideoEncoder com...rvasystem.quickscreenrecorder E Create VideoEncoder failed. (Explain with AI)
java.lang.IllegalStateException: configure() is valid only at Initialized state; currently during configure()
at android.media.MediaCodec.native_configure(Native Method)
at android.media.MediaCodec.configure(MediaCodec.java:2562)
at android.media.MediaCodec.configure(MediaCodec.java:2422)
at com.pedro.encoder.video.VideoEncoder.prepareVideoEncoder(VideoEncoder.java:172)
at com.pedro.encoder.video.VideoEncoder.prepareVideoEncoder(VideoEncoder.java:237)
at com.pedro.library.base.StreamBase.prepareEncoders(StreamBase.kt:575)
at com.pedro.library.base.StreamBase.stopStream(StreamBase.kt:252)
at com.atharvasystem.quickscreenrecorder.services.ShareScreenService$stopStream$1$1.invokeSuspend(ShareScreenService.kt:148)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:34)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:100)
at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:124)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:89)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:586)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:820)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:717)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:704)
Environment Information
- Library Version:
com.github.pedroSG94.RootEncoder:library:2.6.6 - Device: Android Emulator
- OS: Android 16
- Media Server: Local RTMP Server
- Class Used:
GenericStream
- 主要语言
- Kotlin
- 星标
- 3k
- 派生
- 946
- 平均合并
- 5 天 1 小时
- 30 天内合并 PR
- 6
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
pedroSG94/RootEncoder 的其他 Issue
-
Scheme-less stream URLs throw NullPointerException instead of URISyntaxException可能已有人在做 @blihio 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
pedroSG94/RootEncoder#2218 ·
维护者通常 3 天内回复
-
Nullable GIF input causes NullPointerException in GifStreamObject.load可能已有人在做 @blihio 于 1 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 62/100
pedroSG94/RootEncoder#2216 ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
pedroSG94/RootEncoder#2213 ·
维护者通常 3 天内回复
-
难度 4/5 3-5 天 新手友好度 48/100
pedroSG94/RootEncoder#2207 · 1 个 reaction ·
维护者通常 3 天内回复
-
难度 4/5 3-5 天 新手友好度 35/100
pedroSG94/RootEncoder#2203 ·
维护者通常 3 天内回复
查看 pedroSG94/RootEncoder 的全部 Issue
相似的 Issue
-
enhancement
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
enhancement triaged
难度 1/5 1 小时以内 新手友好度 63/100
维护者通常 1 天内回复
-
bug follow-up
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
bug 🐞 CI/CD ⚒️
难度 2/5 1-3 小时 新手友好度 78/100
valkey-io/valkey-glide#7370 ·
维护者通常 1 天内回复
-
binding:web core docs p3
难度 2/5 1-3 小时 新手友好度 85/100
RunanywhereAI/runanywhere-sdks#1123 ·
维护者通常 1 天内回复