Ignore:
Timestamp:
May 11, 2006 2:22:01 PM (18 years ago)
Author:
bennylp
Message:

Fixed bug: incorrect remote and local PT for telephone-events (swapped)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/include/pjmedia/jbuf.h

    r408 r435  
    4646enum pjmedia_jb_frame_type  
    4747{ 
    48     PJMEDIA_JB_MISSING_FRAME   = 0, /**< No frame because it's missing.     */ 
    49     PJMEDIA_JB_NORMAL_FRAME    = 1, /**< Normal frame is being returned.    */ 
    50     PJMEDIA_JB_ZERO_FRAME      = 2, /**< Zero frame is being returned.      */ 
     48    PJMEDIA_JB_MISSING_FRAME       = 0, /**< No frame because it's missing  */ 
     49    PJMEDIA_JB_NORMAL_FRAME        = 1, /**< Normal frame is being returned */ 
     50    PJMEDIA_JB_ZERO_PREFETCH_FRAME = 2, /**< Zero frame is being returned   
     51                                             because JB is bufferring.      */ 
     52    PJMEDIA_JB_ZERO_EMPTY_FRAME    = 3  /**< Zero frame is being returned 
     53                                             because JB is empty.           */ 
    5154}; 
     55 
     56 
     57/** 
     58 * This structure describes jitter buffer current status. 
     59 */ 
     60struct pjmedia_jb_state 
     61{ 
     62    unsigned    frame_size;         /**< Individual frame size, in bytes.   */ 
     63    unsigned    prefetch;           /**< Current prefetch value, in frames  */ 
     64    unsigned    min_prefetch;       /**< Minimum allowed prefetch, in frms. */ 
     65    unsigned    max_prefetch;       /**< Maximum allowed prefetch, in frms. */ 
     66    unsigned    size;               /**< Current buffer size, in frames.    */ 
     67}; 
     68 
     69 
     70/** 
     71 * @see pjmedia_jb_state 
     72 */ 
     73typedef struct pjmedia_jb_state pjmedia_jb_state; 
    5274 
    5375 
     
    6082 
    6183/** 
    62  * Create the jitter buffer. This function may allocate large chunk of 
    63  * memory to keep the frames in the buffer. 
     84 * Create an adaptive jitter buffer according to the specification. If 
     85 * application wants to have a fixed jitter buffer, it may call 
     86 * #pjmedia_jbuf_set_fixed() after the jitter buffer is created. 
     87 * 
     88 * This function may allocate large chunk of memory to keep the frames in  
     89 * the buffer. 
    6490 * 
    6591 * @param pool          The pool to allocate memory. 
     
    6793 *                      purpose. 
    6894 * @param frame_size    The size of each frame that will be kept in the 
    69  *                      jitter buffer. The value here normaly corresponds 
    70  *                      to the RTP payload size according to the codec 
    71  *                      being used. 
    72  * @param init_delay    Initial jitter buffer delay, in number of frames. 
    73  * @param max_count     Maximum jitter buffer delay, in number of frames. 
     95 *                      jitter buffer, in bytes. This should correspond 
     96 *                      to the minimum frame size supported by the codec. 
     97 *                      For example, a 10ms frame (80 bytes) would be  
     98 *                      recommended for G.711 codec. 
     99 * @param max_count     Maximum number of frames that can be kept in the 
     100 *                      jitter buffer. This effectively means the maximum 
     101 *                      delay that may be introduced by this jitter  
     102 *                      buffer. 
    74103 * @param p_jb          Pointer to receive jitter buffer instance. 
    75104 * 
     
    78107PJ_DECL(pj_status_t) pjmedia_jbuf_create(pj_pool_t *pool, 
    79108                                         const pj_str_t *name, 
    80                                          int frame_size,  
    81                                          int init_delay,  
    82                                          int max_count, 
     109                                         unsigned frame_size, 
     110                                         unsigned max_count, 
    83111                                         pjmedia_jbuf **p_jb); 
     112 
     113/** 
     114 * Set the jitter buffer to fixed delay mode. The default behavior 
     115 * is to adapt the delay with actual packet delay. 
     116 * 
     117 * @param jb            The jitter buffer 
     118 * @param prefetch      The fixed delay value, in number of frames. 
     119 * 
     120 * @return              PJ_SUCCESS on success. 
     121 */ 
     122PJ_DECL(pj_status_t) pjmedia_jbuf_set_fixed( pjmedia_jbuf *jb, 
     123                                             unsigned prefetch); 
     124 
     125 
     126/** 
     127 * Set the jitter buffer to adaptive mode. 
     128 * 
     129 * @param jb            The jitter buffer. 
     130 * @param prefetch      The prefetch value to be applied to the jitter 
     131 *                      buffer. 
     132 * @param min_prefetch  The minimum delay that must be applied to each 
     133 *                      incoming packets, in number of frames. The 
     134 *                      default value is zero. 
     135 * @param max_prefetch  The maximum allowable value for prefetch delay, 
     136 *                      in number of frames. The default value is equal 
     137 *                      to the size of the jitter buffer. 
     138 * 
     139 * @return              PJ_SUCCESS on success. 
     140 */ 
     141PJ_DECL(pj_status_t) pjmedia_jbuf_set_adaptive( pjmedia_jbuf *jb, 
     142                                                unsigned prefetch, 
     143                                                unsigned min_prefetch, 
     144                                                unsigned max_prefetch); 
     145 
    84146 
    85147/** 
     
    156218                                             char *p_frm_type); 
    157219 
    158 /** 
    159  * Retrieve the current value of jitter buffer minimum delay, in number 
    160  * of frames. 
    161  * 
    162  * @param jb            The jitter buffer. 
    163  * 
    164  * @return              Number of frames, indicating the minimum delay that  
    165  *                      will be applied by the jitter buffer between frame 
    166  *                      arrival and frame retrieval. 
    167  */ 
    168 PJ_DECL(unsigned)    pjmedia_jbuf_get_min_delay_size(pjmedia_jbuf *jb); 
    169  
    170  
    171 /** 
    172  * Retrieve the current delay value, in number of frames. 
    173  * 
    174  * @param jb            The jitter buffer. 
    175  * 
    176  * @return              Number of frames, indicating the delay between frame 
    177  *                      arrival and frame retrieval. 
    178  */ 
    179 PJ_DECL(unsigned)    pjmedia_jbuf_get_delay(pjmedia_jbuf *jb); 
     220 
     221/** 
     222 * Get jitter buffer state. 
     223 * 
     224 * @param jb            The jitter buffer. 
     225 * @param state         Buffer to receive jitter buffer state. 
     226 * 
     227 * @return              PJ_SUCCESS on success. 
     228 */ 
     229PJ_DECL(pj_status_t) pjmedia_jbuf_get_state( pjmedia_jbuf *jb, 
     230                                             pjmedia_jb_state *state ); 
    180231 
    181232 
Note: See TracChangeset for help on using the changeset viewer.