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/l16.c

    r411 r438  
    6262                               pjmedia_codec_param *attr ); 
    6363static pj_status_t  l16_close( pjmedia_codec *codec ); 
    64 static pj_status_t  l16_get_frames(pjmedia_codec *codec, 
    65                                     void *pkt, 
    66                                     pj_size_t pkt_size, 
    67                                     unsigned *frame_cnt, 
    68                                     pjmedia_frame frames[]); 
     64static pj_status_t  l16_parse(pjmedia_codec *codec, 
     65                              void *pkt, 
     66                              pj_size_t pkt_size, 
     67                              const pj_timestamp *ts, 
     68                              unsigned *frame_cnt, 
     69                              pjmedia_frame frames[]); 
    6970static pj_status_t  l16_encode( pjmedia_codec *codec,  
    7071                                 const struct pjmedia_frame *input, 
     
    8283    &l16_open, 
    8384    &l16_close, 
    84     &l16_get_frames, 
     85    &l16_parse, 
    8586    &l16_encode, 
    8687    &l16_decode 
     
    235236 
    236237    pj_memset(attr, 0, sizeof(pjmedia_codec_param)); 
    237     attr->pt = id->pt; 
    238     attr->clock_rate = id->clock_rate; 
    239     attr->channel_cnt = id->channel_cnt; 
    240     attr->avg_bps = id->clock_rate * id->channel_cnt * 16; 
    241     attr->pcm_bits_per_sample = 16; 
     238    attr->info.pt = (pj_uint8_t)id->pt; 
     239    attr->info.clock_rate = id->clock_rate; 
     240    attr->info.channel_cnt = id->channel_cnt; 
     241    attr->info.avg_bps = id->clock_rate * id->channel_cnt * 16; 
     242    attr->info.pcm_bits_per_sample = 16; 
    242243 
    243244    /* To keep frame size below 1400 MTU, set ptime to 10ms for 
    244245     * sampling rate > 35 KHz 
    245246     */ 
    246     attr->ptime = GET_PTIME(id->clock_rate); 
     247    attr->info.frm_ptime = GET_PTIME(id->clock_rate); 
     248 
     249    attr->setting.frm_per_pkt = 1; 
    247250 
    248251    /* Default all flag bits disabled. */ 
     
    499502} 
    500503 
    501 static pj_status_t  l16_get_frames( pjmedia_codec *codec, 
    502                                     void *pkt, 
    503                                     pj_size_t pkt_size, 
    504                                     unsigned *frame_cnt, 
    505                                     pjmedia_frame frames[]) 
     504static pj_status_t  l16_parse( pjmedia_codec *codec, 
     505                               void *pkt, 
     506                               pj_size_t pkt_size, 
     507                               const pj_timestamp *ts, 
     508                               unsigned *frame_cnt, 
     509                               pjmedia_frame frames[]) 
    506510{ 
    507511    unsigned count = 0; 
     
    512516 
    513517    while (pkt_size >= data->frame_size && count < *frame_cnt) { 
    514         frames[0].type = PJMEDIA_FRAME_TYPE_AUDIO; 
    515         frames[0].buf = pkt; 
    516         frames[0].size = data->frame_size; 
     518        frames[count].type = PJMEDIA_FRAME_TYPE_AUDIO; 
     519        frames[count].buf = pkt; 
     520        frames[count].size = data->frame_size; 
     521        frames[count].timestamp.u64 = ts->u64 + (count * data->frame_size); 
    517522 
    518523        pkt = ((char*)pkt) + data->frame_size; 
Note: See TracChangeset for help on using the changeset viewer.