Ignore:
Timestamp:
May 13, 2006 10:46:23 PM (18 years ago)
Author:
bennylp
Message:

Another major modifications in PJMEDIA:

  • handle multiple frames in one packet
  • split stream creation into two steps to allow customization
  • PLC framework and implementation with G.711 and speex
  • stream returns NO_FRAME correctly.
  • added ptime argument in pjsua
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia-codec/gsm.c

    r411 r438  
    5555                                    pjmedia_codec_param *attr ); 
    5656static pj_status_t  gsm_codec_close( pjmedia_codec *codec ); 
    57 static pj_status_t  gsm_codec_get_frames( pjmedia_codec *codec, 
    58                                           void *pkt, 
    59                                           pj_size_t pkt_size, 
    60                                           unsigned *frame_cnt, 
    61                                           pjmedia_frame frames[]); 
     57static pj_status_t  gsm_codec_parse( pjmedia_codec *codec, 
     58                                     void *pkt, 
     59                                     pj_size_t pkt_size, 
     60                                     const pj_timestamp *ts, 
     61                                     unsigned *frame_cnt, 
     62                                     pjmedia_frame frames[]); 
    6263static pj_status_t  gsm_codec_encode( pjmedia_codec *codec,  
    6364                                      const struct pjmedia_frame *input, 
     
    7576    &gsm_codec_open, 
    7677    &gsm_codec_close, 
    77     &gsm_codec_get_frames, 
     78    &gsm_codec_parse, 
    7879    &gsm_codec_encode, 
    7980    &gsm_codec_decode 
     
    231232 
    232233    pj_memset(attr, 0, sizeof(pjmedia_codec_param)); 
    233     attr->clock_rate = 8000; 
    234     attr->channel_cnt = 1; 
    235     attr->avg_bps = 13200; 
    236     attr->pcm_bits_per_sample = 16; 
    237     attr->ptime = 20; 
    238     attr->pt = PJMEDIA_RTP_PT_GSM; 
     234    attr->info.clock_rate = 8000; 
     235    attr->info.channel_cnt = 1; 
     236    attr->info.avg_bps = 13200; 
     237    attr->info.pcm_bits_per_sample = 16; 
     238    attr->info.frm_ptime = 20; 
     239    attr->info.pt = PJMEDIA_RTP_PT_GSM; 
     240 
     241    attr->setting.frm_per_pkt = 1; 
    239242 
    240243    /* Default all flag bits disabled. */ 
     
    387390 * Get frames in the packet. 
    388391 */ 
    389 static pj_status_t  gsm_codec_get_frames( pjmedia_codec *codec, 
    390                                           void *pkt, 
    391                                           pj_size_t pkt_size, 
    392                                           unsigned *frame_cnt, 
    393                                           pjmedia_frame frames[]) 
     392static pj_status_t  gsm_codec_parse( pjmedia_codec *codec, 
     393                                     void *pkt, 
     394                                     pj_size_t pkt_size, 
     395                                     const pj_timestamp *ts, 
     396                                     unsigned *frame_cnt, 
     397                                     pjmedia_frame frames[]) 
    394398{ 
    395399    unsigned count = 0; 
     
    400404 
    401405    while (pkt_size >= 33 && count < *frame_cnt) { 
    402         frames[0].type = PJMEDIA_FRAME_TYPE_AUDIO; 
    403         frames[0].buf = pkt; 
    404         frames[0].size = 33; 
     406        frames[count].type = PJMEDIA_FRAME_TYPE_AUDIO; 
     407        frames[count].buf = pkt; 
     408        frames[count].size = 33; 
     409        frames[count].timestamp.u64 = ts->u64 + count * 160; 
    405410 
    406411        pkt = ((char*)pkt) + 33; 
Note: See TracChangeset for help on using the changeset viewer.