fix: 修正投屏授权状态与窗口生命周期,避免串流状态错乱

This commit is contained in:
tongtong committed 2026-11-28 02:59:49 +08:00
1 parent a0b77a3e7a
commit 4c9d006d11
6 files changed
+134 -90

No files matched your search

@@ -398,6 +398,9 @@ class MediaProjectionService : Service() {
execWorker {
val started = current.beginMirroring(active)
handler.post {
if (current !== session || (active != null && activeProjection?.projection !== active)) {
return@post
}
if (started) {
state = State.STREAMING
current.notifyMirror(MirrorAction.GRANTED)
@@ -469,6 +472,9 @@ class MediaProjectionService : Service() {
}
if (active?.projection === created) releaseActiveProjection()
session?.endMirroring()
if (active?.projection === created) {
session?.notifyMirror(MirrorAction.STOPPED)
}
state = if (session != null) State.STANDBY else State.IDLE
updateNotification()
}