Amazon Kinesis Webrtc C SDK
JitterBuffer.h
Go to the documentation of this file.
1 /*******************************************
2 PeerConnection internal include file
3 *******************************************/
4 #ifndef __KINESIS_VIDEO_WEBRTC_CLIENT__JITTERBUFFER_H
5 #define __KINESIS_VIDEO_WEBRTC_CLIENT__JITTERBUFFER_H
6 
7 #pragma once
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 typedef STATUS (*FrameReadyFunc)(UINT64, UINT16, UINT16, UINT32);
14 typedef STATUS (*FrameDroppedFunc)(UINT64, UINT16, UINT16, UINT32);
15 #define UINT16_DEC(a) ((UINT16) ((a) - 1))
16 
17 #define JITTER_BUFFER_HASH_TABLE_BUCKET_COUNT 3000
18 #define JITTER_BUFFER_HASH_TABLE_BUCKET_LENGTH 2
19 
20 typedef struct {
24 
25  // used for calculating interarrival jitter https://tools.ietf.org/html/rfc3550#section-6.4.1
26  // https://tools.ietf.org/html/rfc3550#appendix-A.8
27  // holds the relative transit time for the previous packet
28  UINT64 transit;
29  // holds estimated jitter, in clockRate units
30  DOUBLE jitter;
33  UINT32 headTimestamp;
34  UINT32 tailTimestamp;
35  // this is set to U64 even though rtp timestamps are U32
36  // in order to allow calculations to not cause overflow
37  UINT64 maxLatency;
38  UINT64 customData;
39  UINT32 clockRate;
40  BOOL started;
44  PHashTable pPkgBufferHashTable;
46 
47 // constructor
49 // destructor
52 STATUS jitterBufferDropBufferData(PJitterBuffer, UINT16, UINT16, UINT32);
53 STATUS jitterBufferFillFrameData(PJitterBuffer, PBYTE, UINT32, PUINT32, UINT16, UINT16);
54 
55 #ifdef __cplusplus
56 }
57 #endif
58 #endif //__KINESIS_VIDEO_WEBRTC_CLIENT__JITTERBUFFER_H
struct JitterBuffer * PJitterBuffer
STATUS(* FrameReadyFunc)(UINT64, UINT16, UINT16, UINT32)
Definition: JitterBuffer.h:13
STATUS jitterBufferPush(PJitterBuffer, PRtpPacket, PBOOL)
Definition: JitterBuffer.c:394
STATUS jitterBufferDropBufferData(PJitterBuffer, UINT16, UINT16, UINT32)
Definition: JitterBuffer.c:599
STATUS(* FrameDroppedFunc)(UINT64, UINT16, UINT16, UINT32)
Definition: JitterBuffer.h:14
STATUS jitterBufferFillFrameData(PJitterBuffer, PBYTE, UINT32, PUINT32, UINT16, UINT16)
Definition: JitterBuffer.c:637
STATUS freeJitterBuffer(PJitterBuffer *)
Definition: JitterBuffer.c:64
STATUS createJitterBuffer(FrameReadyFunc, FrameDroppedFunc, DepayRtpPayloadFunc, UINT32, UINT32, UINT64, PJitterBuffer *)
Definition: JitterBuffer.c:11
STATUS(* DepayRtpPayloadFunc)(PBYTE, UINT32, PBYTE, PUINT32, PBOOL)
Definition: RtpPacket.h:42
Definition: JitterBuffer.h:20
DepayRtpPayloadFunc depayPayloadFn
Definition: JitterBuffer.h:23
UINT64 maxLatency
Definition: JitterBuffer.h:37
BOOL started
Definition: JitterBuffer.h:40
UINT64 transit
Definition: JitterBuffer.h:28
FrameDroppedFunc onFrameDroppedFn
Definition: JitterBuffer.h:22
BOOL timestampOverFlowState
Definition: JitterBuffer.h:43
UINT64 customData
Definition: JitterBuffer.h:38
FrameReadyFunc onFrameReadyFn
Definition: JitterBuffer.h:21
BOOL sequenceNumberOverflowState
Definition: JitterBuffer.h:42
UINT32 tailTimestamp
Definition: JitterBuffer.h:34
DOUBLE jitter
Definition: JitterBuffer.h:30
PHashTable pPkgBufferHashTable
Definition: JitterBuffer.h:44
UINT16 tailSequenceNumber
Definition: JitterBuffer.h:32
UINT16 headSequenceNumber
Definition: JitterBuffer.h:31
UINT32 headTimestamp
Definition: JitterBuffer.h:33
BOOL firstFrameProcessed
Definition: JitterBuffer.h:41
UINT32 clockRate
Definition: JitterBuffer.h:39
Definition: RtpPacket.h:89