Skip to content

fix: 재생 큐 및 오디오 포커스 동시성 문제 수정#75

Merged
gagip merged 2 commits intomainfrom
fix/concurrency
Mar 26, 2026
Merged

fix: 재생 큐 및 오디오 포커스 동시성 문제 수정#75
gagip merged 2 commits intomainfrom
fix/concurrency

Conversation

@gagip
Copy link
Copy Markdown
Owner

@gagip gagip commented Mar 25, 2026

Summary

  • PlayQueueManager.playNext(): check()playlistMutex.withLock 내부로 이동하여 검증과 실행 사이의 경쟁 조건(TOCTOU) 제거
  • AudioFocusManager: wasPlayingBeforeTransientLoss, wasDucked 필드에 @Volatile 추가로 오디오 포커스 콜백 스레드에서의 가시성 보장

변경 파일

  • features/player/data/PlayQueueManager.kt
  • features/player/data/AudioFocusManager.kt

- PlayQueueManager.playNext(): check()를 mutex 내부로 이동하여 check와 실행 사이 경쟁 조건 제거
- AudioFocusManager: wasPlayingBeforeTransientLoss, wasDucked 필드에 @volatile 추가로 콜백 스레드 가시성 보장
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 25, 2026

Coverage Report

Module Coverage Covered Total
Total 19.38% 918 4736
Player 35.94% 101 281
Playlist 17.97% 71 395
Timer 48.15% 365 758
Music 21.91% 39 178

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

재생 큐 전환과 오디오 포커스 처리에서 발생할 수 있는 동시성(TOCTOU/가시성) 문제를 줄여 재생 제어의 안정성을 높이려는 PR입니다.

Changes:

  • PlayQueueManager.playNext()에서 검증(check)을 mutex 내부로 이동해 검증-실행 사이 경쟁 조건을 제거
  • AudioFocusManager의 포커스 상태 보조 플래그(wasPlayingBeforeTransientLoss, wasDucked)에 @Volatile을 추가해 콜백 스레드에서의 가시성 보강

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
app/src/main/java/com/happyseal/zenplayer/features/player/data/PlayQueueManager.kt playNext()의 TOCTOU 가능성을 줄이기 위해 락 범위 조정
app/src/main/java/com/happyseal/zenplayer/features/player/data/AudioFocusManager.kt 오디오 포커스 콜백 스레드 간 플래그 가시성 개선을 위한 @Volatile 추가

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- PlayQueueManager: playNext()에서 락 안에 suspend 함수 직접 호출 시 교착 가능성 제거
  - computeNextAction()으로 분리하여 상태 변경은 락 안에서, emit/play는 락 밖에서 실행
- AudioFocusManager: currentFocusState에 @volatile 추가하여 스레드 간 가시성 보장
@gagip gagip merged commit 7ed3080 into main Mar 26, 2026
1 check passed
@gagip gagip deleted the fix/concurrency branch March 26, 2026 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants