Changeset 4610


Ignore:
Timestamp:
Oct 3, 2013 10:26:14 AM (11 years ago)
Author:
ming
Message:

Re #1697: Add device info in pj_get_sys_info() and set default clock rate for iPhone 5 running iOS7 to 44100Hz

Location:
pjproject/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/src/pj/os_info.c

    r4537 r4610  
    5858 
    5959#if defined(PJ_DARWINOS) && PJ_DARWINOS != 0 && TARGET_OS_IPHONE 
     60#   include <sys/types.h> 
     61#   include <sys/sysctl.h> 
    6062    void pj_iphone_os_get_sys_info(pj_sys_info *si, pj_str_t *si_buffer); 
    6163#endif 
     
    152154    { 
    153155        pj_str_t buf = {si_buffer + PJ_SYS_INFO_BUFFER_SIZE - left, left}; 
    154         pj_str_t machine = {"arm", 3}; 
     156        pj_str_t machine = {"arm-", 4}; 
    155157        pj_str_t sdk_name = {"iOS-SDK", 7}; 
     158        size_t size = PJ_SYS_INFO_BUFFER_SIZE - machine.slen; 
    156159        char tmp[PJ_SYS_INFO_BUFFER_SIZE]; 
    157          
     160        int name[] = {CTL_HW,HW_MACHINE}; 
     161 
    158162        pj_iphone_os_get_sys_info(&si, &buf); 
    159163        left -= si.os_name.slen + 1; 
    160164 
    161165        si.os_ver = parse_version(si.machine.ptr); 
    162          
    163         si.machine = machine; 
     166 
     167        pj_memcpy(tmp, machine.ptr, machine.slen); 
     168        sysctl(name, 2, tmp+machine.slen, &size, NULL, 0); 
     169        ALLOC_CP_STR(tmp, machine); 
    164170        si.sdk_name = sdk_name; 
    165171 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c

    r4555 r4610  
    310310PJ_DEF(void) pjsua_media_config_default(pjsua_media_config *cfg) 
    311311{ 
     312    const pj_sys_info *si = pj_get_sys_info(); 
     313    pj_str_t dev_model = {"iPhone5", 7}; 
     314     
    312315    pj_bzero(cfg, sizeof(*cfg)); 
    313316 
    314317    cfg->clock_rate = PJSUA_DEFAULT_CLOCK_RATE; 
    315     cfg->snd_clock_rate = 0; 
     318    /* It is reported that there may be some media server resampling problem 
     319     * with iPhone 5 devices running iOS 7, so we set the sound device's 
     320     * clock rate to 44100 to avoid resampling. 
     321     */ 
     322    if (pj_stristr(&si->machine, &dev_model) && 
     323        ((si->os_ver & 0xFF000000) >> 24) >= 7) 
     324    { 
     325        cfg->snd_clock_rate = 44100; 
     326    } else { 
     327        cfg->snd_clock_rate = 0; 
     328    } 
    316329    cfg->channel_count = 1; 
    317330    cfg->audio_frame_ptime = PJSUA_DEFAULT_AUDIO_FRAME_PTIME; 
Note: See TracChangeset for help on using the changeset viewer.