Skip to content

Remove RestartTimer() from AvAudioNode Callback#3196

Merged
TheCodeTraveler merged 1 commit intomainfrom
Remove-`RestartTimer`-from-`AvAudioNode`-callback
Apr 11, 2026
Merged

Remove RestartTimer() from AvAudioNode Callback#3196
TheCodeTraveler merged 1 commit intomainfrom
Remove-`RestartTimer`-from-`AvAudioNode`-callback

Conversation

@TheCodeTraveler
Copy link
Copy Markdown
Collaborator

Description of Change

After confirming that the AvAudioNode callback is triggered during silence, this PR removes RestartTimer() from the AvAudioNode callback on iOS + MacCatalyst when installing a tap on the bus.

Linked Issues

PR Checklist

  • Has a linked Issue, and the Issue has been approved(bug) or Championed (feature/proposal)
  • Has tests (if omitted, state reason in description)
  • Has samples (if omitted, state reason in description)
  • Rebased on top of main at time of PR
  • Changes adhere to coding standard
  • Documentation created or updated: https://github.com/MicrosoftDocs/CommunityToolkit/pulls

Additional information

Copilot AI review requested due to automatic review settings April 10, 2026 17:16
Copy link
Copy Markdown
Contributor

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

Fixes iOS + MacCatalyst (and macOS equivalents) silence auto-stop behavior for SpeechToText by ensuring the silence timer is not continuously reset by AVAudioEngine tap buffers that are delivered even during silence. This aligns AutoStopSilenceTimeout behavior with the intended “stop after silence” semantics (Fixes #3195).

Changes:

  • Removed RestartTimer() from AVAudioNode.InstallTapOnBus callbacks so the silence timer isn’t reset on every incoming (silent) buffer.
  • Simplified tap callbacks to only append buffers to the recognition request.
  • Updated macOS GetBusOutputFormat usage to match the tapped bus.

Reviewed changes

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

File Description
src/CommunityToolkit.Maui.Core/Essentials/SpeechToText/SpeechToTextImplementation.macos.cs Stop resetting the silence timer from the AVAudioEngine tap; align bus format retrieval with the tap bus.
src/CommunityToolkit.Maui.Core/Essentials/SpeechToText/SpeechToTextImplementation.ios.cs Stop resetting the silence timer from the AVAudioEngine tap to allow AutoStopSilenceTimeout to elapse during silence.
src/CommunityToolkit.Maui.Core/Essentials/SpeechToText/OfflineSpeechToTextImplementation.macos.cs Same fix as online implementation for offline recognition on macOS.
src/CommunityToolkit.Maui.Core/Essentials/SpeechToText/OfflineSpeechToTextImplementation.ios.cs Same fix as online implementation for offline recognition on iOS/MacCatalyst.

@TheCodeTraveler TheCodeTraveler merged commit b66a054 into main Apr 11, 2026
14 checks passed
@TheCodeTraveler TheCodeTraveler deleted the Remove-`RestartTimer`-from-`AvAudioNode`-callback branch April 11, 2026 04:55
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.

[BUG] AutoStopSilenceTimeout for SpeechToTextOptions doesn't work on iOS

3 participants