Changeset 429 for pjproject


Ignore:
Timestamp:
May 2, 2006 5:51:04 PM (19 years ago)
Author:
bennylp
Message:

Rename hard coded constants (such as ptime) in G711 to a macro for better aesthetic

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia/g711.c

    r411 r429  
    3333#define G711_BPS        64000 
    3434#define G711_CODEC_CNT  0       /* number of codec to preallocate in memory */ 
     35#define PTIME           20 
     36#define FRAME_SIZE      (8000 * PTIME / 1000) 
    3537 
    3638/* These are the only public functions exported to applications */ 
     
    230232    attr->avg_bps = G711_BPS; 
    231233    attr->pcm_bits_per_sample = 16; 
    232     attr->ptime = 20; 
     234    attr->ptime = PTIME; 
    233235    attr->pt = id->pt; 
    234236 
     
    371373    PJ_ASSERT_RETURN(frame_cnt, PJ_EINVAL); 
    372374 
    373     while (pkt_size >= 160 && count < *frame_cnt) { 
     375    while (pkt_size >= FRAME_SIZE && count < *frame_cnt) { 
    374376        frames[0].type = PJMEDIA_FRAME_TYPE_AUDIO; 
    375377        frames[0].buf = pkt; 
    376         frames[0].size = 160; 
    377  
    378         pkt = ((char*)pkt) + 160; 
    379         pkt_size -= 160; 
     378        frames[0].size = FRAME_SIZE; 
     379 
     380        pkt = ((char*)pkt) + FRAME_SIZE; 
     381        pkt_size -= FRAME_SIZE; 
    380382 
    381383        ++count; 
Note: See TracChangeset for help on using the changeset viewer.