This documentation is archived and is not being maintained.

SpeechRecognitionConnector Class

SpeechRecognitionConnector can be bound to an AVFlow, and provides a stream of audio data compatible with SpeechFX.


Namespace:  Microsoft.Rtc.Collaboration.AudioVideo
Assembly:  Microsoft.Rtc.Collaboration (in Microsoft.Rtc.Collaboration.dll)

public class SpeechRecognitionConnector : IDisposable

One such stream is provided every time Start() is called on the SpeechRecognitionConnector. The stream will contain the audio up until the point at which Stop() is called on the connector. Calling Start() again will then generate a new stream for the new interval, and so on.

Internally, SRC performs a buffer management role for the buffers which will be provided to the RMA interface of the media stack: When the media stack runs out of empty buffers, SRC provides more. When the media stack has filled a buffer, SRC assigns it to the current stream, if one exists. When the stream is done with it (i.e., the SR engine has processed the data), SRC gives it back to the media stack. This buffer lifecycle can be broken if the app never gives the stream to the SR engine, nor disposes of the stream. In that case, the buffers in that stream are effectively lost, and SRC must allocate more. Should such buffers eventually be returned, SRC will Dispose() of some of its buffers to bring the total in circulation back down. This is all complicated by the fact that which media receiver and which stream SRC corresponds to can be changed by the app, which can call Start() and Stop(), changing the stream, or Bind() and Unbind(), changing the receiver. Also, the buffer management callbacks from the media stack and the stream (see the "OnBufferXxx" methods) can be called on a threadpool thread at any time, so SRC needs to lock against conflict with the methods called by the app.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.