Class MediaStream
Base stream
Derived:
OdinNative.Odin.Media.MicrophoneStream, OdinNative.Odin.Media.PlaybackStream
Implements:
Global.IDisposable
Properties
Id
Handle ID
MediaConfig
Audio config of the media stream
CancellationSource
Control of async read and write tasks
IsActive
Indicates wether or not the media stream is active and sending/receiving data
HasErrors
Indicates wether or not the last media stream api call result is an error code
IsInvalid
Indicates wether or not the media stream handle is invalid or closed
Methods
GetMediaId()
Returns the media stream ID and updates OdinNative.Odin.Media.MediaStream.Id.
Returns
System.UInt16
: id value### GetPeerId()
Returns the ID of the peer that own this media stream.
Returns
System.UInt64
: id### AudioPushData(float[], int)
Sends data to the audio stream. The data has to be interleaved [-1, 1] float data.
Parameters
Type | Name | Description |
---|---|---|
System.Single[] | buffer | audio data |
System.Int32 | length | bytes to write |
AudioPushData(float[])
Sends data to the audio stream. The data has to be interleaved [-1, 1] float data.
Parameters
Type | Name | Description |
---|---|---|
System.Single[] | buffer | audio data |
AudioPushDataTask(float[], CancellationToken)
Sends data to the audio stream. The data has to be interleaved [-1, 1] float data.
Returns
Global.Task
Parameters
Type | Name | Description |
---|---|---|
System.Single[] | buffer | interleaved audio data |
Global.CancellationToken | cancellationToken |
AudioPushDataAsync(float[])
Sends audio data using a custom OdinNative.Odin.Media.MediaStream.CancellationSource. The data has to be interleaved [-1, 1] float data.
Parameters
Type | Name | Description |
---|---|---|
System.Single[] | buffer | interleaved audio data |
AudioReset()
Returns
System.Boolean
AudioReadData(float[])
Reads data from the audio stream.
Returns
System.UInt32
: count of written bytes into buffer
Parameters
Type | Name | Description |
---|---|---|
System.Single[] | buffer | buffer to write into |
AudioStats(out OdinAudioStreamStats)
Retrieves statistics for the specified OdinNative.Odin.Media.MediaStream.
Returns
System.Boolean
: true on success or false
Parameters
Type | Name | Description |
---|---|---|
OdinNative.Core.Imports.NativeBindings.OdinAudioStreamStats | stats | Audio stream statistics |
AudioReadData(float[], int)
Reads data from the audio stream.
Returns
System.UInt32
: count of written bytes into buffer
Parameters
Type | Name | Description |
---|---|---|
System.Single[] | buffer | buffer to write into |
System.Int32 | length | bytes to read |
AudioReadDataTask(float[], CancellationToken)
Reads data from the audio stream.
Returns
Global.Task<System.UInt32>
: count of written bytes into buffer
Parameters
Type | Name | Description |
---|---|---|
System.Single[] | buffer | buffer to write into |
Global.CancellationToken | cancellationToken |
AudioReadDataAsync(float[])
Read audio data using a custom custom OdinNative.Odin.Media.MediaStream.CancellationSource.
Returns
Global.Task<System.UInt32>
: count of written bytes into buffer
Parameters
Type | Name | Description |
---|---|---|
System.Single[] | buffer | buffer to write into |
AudioResample(float[], uint, out float[], out int)
Set a resampler and resamples a chunk of audio.
Returns
System.Boolean
: true on success or false if missmatch of capacity i.e. errorcode
Parameters
Type | Name | Description |
---|---|---|
System.Single[] | input | current buffer |
System.UInt32 | outputSampleRate | resample samplerate |
System.Single[] | output | resampled buffer |
System.Int32 | capacity | size of resampled buffer |
AudioResample(float[], uint, float[], int)
Set a resampler and resamples a chunk of audio.
Returns
System.UInt32
: sample count on success or errorcode on failure
Parameters
Type | Name | Description |
---|---|---|
System.Single[] | input | source buffer |
System.UInt32 | outputSampleRate | to samplerate |
System.Single[] | output | target buffer |
System.Int32 | capacity | target capacity |
Cancel()
Cancel the custom OdinNative.Odin.Media.MediaStream.CancellationSource.
Returns
System.Boolean
: true if the token was canceled or false### ToString()
Debug
Returns
System.String
: info### Dispose(bool)
On dispose will free the stream and resampler
Parameters
Type | Name |
---|---|
System.Boolean | disposing |
~MediaStream()
Default deconstructor
Dispose()
On dispose will free the stream and resampler
Implements
Global.IDisposable