Class VideoStream
Inherited Members
Namespace: SIPSorcery.net.RTP
Assembly: SIPSorcery.dll
Syntax
public class VideoStream : MediaStream
Constructors
| Improve this Doc View SourceVideoStream(RtpSessionConfig, Int32)
Declaration
public VideoStream(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 |
RtpVideoFramer
Declaration
protected RtpVideoFramer RtpVideoFramer
Field Value
Type | Description |
---|---|
RtpVideoFramer |
Properties
| Improve this Doc View SourceHasVideo
Indicates whether this session is using video.
Declaration
public bool HasVideo { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
MaxReconstructedVideoFrameSize
Indicates the maximum frame size that can be reconstructed from RTP packets during the depacketisation process.
Declaration
public int MaxReconstructedVideoFrameSize { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
| Improve this Doc View SourceCheckVideoFormatsNegotiation()
Declaration
public void CheckVideoFormatsNegotiation()
ProcessVideoRtpFrame(IPEndPoint, RTPPacket, SDPAudioVideoMediaFormat)
Declaration
public void ProcessVideoRtpFrame(IPEndPoint endpoint, RTPPacket packet, SDPAudioVideoMediaFormat format)
Parameters
Type | Name | Description |
---|---|---|
System.Net.IPEndPoint | endpoint | |
RTPPacket | packet | |
SDPAudioVideoMediaFormat | format |
SendH264Frame(UInt32, Int32, Byte[])
Sends a H264 frame, represented by an Access Unit, to the remote party.
Declaration
public void SendH264Frame(uint duration, int payloadTypeID, byte[] accessUnit)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | duration | The duration in timestamp units of the payload (e.g. 3000 for 30fps). |
System.Int32 | payloadTypeID | The payload type ID being used for H264 and that will be set on the RTP header. |
System.Byte[] | accessUnit | The encoded H264 access unit to transmit. An access unit can contain one or more NAL's. |
Remarks
An Access Unit can contain one or more NAL's. The NAL's have to be parsed in order to be able to package in RTP packets.
See https://www.itu.int/rec/dologin_pub.asp?lang=e&id=T-REC-H.264-201602-S!!PDF-E&type=items Annex B for byte stream specification.
SendJpegFrame(UInt32, Int32, Byte[], Int32, Int32, Int32)
Helper method to send a low quality JPEG image over RTP. This method supports a very abbreviated version of RFC 2435 "RTP Payload Format for JPEG-compressed Video". It's intended as a quick convenient way to send something like a test pattern image over an RTSP connection. More than likely it won't be suitable when a high quality image is required since the header used in this method does not support quantization tables.
Declaration
public void SendJpegFrame(uint duration, int payloadTypeID, byte[] jpegBytes, int jpegQuality, int jpegWidth, int jpegHeight)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | duration | The duration in timestamp units of the payload (e.g. 3000 for 30fps). |
System.Int32 | payloadTypeID | |
System.Byte[] | jpegBytes | The raw encoded bytes of the JPEG image to transmit. |
System.Int32 | jpegQuality | The encoder quality of the JPEG image. |
System.Int32 | jpegWidth | The width of the JPEG image. |
System.Int32 | jpegHeight | The height of the JPEG image. |
SendVideo(UInt32, Byte[])
Sends a video sample to the remote peer.
Declaration
public void SendVideo(uint durationRtpUnits, byte[] sample)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | durationRtpUnits | The duration in RTP timestamp units of the video sample. This value is added to the previous RTP timestamp when building the RTP header. |
System.Byte[] | sample | The video sample to set as the RTP packet payload. |
SendVp8Frame(UInt32, Int32, Byte[])
Sends a VP8 frame as one or more RTP packets.
Declaration
public void SendVp8Frame(uint duration, int payloadTypeID, byte[] buffer)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | duration | The duration in timestamp units of the payload. Needs to be based on a 90Khz clock. |
System.Int32 | payloadTypeID | The payload ID to place in the RTP header. |
System.Byte[] | buffer | The VP8 encoded payload. |
Events
| Improve this Doc View SourceOnVideoFormatsNegotiatedByIndex
Gets fired when the remote SDP is received and the set of common video formats is set.
Declaration
public event Action<int, List<VideoFormat>> OnVideoFormatsNegotiatedByIndex
Event Type
Type | Description |
---|---|
System.Action<System.Int32, System.Collections.Generic.List<SIPSorceryMedia.Abstractions.VideoFormat>> |
OnVideoFrameReceivedByIndex
Gets fired when a full video frame is reconstructed from one or more RTP packets received from the remote party.
Declaration
public event Action<int, IPEndPoint, uint, byte[], VideoFormat> OnVideoFrameReceivedByIndex
Event Type
Type | Description |
---|---|
System.Action<System.Int32, System.Net.IPEndPoint, System.UInt32, System.Byte[], SIPSorceryMedia.Abstractions.VideoFormat> |
Remarks
- Received from end point,
- The frame timestamp,
- The encoded video frame payload.
- The video format of the encoded frame.