Ignore:
Timestamp:
May 27, 2008 12:24:26 AM (16 years ago)
Author:
nanang
Message:

Changed build optimizations settings for Speex, pjmedia, and symbian_sound for Symbian. Speex/8000 now also runs on Symbian!

File:
1 edited

Legend:

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

    r1677 r1965  
    3737 
    3838#define THIS_FILE   "speex_codec.c" 
    39  
    40 #define DEFAULT_QUALITY     10 
    41 #define DEFAULT_COMPLEXITY  10 
    4239 
    4340/* Prototypes for Speex factory */ 
     
    212209 
    213210    /* Get defaults */ 
    214     if (quality <= 0) quality = DEFAULT_QUALITY; 
    215     if (complexity <= 0) complexity = DEFAULT_COMPLEXITY; 
     211    if (quality < 0) quality = PJMEDIA_CODEC_SPEEX_DEFAULT_QUALITY; 
     212    if (complexity < 0) complexity = PJMEDIA_CODEC_SPEEX_DEFAULT_COMPLEXITY; 
     213 
     214    /* Validate quality & complexity */ 
     215    PJ_ASSERT_RETURN(quality >= 0 && quality <= 10, PJ_EINVAL); 
     216    PJ_ASSERT_RETURN(complexity >= 1 && complexity <= 10, PJ_EINVAL); 
    216217 
    217218    /* Create Speex codec factory. */ 
     
    298299{ 
    299300    return pjmedia_codec_speex_init(endpt, 0, -1, -1); 
     301} 
     302 
     303/* 
     304 * Change the settings of Speex codec. 
     305 */ 
     306PJ_DEF(pj_status_t) pjmedia_codec_speex_set_param(unsigned clock_rate, 
     307                                                  int quality, 
     308                                                  int complexity) 
     309{ 
     310    unsigned i; 
     311 
     312    /* Get defaults */ 
     313    if (quality < 0) quality = PJMEDIA_CODEC_SPEEX_DEFAULT_QUALITY; 
     314    if (complexity < 0) complexity = PJMEDIA_CODEC_SPEEX_DEFAULT_COMPLEXITY; 
     315 
     316    /* Validate quality & complexity */ 
     317    PJ_ASSERT_RETURN(quality >= 0 && quality <= 10, PJ_EINVAL); 
     318    PJ_ASSERT_RETURN(complexity >= 1 && complexity <= 10, PJ_EINVAL); 
     319 
     320    /* Apply the settings */ 
     321    for (i=0; i<PJ_ARRAY_SIZE(spx_factory.speex_param); ++i) { 
     322        if (spx_factory.speex_param[i].clock_rate == clock_rate) { 
     323            pj_status_t status; 
     324 
     325            spx_factory.speex_param[i].quality = quality; 
     326            spx_factory.speex_param[i].complexity = complexity; 
     327 
     328            /* Somehow quality<=4 is broken in linux. */ 
     329            if (i == PARAM_UWB && quality <= 4 && quality >= 0) { 
     330                PJ_LOG(5,(THIS_FILE, "Adjusting quality to 5 for uwb")); 
     331                spx_factory.speex_param[PARAM_UWB].quality = 5; 
     332            } 
     333 
     334            status = get_speex_info(&spx_factory.speex_param[i]); 
     335 
     336            return status; 
     337        } 
     338    } 
     339 
     340    return PJ_EINVAL; 
    300341} 
    301342 
Note: See TracChangeset for help on using the changeset viewer.