Amazon Kinesis Webrtc C SDK
Loading...
Searching...
No Matches
Callbacks

Extra callbacks definitions. More...

Collaboration diagram for Callbacks:

Classes

struct  TwccFeedback
 Per-packet feedback from a TWCC report. More...
struct  TwccCongestionState
 Congestion state output from the trendline estimator. More...
struct  CongestionCtx
 Context provided to the bandwidth controller callback. More...
struct  __RtcDataChannel
 RtcDataChannel represents a bi-directional data channel between two peers. More...

Typedefs

typedef VOID(* RtcOnFrame) (UINT64, PFrame)
 RtcOnFrame is fired everytime a frame is received from the remote peer. It is available via the RtpRec.
typedef VOID(* RtcOnBandwidthEstimation) (UINT64, DOUBLE)
 RtcOnBandwidthEstimation is fired everytime a bandwidth estimation value is computed. This will be fired for receiver side estimation.
typedef VOID(* RtcOnSenderBandwidthEstimation) (UINT64, UINT32, UINT32, UINT32, UINT32, UINT64)
 RtcOnSenderBandwidthEstimation is fired everytime a bandwidth estimation value is computed by sender. This is an estimate of ALL packets sent across all transceivers. See https://tools.ietf.org/html/draft-holmer-rmcat-transport-wide-cc-extensions-01 for more details.
typedef struct TwccFeedback * PTwccFeedback
typedef struct TwccCongestionState * PTwccCongestionState
typedef struct CongestionCtx * PCongestionCtx
typedef STATUS(* RtcOnTwccFeedbackReceived) (UINT64, PTwccFeedback, UINT32, PTwccCongestionState)
 Called when new TWCC feedback is available from the remote peer. Updates the current network congestion state with latest data. The SDK provides a default implementation; set a custom callback to override.
typedef STATUS(* RtcOnPeerCongestionFeedback) (UINT64, PCongestionCtx)
 Called when the SDK has computed congestion context from TWCC feedback. The application uses this to make bandwidth decisions and adjust encoder parameters.
typedef VOID(* RtcOnPictureLoss) (UINT64)
 RtcOnPictureLoss is fired everytime a Picture Loss Indication (PLI) feedback message is received. Receiving such message normally indicates that you sent a video frame which receiver could not decode. It may happen either because of packet loss or for any other reason. Generating an intra frame (aka keyframe, aka I-frame) in response to such message is considered a good strategy.
typedef VOID(* RtcOnFrameDropped) (UINT64, UINT32)
 RtcOnFrameDropped is fired when the jitter buffer drops a received frame. It happens when RTP packets are lost, or when the frame is too large. The dropped frame can be the complete frame before the lost RTP packets. For lost RTP packets, the jitter buffer drops a frame once a newer RTP packet is more than DEFAULT_JITTER_BUFFER_MAX_LATENCY past it, so several frames can be dropped at once. A frame that is too large is dropped when the next frame arrives. For video, the frames that follow cannot be decoded correctly until the next keyframe. One PLI sent with transceiverSendPictureLoss() asks the sender for one.
typedef struct __RtcDataChannel RtcDataChannel
 RtcDataChannel represents a bi-directional data channel between two peers.
typedef struct __RtcDataChannel * PRtcDataChannel
typedef VOID(* RtcOnMessage) (UINT64, PRtcDataChannel, BOOL, PBYTE, UINT32)
 RtcOnMessage is fired when a message is received for the DataChannel.
typedef VOID(* RtcOnOpen) (UINT64, PRtcDataChannel)
typedef VOID(* RtcOnDataChannel) (UINT64, PRtcDataChannel)
 RtcOnDataChannel is fired when the remote PeerConnection creates a new DataChannel.
typedef VOID(* RtcOnIceCandidate) (UINT64, PCHAR)
 RtcOnIceCandidate is fired when new iceCandidate is found. if PCHAR is NULL then candidate gathering is done.
typedef BOOL(* IceSetInterfaceFilterFunc) (UINT64, PCHAR)
 IceSetInterfaceFilterFunc is fired when a callback function to filter network interfaces is assigned. The callback function is expected to check for specific interface names to be whitelisted/blacklisted.
typedef VOID(* RtcOnConnectionStateChange) (UINT64, RTC_PEER_CONNECTION_STATE)
 RtcOnConnectionStateChange is fired to report a change in peer connection state.
typedef STATUS(* SignalingClientMessageReceivedFunc) (UINT64, PReceivedSignalingMessage)
typedef STATUS(* SignalingClientErrorReportFunc) (UINT64, STATUS, PCHAR, UINT32)
typedef STATUS(* SignalingClientStateChangedFunc) (UINT64, SIGNALING_CLIENT_STATE)

Detailed Description

Extra callbacks definitions.

Typedef Documentation

◆ IceSetInterfaceFilterFunc

typedef BOOL(* IceSetInterfaceFilterFunc) (UINT64, PCHAR)

IceSetInterfaceFilterFunc is fired when a callback function to filter network interfaces is assigned. The callback function is expected to check for specific interface names to be whitelisted/blacklisted.

◆ PCongestionCtx

typedef struct CongestionCtx * PCongestionCtx

◆ PRtcDataChannel

◆ PTwccCongestionState

◆ PTwccFeedback

typedef struct TwccFeedback * PTwccFeedback

◆ RtcDataChannel

RtcDataChannel represents a bi-directional data channel between two peers.

Reference: https://www.w3.org/TR/webrtc/#dom-rtcdatachannel

◆ RtcOnBandwidthEstimation

typedef VOID(* RtcOnBandwidthEstimation) (UINT64, DOUBLE)

RtcOnBandwidthEstimation is fired everytime a bandwidth estimation value is computed. This will be fired for receiver side estimation.

NOTE: RtcOnBandwidthEstimation is a KVS specific method

◆ RtcOnConnectionStateChange

typedef VOID(* RtcOnConnectionStateChange) (UINT64, RTC_PEER_CONNECTION_STATE)

RtcOnConnectionStateChange is fired to report a change in peer connection state.

Reference: https://www.w3.org/TR/webrtc/#event-iceconnectionstatechange

◆ RtcOnDataChannel

typedef VOID(* RtcOnDataChannel) (UINT64, PRtcDataChannel)

RtcOnDataChannel is fired when the remote PeerConnection creates a new DataChannel.

Reference: https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-ondatachannel

◆ RtcOnFrame

typedef VOID(* RtcOnFrame) (UINT64, PFrame)

RtcOnFrame is fired everytime a frame is received from the remote peer. It is available via the RtpRec.

NOTE: RtcOnFrame is a KVS specific method

◆ RtcOnFrameDropped

typedef VOID(* RtcOnFrameDropped) (UINT64, UINT32)

RtcOnFrameDropped is fired when the jitter buffer drops a received frame. It happens when RTP packets are lost, or when the frame is too large. The dropped frame can be the complete frame before the lost RTP packets. For lost RTP packets, the jitter buffer drops a frame once a newer RTP packet is more than DEFAULT_JITTER_BUFFER_MAX_LATENCY past it, so several frames can be dropped at once. A frame that is too large is dropped when the next frame arrives. For video, the frames that follow cannot be decoded correctly until the next keyframe. One PLI sent with transceiverSendPictureLoss() asks the sender for one.

It runs on the thread that receives the media. It must not block. It is not fired for the frames still buffered when the peer connection is freed.

NOTE: RtcOnFrameDropped is a KVS specific method

Parameters
[in]UINT64customData - User customData
[in]UINT32timestamp - RTP timestamp of the dropped frame

◆ RtcOnIceCandidate

typedef VOID(* RtcOnIceCandidate) (UINT64, PCHAR)

RtcOnIceCandidate is fired when new iceCandidate is found. if PCHAR is NULL then candidate gathering is done.

Reference: https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-onicecandidate

◆ RtcOnMessage

typedef VOID(* RtcOnMessage) (UINT64, PRtcDataChannel, BOOL, PBYTE, UINT32)

RtcOnMessage is fired when a message is received for the DataChannel.

Reference: https://www.w3.org/TR/webrtc/#dom-rtcdatachannel-onmessage

◆ RtcOnOpen

typedef VOID(* RtcOnOpen) (UINT64, PRtcDataChannel)

RtcOnOpen is fired when the DataChannel has opened

Reference: https://www.w3.org/TR/webrtc/#dom-rtcdatachannel-onopen

◆ RtcOnPeerCongestionFeedback

typedef STATUS(* RtcOnPeerCongestionFeedback) (UINT64, PCongestionCtx)

Called when the SDK has computed congestion context from TWCC feedback. The application uses this to make bandwidth decisions and adjust encoder parameters.

Parameters
[in]UINT64customData - User customData
[in]PCongestionCtxcongestionContext - latest feedback context

◆ RtcOnPictureLoss

typedef VOID(* RtcOnPictureLoss) (UINT64)

RtcOnPictureLoss is fired everytime a Picture Loss Indication (PLI) feedback message is received. Receiving such message normally indicates that you sent a video frame which receiver could not decode. It may happen either because of packet loss or for any other reason. Generating an intra frame (aka keyframe, aka I-frame) in response to such message is considered a good strategy.

See https://tools.ietf.org/html/rfc4585#section-6.3 for more details

◆ RtcOnSenderBandwidthEstimation

typedef VOID(* RtcOnSenderBandwidthEstimation) (UINT64, UINT32, UINT32, UINT32, UINT32, UINT64)

RtcOnSenderBandwidthEstimation is fired everytime a bandwidth estimation value is computed by sender. This is an estimate of ALL packets sent across all transceivers. See https://tools.ietf.org/html/draft-holmer-rmcat-transport-wide-cc-extensions-01 for more details.

NOTE: RtcOnSenderBandwidthEstimation is a KVS specific method

Parameters
[in]UINT64User customData that will be passed along when RtcOnSenderBandwidthEstimation is called
[in]UINT32txBytes - bytes sent over the transport
[in]UINT32rxBytes - bytes reported as received
[in]UINT32txPackets - number of packets sent over the transport
[in]UINT32rxPackets - number of packets reported as received
[in]UINT64duration - time window for txBytes, rxBytes, txPackets, rxPackets

◆ RtcOnTwccFeedbackReceived

typedef STATUS(* RtcOnTwccFeedbackReceived) (UINT64, PTwccFeedback, UINT32, PTwccCongestionState)

Called when new TWCC feedback is available from the remote peer. Updates the current network congestion state with latest data. The SDK provides a default implementation; set a custom callback to override.

Parameters
[in]UINT64customData - User customData
[in]PTwccFeedbacktwccFeedbackList - batch of per-packet feedback
[in]UINT32twccFeedbackListLen - length of the list
[in,out]PTwccCongestionStatepCongestionState - congestion state to update
Returns
STATUS code of the execution. STATUS_SUCCESS on success

◆ SignalingClientErrorReportFunc

typedef STATUS(* SignalingClientErrorReportFunc) (UINT64, STATUS, PCHAR, UINT32)

Callback that is fired on error.

NOTE: This callback is optional and can be set to NULL.

NOTE: Returning non-success status will terminate the internal event loop and will force the state machinery to roll back to the state corresponding to the type of status returned.

Parameters
-UINT64 - Custom data passed in to the signaling client
-STATUS - The status code of the error
-PCHAR - Variable - can point to an error string or other information
-UINT32 - Length of the message
Returns
- STATUS code of the operation

◆ SignalingClientMessageReceivedFunc

typedef STATUS(* SignalingClientMessageReceivedFunc) (UINT64, PReceivedSignalingMessage)

Callback that is fired when Signalling client receives an Offer

NOTE: Returning non-success status will terminate the internal event loop and will force the state machinery to roll back to the state corresponding to the type of status returned.

NOTE: The message is valid only until the callback returns; with PREFER_DYNAMIC_ALLOCS the SDK then frees its payload. To keep the message, copy the payload as well: a struct copy shares the payload pointer. Calling freeSignalingMessagePayload() on it inside the callback is safe.

Parameters
-UINT64 - Custom data passed in to the signaling client
-PReceivedSignalingMessage - Pointer to the received message
Returns
- STATUS code of the operation

◆ SignalingClientStateChangedFunc

typedef STATUS(* SignalingClientStateChangedFunc) (UINT64, SIGNALING_CLIENT_STATE)

Callback that is fired on signaling client state change.

NOTE: This callback is optional and can be set to NULL.

NOTE: Returning non-success status will terminate the internal event loop and will force the state machinery to roll back to the state corresponding to the type of status returned.

Parameters
-UINT64 - Custom data passed in to the signaling client
-SIGNALING_CLIENT_STATE - The new state
Returns
- STATUS code of the operation