Ignore:
Timestamp:
Oct 24, 2011 9:28:13 AM (13 years ago)
Author:
ming
Message:

Re #1395: Backport of PJSIP 1.x branch into PJSIP 2.0 trunk

TODO: ticket #1268 (Option for automatic/manual sending of RTCP SDES/BYE for the stream) for video stream.

Location:
pjproject/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk

  • pjproject/trunk/pjmedia/include/pjmedia/jbuf.h

    r3835 r3841  
    4949 * Types of frame returned by the jitter buffer. 
    5050 */ 
    51 enum pjmedia_jb_frame_type  
     51typedef enum pjmedia_jb_frame_type  
    5252{ 
    5353    PJMEDIA_JB_MISSING_FRAME       = 0, /**< No frame because it's missing  */ 
     
    5757    PJMEDIA_JB_ZERO_EMPTY_FRAME    = 3  /**< Zero frame is being returned 
    5858                                             because JB is empty.           */ 
    59 }; 
    60  
    61  
    62 /** 
    63  * @see pjmedia_jb_frame_type. 
    64  */ 
    65 typedef enum pjmedia_jb_frame_type pjmedia_jb_frame_type; 
     59} pjmedia_jb_frame_type; 
     60 
     61 
     62/** 
     63 * Enumeration of jitter buffer discard algorithm. The jitter buffer 
     64 * continuously calculates the jitter level to get the optimum latency at 
     65 * any time and in order to adjust the latency, the jitter buffer may need 
     66 * to discard some frames. 
     67 */ 
     68typedef enum pjmedia_jb_discard_algo 
     69{ 
     70    /** 
     71     * Jitter buffer should not discard any frame, except when the jitter 
     72     * buffer is full and a new frame arrives, one frame will be discarded 
     73     * to make space for the new frame. 
     74     */ 
     75    PJMEDIA_JB_DISCARD_NONE        = 0, 
     76 
     77    /** 
     78     * Only discard one frame in at least 200ms when the latency is considered 
     79     * much higher than it should be. When the jitter buffer is full and a new 
     80     * frame arrives, one frame will be discarded to make space for the new 
     81     * frame. 
     82     */ 
     83    PJMEDIA_JB_DISCARD_STATIC, 
     84 
     85    /** 
     86     * The discard rate is dynamically calculated based on actual parameters 
     87     * such as jitter level and latency. When the jitter buffer is full and 
     88     * a new frame arrives, one frame will be discarded to make space for the 
     89     * new frame. 
     90     */ 
     91    PJMEDIA_JB_DISCARD_PROGRESSIVE 
     92 
     93} pjmedia_jb_discard_algo; 
    6694 
    6795 
     
    108136 * Create an adaptive jitter buffer according to the specification. If 
    109137 * application wants to have a fixed jitter buffer, it may call 
    110  * #pjmedia_jbuf_set_fixed() after the jitter buffer is created. 
     138 * #pjmedia_jbuf_set_fixed() after the jitter buffer is created. Also 
     139 * if application wants to alter the discard algorithm, which the default 
     140 * PJMEDIA_JB_DISCARD_PROGRESSIVE, it may call #pjmedia_jbuf_set_discard(). 
    111141 * 
    112142 * This function may allocate large chunk of memory to keep the frames in  
     
    175205 
    176206/** 
    177  * Enable/disable the jitter buffer drift detection and handling mechanism. 
    178  * The default behavior is enabled. 
    179  * 
    180  * @param jb            The jitter buffer 
    181  * @param enable        Set to PJ_TRUE to enable or PJ_FALSE to disable. 
    182  * 
    183  * @return              PJ_SUCCESS on success. 
    184  */ 
    185 PJ_DECL(pj_status_t) pjmedia_jbuf_enable_discard(pjmedia_jbuf *jb, 
    186                                                  pj_bool_t enable); 
     207 * Set the jitter buffer discard algorithm. The default discard algorithm, 
     208 * set in jitter buffer creation, is PJMEDIA_JB_DISCARD_PROGRESSIVE. 
     209 * 
     210 * @param jb            The jitter buffer. 
     211 * @param algo          The discard algorithm to be used. 
     212 * 
     213 * @return              PJ_SUCCESS on success. 
     214 */ 
     215PJ_DECL(pj_status_t) pjmedia_jbuf_set_discard(pjmedia_jbuf *jb, 
     216                                              pjmedia_jb_discard_algo algo); 
    187217 
    188218 
Note: See TracChangeset for help on using the changeset viewer.