more graceful error handling for stream throws
This commit is contained in:
Родитель
1eda8f3561
Коммит
fb7d991166
|
@ -30,7 +30,7 @@ export class ReplayableAudioNode implements IAudioStreamNode {
|
|||
|
||||
// Reads and returns the next chunk of audio buffer.
|
||||
// If replay of existing buffers are needed, read() will first seek and replay
|
||||
// existing content, and upoin completion it will read new content from the underlying
|
||||
// existing content, and upon completion it will read new content from the underlying
|
||||
// audio node, saving that content into the replayable buffers.
|
||||
public read(): Promise<IStreamChunk<ArrayBuffer>> {
|
||||
// if there is a replay request to honor.
|
||||
|
|
|
@ -14,7 +14,6 @@ import {
|
|||
IAudioStreamNode,
|
||||
IConnection,
|
||||
IDisposable,
|
||||
InvalidOperationError,
|
||||
IStreamChunk,
|
||||
MessageType,
|
||||
ServiceEvent,
|
||||
|
@ -761,10 +760,10 @@ export abstract class ServiceRecognizerBase implements IDisposable {
|
|||
try {
|
||||
audioStreamChunk = await audioStreamNode.read();
|
||||
} catch (error) {
|
||||
// If end of stream reached, eat the error and process default end chunk.
|
||||
if (!(error instanceof InvalidOperationError)) {
|
||||
throw error;
|
||||
if (!this.privIsLiveAudio) {
|
||||
this.privRequestSession.onSpeechEnded();
|
||||
}
|
||||
return;
|
||||
}
|
||||
// we have a new audio chunk to upload.
|
||||
if (this.privRequestSession.isSpeechEnded) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче