{{{ #!html
}}} = Jitter Buffer Specification = '''Table of Contents''' [[PageOutline(2-3,,inline)]] This short article describes the specification for the jitter buffer. [[BR]] == Specifications == === Continuous flow === The main function of a jitter buffer is to ensure that it's user receive as continuous as possible flow of incoming frames regardless of the jitter in the incoming packet arrival time. The jitter buffer MUST provide this function. === Adaptive to jitter change === The jitter buffer MUST be able to adapt to change in network jitter, increasing or decreasing the prefetch value as necessary. === Low latency === The jitter buffer MUST attempt to provide the minimum buffering possible on the incoming packet (without sacrificing the continuous flow requirement above), to minimize latency. === Duplicate/old frame === The jitter buffer MUST be able to detect the arrival of duplicate or old frame. A duplicate frame is a frame which has the same frame number of an existing frame in it's buffer. In this case, the handling depends on the value of ''discarded'' argument in {{{pjmedia_jbuf_put_frame2()}}} function: - if non-zero (TRUE), jitter buffer MUST ignore the duplicate frame and set the ''discarded'' argument of {{{pjmedia_jbuf_put_frame2()}}}. - if FALSE, the jitter buffer will override the old frame with this newer frame, and set the ''discarded'' argument of {{{pjmedia_jbuf_put_frame2()}}} to FALSE. - if NULL, then FALSE is assumed. An old frame is a frame which sequence number is older than what is currently "played" (returned by the jitter buffer to it's user). Old frame is always discarded, and ''discarded'' argument of {{{pjmedia_jbuf_put_frame2()}}} function will be set. === Non octet-aligned === The jitter buffer MUST be able to store frames that are not octet/byte aligned. === Sequence number jump/restart === The jitter buffer MUST be able to detect large jump in sequence number and restart it's state. === DTX === The jitter buffer MUST be able to handle discontinuous transmission (DTX) without triggering restart. Note that user MAY use RTP timestamp or sequence number as frame sequence number of the jitter buffer frames, hence DTX MAY or MAY NOT be reflected with a jump in the frame sequence number. === Minimum prefetching === The jitter buffer MUST obey the minimum prefetching value as set by it's user. === Fixed mode operation === The jitter buffer MUST be able to operate in fixed/non-adaptive mode. This can be done by calling {{{pjmedia_jbuf_set_fixed()}}} function. === Return correct frame types === The jitter buffer MUST return the correct frame type in {{{pjmedia_jbuf_get_frame()}}}: - PJMEDIA_JB_NORMAL_FRAME: a normal frame has been returned. - PJMEDIA_JB_ZERO_PREFETCH_FRAME: no frame is returned because the jitter buffer is currently prefetching. - PJMEDIA_JB_ZERO_EMPTY_FRAME: no frame is returned because the jitter buffer is currently empty. - PJMEDIA_JB_MISSING_FRAME: no frame is returned because it's lost/missing. {{{ #!html
}}}