Skip to content

Commit

Permalink
Fix Division by Zero Error in audioOffsetMs Calculation (#857)
Browse files Browse the repository at this point in the history
* bug fix on potential division by zero

* Update ServiceRecognizerBase.ts

typo fixed from != to !==
  • Loading branch information
motamed authored Oct 14, 2024
1 parent 04d9755 commit 4d0f521
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/common.speech/ServiceRecognizerBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ export abstract class ServiceRecognizerBase implements IDisposable {

private updateSpeakerDiarizationAudioOffset(): void {
const bytesSent: number = this.privRequestSession.recognitionBytesSent;
const audioOffsetMs: number = bytesSent / this.privAverageBytesPerMs;
const audioOffsetMs: number = this.privAverageBytesPerMs !== 0 ? bytesSent / this.privAverageBytesPerMs : 0;
this.privSpeechContext.setSpeakerDiarizationAudioOffsetMs(audioOffsetMs);
}

Expand Down

0 comments on commit 4d0f521

Please sign in to comment.