Исправление задержки кнопки «Пропустить» при длительном воспроизведении#12
Исправление задержки кнопки «Пропустить» при длительном воспроизведении#12ndrco wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 087792f68d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| with self._lock: | ||
| if self._current_proc is not None and self._current_proc.poll() is None: | ||
| self._skip_event.set() | ||
| self._current_proc.terminate() |
There was a problem hiding this comment.
Clear stale skip event after force-terminating playback
Calling terminate() inside skip() can make the worker loop exit before it reaches the branch that clears _skip_event (if self._skip_event.is_set(): ... clear()), leaving the flag set for the next track. In that case, the next playback is immediately terminated as soon as _play_blocking() starts, even though no new skip was requested. This regression is triggered when skip() is invoked during active playback and the process exits before the worker re-enters the loop body.
Useful? React with 👍 / 👎.
Motivation
AUTO_PLAY_SHOW_SKIP_WINDOWкнопка «Пропустить» становилась неактивной, но воспроизведение черезffplayпродолжало идти до конца длинного текста и сообщение[player] Playback skippedпоявлялось только по завершении трека, что делало поведение пропуска недетерминированным.Description
AudioPlayer.skip()добавлен немедленный вызовterminate()у текущего процессаffplayсразу после установки флага_skip_event, чтобы гарантировать немедленную остановку воспроизведения; изменение внесено вapp/audio/player.py.Testing
pytest -q tests/test_api_tts.py::test_skip_playback tests/test_api_tts.py::test_skip_playback_with_authбыл выполнен, но завершился с ошибкой загрузки тестовой среды из-за отсутствия зависимостиhttpx, поэтому автоматические тесты не прошли в этом окружении.Codex Task