Changeset 3915


Ignore:
Timestamp:
Dec 20, 2011 9:52:19 AM (8 years ago)
Author:
nanang
Message:

Fix #1425:

  • Updating port info of the switchboard master port (after reopening audio device) with the audio device param should care about PJMEDIA_AUD_DEV_CAP_EXT_FORMAT flag, i.e: only copy from audio device extended format info when the flag is set.
  • Fixed switchboard to update the master port info shortcut in connecting ports, as master port info may get updated to match to the connecting ports.
Location:
pjproject/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/src/pjmedia/conf_switch.c

    r3730 r3915  
    591591    } 
    592592 
     593    /* Update master port info shortcut, note that application may update 
     594     * the master port info when the audio device needs to be reopened with 
     595     * a new format to match to ports connection format. 
     596     */ 
     597    conf->ports[0]->samples_per_frame = PJMEDIA_PIA_SPF(conf->ports[0]->info); 
     598 
    593599    if (i == src_port->listener_cnt) { 
    594600        src_port->listener_slots[src_port->listener_cnt] = sink_slot; 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c

    r3909 r3915  
    37183718     */ 
    37193719    if (pjsua_var.is_mswitch) { 
    3720         pj_memcpy(&conf_port->info.fmt, &param->base.ext_fmt, 
    3721                   sizeof(conf_port->info.fmt)); 
    3722         conf_port->info.fmt.det.aud.clock_rate = param->base.clock_rate; 
    3723         conf_port->info.fmt.det.aud.frame_time_usec = param->base.samples_per_frame* 
    3724                                                       1000000 / 
    3725                                                       param->base.clock_rate; 
    3726         conf_port->info.fmt.det.aud.channel_count = param->base.channel_count; 
    3727         conf_port->info.fmt.det.aud.bits_per_sample = 16; 
     3720        if (param->base.flags & PJMEDIA_AUD_DEV_CAP_EXT_FORMAT) { 
     3721            conf_port->info.fmt = param->base.ext_fmt; 
     3722        } else { 
     3723            unsigned bps, ptime_usec; 
     3724            bps = param->base.clock_rate * param->base.bits_per_sample; 
     3725            ptime_usec = param->base.samples_per_frame / 
     3726                         param->base.channel_count * 1000000 / 
     3727                         param->base.clock_rate; 
     3728            pjmedia_format_init_audio(&conf_port->info.fmt, 
     3729                                      PJMEDIA_FORMAT_PCM, 
     3730                                      param->base.clock_rate, 
     3731                                      param->base.channel_count, 
     3732                                      param->base.bits_per_sample, 
     3733                                      ptime_usec, 
     3734                                      bps, bps); 
     3735        } 
    37283736    } 
    37293737 
Note: See TracChangeset for help on using the changeset viewer.