Class AudioStream
Inherited Members
Namespace: SIPSorcery.net.RTP
Assembly: SIPSorcery.dll
Syntax
public class AudioStream : MediaStream
Constructors
| Improve this Doc View SourceAudioStream(RtpSessionConfig, Int32)
Declaration
public AudioStream(RtpSessionConfig config, int index)
Parameters
Type | Name | Description |
---|---|---|
RtpSessionConfig | config | |
System.Int32 | index |
Fields
| Improve this Doc View Sourcelogger
Declaration
protected static ILogger logger
Field Value
Type | Description |
---|---|
Microsoft.Extensions.Logging.ILogger |
rtpEventInProgress
Declaration
protected bool rtpEventInProgress
Field Value
Type | Description |
---|---|
System.Boolean |
Properties
| Improve this Doc View SourceHasAudio
Indicates whether this session is using audio.
Declaration
public bool HasAudio { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
| Improve this Doc View SourceCheckAudioFormatsNegotiation()
Declaration
public void CheckAudioFormatsNegotiation()
SendAudio(UInt32, Byte[])
Sends an audio sample to the remote peer.
Declaration
public void SendAudio(uint durationRtpUnits, byte[] sample)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | durationRtpUnits | The duration in RTP timestamp units of the audio sample. This value is added to the previous RTP timestamp when building the RTP header. |
System.Byte[] | sample | The audio sample to set as the RTP packet payload. |
SendAudioFrame(UInt32, Int32, Byte[])
Sends an audio packet to the remote party.
Declaration
public void SendAudioFrame(uint duration, int payloadTypeID, byte[] buffer)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | duration | The duration of the audio payload in timestamp units. This value gets added onto the timestamp being set in the RTP header. |
System.Int32 | payloadTypeID | The payload ID to set in the RTP header. |
System.Byte[] | buffer | The audio payload to send. |
SendDtmf(Byte, CancellationToken)
Sends a DTMF tone as an RTP event to the remote party.
Declaration
public virtual Task SendDtmf(byte key, CancellationToken ct)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | key | The DTMF tone to send. |
System.Threading.CancellationToken | ct | RTP events can span multiple RTP packets. This token can be used to cancel the send. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
SendDtmfEvent(RTPEvent, CancellationToken, Int32, Int32)
Sends an RTP event for a DTMF tone as per RFC2833. Sending the event requires multiple packets to be sent. This method will hold onto the socket until all the packets required for the event have been sent. The send can be cancelled using the cancellation token.
Declaration
public async Task SendDtmfEvent(RTPEvent rtpEvent, CancellationToken cancellationToken, int clockRate = 8000, int samplePeriod = 50)
Parameters
Type | Name | Description |
---|---|---|
RTPEvent | rtpEvent | The RTP event to send. |
System.Threading.CancellationToken | cancellationToken | CancellationToken to allow the operation to be cancelled prematurely. |
System.Int32 | clockRate | To send an RTP event the clock rate of the underlying stream needs to be known. |
System.Int32 | samplePeriod | The sample period in milliseconds being used for the media stream that the event is being inserted into. Should be set to 50ms if main media stream is dynamic or sample period is unknown. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Events
| Improve this Doc View SourceOnAudioFormatsNegotiatedByIndex
Gets fired when the remote SDP is received and the set of common audio formats is set.
Declaration
public event Action<int, List<AudioFormat>> OnAudioFormatsNegotiatedByIndex
Event Type
Type | Description |
---|---|
System.Action<System.Int32, System.Collections.Generic.List<SIPSorceryMedia.Abstractions.AudioFormat>> |