Ignore:
Timestamp:
Oct 11, 2006 9:56:16 PM (18 years ago)
Author:
bennylp
Message:

Fixed bug in pjsua_media.c: when sound device is created with different sampling rate than the clock rate configuration, resampling port needs to be created.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c

    r763 r765  
    971971    const pjmedia_snd_dev_info *cap_info, *play_info; 
    972972    unsigned clock_rates[] = { 0, 22050, 44100, 48000, 11025, 32000, 8000}; 
     973    unsigned selected_clock_rate = 0; 
    973974    unsigned i; 
    974975    pj_status_t status = -1; 
     
    9991000                                         16, 0, &pjsua_var.snd_port); 
    10001001 
    1001         if (status == PJ_SUCCESS) 
     1002        if (status == PJ_SUCCESS) { 
     1003            selected_clock_rate = clock_rates[i]; 
    10021004            break; 
     1005        } 
    10031006 
    10041007        pj_strerror(status, errmsg, sizeof(errmsg)); 
    1005         PJ_LOG(4, ("..failed: %s", errmsg)); 
     1008        PJ_LOG(4, (THIS_FILE, "..failed: %s", errmsg)); 
    10061009    } 
    10071010 
     
    10191022                             pjsua_var.media_cfg.ec_tail_len,  
    10201023                             pjsua_var.media_cfg.ec_options); 
     1024 
     1025    /* If there's mismatch between sound port and conference's port, 
     1026     * create a resample port to bridge them. 
     1027     */ 
     1028    if (selected_clock_rate != pjsua_var.media_cfg.clock_rate) { 
     1029        pjmedia_port *resample_port; 
     1030 
     1031        status = pjmedia_resample_port_create(pjsua_var.pool, conf_port,  
     1032                                              selected_clock_rate, 0,  
     1033                                              &resample_port); 
     1034        if (status != PJ_SUCCESS) { 
     1035            pjsua_perror("Error creating resample port", THIS_FILE, status); 
     1036            return status; 
     1037        } 
     1038 
     1039        conf_port = resample_port; 
     1040    } 
    10211041 
    10221042    /* Connect sound port to the bridge */        
Note: See TracChangeset for help on using the changeset viewer.