Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Division by Zero Error in audioOffsetMs Calculation #857

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

motamed
Copy link

@motamed motamed commented Sep 13, 2024

This pull request addresses a potential division by zero error in the calculation of audioOffsetMs within the ServiceRecognizerBase.ts file. The fix ensures that if this.privAverageBytesPerMs is zero, audioOffsetMs is set to zero instead of attempting to perform the division.

UAT Tracker ID : 304110

Changes Made:

  • Updated the calculation of audioOffsetMs to include a conditional check that sets audioOffsetMs to zero if this.privAverageBytesPerMs is zero.

Code Changes:

const audioOffsetMs: number = this.privAverageBytesPerMs != 0 ? bytesSent / this.privAverageBytesPerMs : 0;

Tested Scenario:

  • The Current code throw an error when used in PowerApps PCF control for speech recognition .
ConversationTranscriptionCanceledEventArgs {privSessionId: '653442B08C524EA4ADDB66A19C992187', privOffset: undefined, privReason: 0, privErrorDetails: 'Could not deserialize speech context. websocket error code: 1007', privErrorCode: 2}

@motamed
Copy link
Author

motamed commented Sep 13, 2024

@hkamel

@motamed
Copy link
Author

motamed commented Sep 30, 2024

any updates on this ?

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.

1 participant