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

Merged
merged 2 commits into from
Oct 14, 2024

Conversation

motamed
Copy link
Contributor

@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
Contributor Author

motamed commented Sep 13, 2024

@hkamel

@motamed
Copy link
Contributor Author

motamed commented Sep 30, 2024

any updates on this ?

@rhurey
Copy link
Member

rhurey commented Oct 8, 2024

The linter error'd out...
D:\a_work\1\s\src\common.speech\ServiceRecognizerBase.ts
669:66 error Expected '!==' and instead saw '!='

(Looking at why the pipeline results aren't showing up)

typo fixed from != to !==
@motamed
Copy link
Contributor Author

motamed commented Oct 11, 2024

The linter error'd out... D:\a_work\1\s\src\common.speech\ServiceRecognizerBase.ts 669:66 error Expected '!==' and instead saw '!='

(Looking at why the pipeline results aren't showing up)

I updated the code accordingly

@rhurey
Copy link
Member

rhurey commented Oct 12, 2024

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@rhurey
Copy link
Member

rhurey commented Oct 14, 2024

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@rhurey
Copy link
Member

rhurey commented Oct 14, 2024

Pipeline is failing because of ADO config. Manual build 149400 passed

@rhurey rhurey merged commit 4d0f521 into microsoft:master Oct 14, 2024
1 of 2 checks passed
@motamed
Copy link
Contributor Author

motamed commented Oct 15, 2024

Quick question
how does the release cycle work? and when is the next release?

@rhurey
Copy link
Member

rhurey commented Oct 15, 2024

We generally release every couple months. The current release (1.41) should go live in the next day.

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