Repository navigation
Телефон: выключение звука отдельного ПК или всех ПК одной кнопкой - #2
Merged
Merged
Conversation
Muted PCs stay connected (mic included) and keep streaming; the hub mixer leaves them out with a 10 ms gain ramp, they no longer hold the output open or get Pace packets. Phone-local, no protocol change. Mute flags persist per PC in paired_pcs. Closes #1
While a PC is muted its feeder no longer queues audio (one Silence marker ends the stream) and unmuting resets it. Before, with the phone output closed, the unread queue was replayed on unmute: ~550 ms extra latency and ~200 packets counted as lost (reproduced on POCO F5 and in unmuting_after_the_output_was_closed_plays_fresh_audio). The status notification gets a Выключить звук / Включить звук action for all PCs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1
Что сделано
На телефоне звук компьютеров теперь можно выключать, не закрывая приложение:
mutedвpaired_pcs) и переживает перезапуск приложения/телефона и повторное сканирование QR.Как устроено
Hub::set_muted(ids). Заглушённый ПК остаётся подключён (микрофон работает) и продолжает слать звук, но его пакеты не ставятся в очередь плейаута: в очередь кладётся один маркер тишины, аMixer::fillуводит его громкость в ноль линейной рампой 10 мс, без щелчков. При включении звука поток этого ПК начинается заново (RxFeeder::reset), поэтому накопленный звук никогда не проигрывается повторно. В real-time пути нет ни аллокаций, ни блокировок.HubStatus::pc_audio_activeне учитывает заглушённые ПК. Поэтому, если звук всех играющих ПК выключен, аудиовыход телефона закрывается через 30 с простоя, а сервис отпускает Wi-Fi/CPU wake lock. Pace-пакеты заглушённому ПК не отправляются.NativeBridge.setMuted(idsJson),Cmd::SetMuted. Engine повторно применяет список при перезапуске hub,BridgeServiceпередаёт mute раньшеsetPeers, поэтому только что добавленный заглушённый ПК не успевает заиграть.Проверка
cargo clippy(core, desktop, android host иcargo ndk -t arm64-v8a):-D warnings, чисто.cargo test -p audiobridge-core -p audiobridge-android: всё зелёное, включая все 7 integration-тестов.muted_pc_stays_connected_but_is_left_out_of_the_mix(два ПК, 1000 и 1500 Гц):pc_audio_active = false;gradlew :app:testDebugUnitTest :app:lintDebug :app:assembleDebug: успешно. Lint: 0 ошибок, новых предупреждений нет. Новые JVM-тесты вPairedPcTest: сохранениеmutedиmutedIdsJson.unmuting_after_the_output_was_closed_plays_fresh_audio. Проблему нашли на POCO F5: если включить звук после того, как аудиовыход телефона был закрыт, проигрывалась накопленная очередь — в логахlost=177 buffer=612ms. Тест воспроизводил это до исправления (задержка 548 мс, lost=200, buffer 559 мс), после исправления: задержка 34 мс, lost=0, buffer 30 мс.paired_pcs. В уведомлении есть действие «Выключить звук» (проверено черезdumpsys notification). Логи после выключения и включения звука:lost=0, buffer 24–52 мс; после остановки звука ПК аудиовыход закрылся сам через 30 с.