Ignore:
Timestamp:
Jan 26, 2010 6:54:28 PM (14 years ago)
Author:
bennylp
Message:

Undo r3074 for ticket #1028 as it is missing updated codec.h hence causing build errors (thanks Michael Bradley Jr for the report)

File:
1 edited

Legend:

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

    r3074 r3075  
    2525#include <pj/assert.h> 
    2626#include <pj/log.h> 
    27 #include <pj/math.h> 
    2827#include <pj/pool.h> 
    2928#include <pj/string.h> 
     
    682681        amr_settings_t *s; 
    683682        pj_uint8_t octet_align = 0; 
    684         pj_int8_t enc_mode; 
    685  
    686         enc_mode = pjmedia_codec_amr_get_mode(attr->info.avg_bps); 
    687         pj_assert(enc_mode >= 0 && enc_mode <= 8); 
     683        const pj_str_t STR_FMTP_OCTET_ALIGN = {"octet-align", 11}; 
    688684 
    689685        /* Fetch octet-align setting. It should be fine to fetch only  
     
    692688         */ 
    693689        for (i = 0; i < attr->setting.dec_fmtp.cnt; ++i) { 
    694             const pj_str_t STR_FMTP_OCTET_ALIGN = {"octet-align", 11}; 
    695  
    696690            if (pj_stricmp(&attr->setting.dec_fmtp.param[i].name,  
    697691                           &STR_FMTP_OCTET_ALIGN) == 0) 
     
    703697        } 
    704698 
    705         for (i = 0; i < attr->setting.enc_fmtp.cnt; ++i) { 
    706             /* mode-set, encoding mode is chosen based on local default mode  
    707              * setting: 
    708              * - if local default mode is included in the mode-set, use it 
    709              * - otherwise, find the closest mode to local default mode; 
    710              *   if there are two closest modes, prefer to use the higher 
    711              *   one, e.g: local default mode is 4, the mode-set param 
    712              *   contains '2,3,5,6', then 5 will be chosen. 
    713              */ 
    714             const pj_str_t STR_FMTP_MODE_SET = {"mode-set", 8}; 
    715              
    716             if (pj_stricmp(&attr->setting.enc_fmtp.param[i].name,  
    717                            &STR_FMTP_MODE_SET) == 0) 
    718             { 
    719                 const char *p; 
    720                 pj_size_t l; 
    721                 pj_int8_t diff = 99; 
    722                  
    723                 p = pj_strbuf(&attr->setting.enc_fmtp.param[i].val); 
    724                 l = pj_strlen(&attr->setting.enc_fmtp.param[i].val); 
    725  
    726                 while (l--) { 
    727                     if ((desc->pt==PJMEDIA_RTP_PT_AMR && *p>='0' && *p<='7') || 
    728                         (desc->pt==PJMEDIA_RTP_PT_AMRWB && *p>='0' && *p<='8')) 
    729                     { 
    730                         pj_int8_t tmp = (pj_int8_t)(*p - '0' - enc_mode); 
    731  
    732                         if (PJ_ABS(diff) > PJ_ABS(tmp) ||  
    733                             (PJ_ABS(diff) == PJ_ABS(tmp) && tmp > diff)) 
    734                         { 
    735                             diff = tmp; 
    736                             if (diff == 0) break; 
    737                         } 
    738                     } 
    739                     ++p; 
    740                 } 
    741  
    742                 if (diff == 99) 
    743                     return PJMEDIA_CODEC_EFAILED; 
    744  
    745                 enc_mode = (pj_int8_t)(enc_mode + diff); 
    746  
    747                 break; 
    748             } 
    749         } 
    750  
    751699        s = PJ_POOL_ZALLOC_T(pool, amr_settings_t); 
    752700        codec_data->codec_setting = s; 
    753701 
    754         s->enc_mode = enc_mode; 
     702        s->enc_mode = pjmedia_codec_amr_get_mode(desc->def_bitrate); 
    755703        if (s->enc_mode < 0) 
    756704            return PJMEDIA_CODEC_EINMODE; 
     
    768716                                              doesn't do sensitivity bits  
    769717                                              reordering */ 
    770  
    771         /* Return back bitrate info to application */ 
    772         attr->info.avg_bps = s->enc_setting.amr_nb? 
    773                                 pjmedia_codec_amrnb_bitrates[s->enc_mode]: 
    774                                 pjmedia_codec_amrwb_bitrates[s->enc_mode]; 
    775718    } 
    776719#endif 
Note: See TracChangeset for help on using the changeset viewer.