Changeset 3438 for pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
- Timestamp:
- Mar 11, 2011 6:57:24 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_media.c
r3383 r3438 37 37 38 38 /* Open sound dev */ 39 static pj_status_t open_snd_dev(pjmedia_ aud_param *param);39 static pj_status_t open_snd_dev(pjmedia_snd_port_param *param); 40 40 /* Close existing sound device */ 41 41 static void close_snd_dev(void); … … 1976 1976 if (need_reopen) { 1977 1977 if (pjsua_var.cap_dev != NULL_SND_DEV_ID) { 1978 pjmedia_ aud_param param;1978 pjmedia_snd_port_param param; 1979 1979 1980 1980 /* Create parameter based on peer info */ 1981 status = create_aud_param(¶m , pjsua_var.cap_dev,1981 status = create_aud_param(¶m.base, pjsua_var.cap_dev, 1982 1982 pjsua_var.play_dev, 1983 1983 peer_info.clock_rate, … … 1992 1992 /* And peer format */ 1993 1993 if (peer_info.format.id != PJMEDIA_FORMAT_PCM) { 1994 param. flags |= PJMEDIA_AUD_DEV_CAP_EXT_FORMAT;1995 param. ext_fmt = peer_info.format;1994 param.base.flags |= PJMEDIA_AUD_DEV_CAP_EXT_FORMAT; 1995 param.base.ext_fmt = peer_info.format; 1996 1996 } 1997 1997 1998 param.options = 0; 1998 1999 status = open_snd_dev(¶m); 1999 2000 if (status != PJ_SUCCESS) { … … 2666 2667 2667 2668 /* Open sound device with the setting. */ 2668 static pj_status_t open_snd_dev(pjmedia_ aud_param *param)2669 static pj_status_t open_snd_dev(pjmedia_snd_port_param *param) 2669 2670 { 2670 2671 pjmedia_port *conf_port; … … 2674 2675 2675 2676 /* Check if NULL sound device is used */ 2676 if (NULL_SND_DEV_ID==param->rec_id || NULL_SND_DEV_ID==param->play_id) { 2677 if (NULL_SND_DEV_ID==param->base.rec_id || 2678 NULL_SND_DEV_ID==param->base.play_id) 2679 { 2677 2680 return pjsua_set_null_snd_dev(); 2678 2681 } … … 2687 2690 2688 2691 PJ_LOG(4,(THIS_FILE, "Opening sound device %s@%d/%d/%dms", 2689 get_fmt_name(param-> ext_fmt.id),2690 param-> clock_rate, param->channel_count,2691 param-> samples_per_frame / param->channel_count * 1000 /2692 param->clock_rate));2692 get_fmt_name(param->base.ext_fmt.id), 2693 param->base.clock_rate, param->base.channel_count, 2694 param->base.samples_per_frame / param->base.channel_count * 2695 1000 / param->base.clock_rate)); 2693 2696 2694 2697 status = pjmedia_snd_port_create2( pjsua_var.snd_pool, 2695 param, 2698 param, &pjsua_var.snd_port); 2696 2699 if (status != PJ_SUCCESS) 2697 2700 return status; … … 2705 2708 */ 2706 2709 if (!pjsua_var.is_mswitch && 2707 param-> ext_fmt.id == PJMEDIA_FORMAT_PCM &&2708 conf_port->info.clock_rate != param-> clock_rate)2710 param->base.ext_fmt.id == PJMEDIA_FORMAT_PCM && 2711 conf_port->info.clock_rate != param->base.clock_rate) 2709 2712 { 2710 2713 pjmedia_port *resample_port; … … 2722 2725 status = pjmedia_resample_port_create(pjsua_var.snd_pool, 2723 2726 conf_port, 2724 param-> clock_rate,2727 param->base.clock_rate, 2725 2728 resample_opt, 2726 2729 &resample_port); … … 2742 2745 */ 2743 2746 if (pjsua_var.is_mswitch) { 2744 pj_memcpy(&conf_port->info.format, ¶m-> ext_fmt,2747 pj_memcpy(&conf_port->info.format, ¶m->base.ext_fmt, 2745 2748 sizeof(conf_port->info.format)); 2746 conf_port->info.clock_rate = param-> clock_rate;2747 conf_port->info.samples_per_frame = param-> samples_per_frame;2748 conf_port->info.channel_count = param-> channel_count;2749 conf_port->info.clock_rate = param->base.clock_rate; 2750 conf_port->info.samples_per_frame = param->base.samples_per_frame; 2751 conf_port->info.channel_count = param->base.channel_count; 2749 2752 conf_port->info.bits_per_sample = 16; 2750 2753 } … … 2762 2765 2763 2766 /* Save the device IDs */ 2764 pjsua_var.cap_dev = param-> rec_id;2765 pjsua_var.play_dev = param-> play_id;2767 pjsua_var.cap_dev = param->base.rec_id; 2768 pjsua_var.play_dev = param->base.play_id; 2766 2769 2767 2770 /* Update sound device name. */ … … 2778 2781 2779 2782 if (status==PJ_SUCCESS) { 2780 if (param-> clock_rate != pjsua_var.media_cfg.clock_rate) {2783 if (param->base.clock_rate != pjsua_var.media_cfg.clock_rate) { 2781 2784 char tmp_buf[128]; 2782 2785 int tmp_buf_len = sizeof(tmp_buf); … … 2785 2788 "%s (%dKHz)", 2786 2789 rec_info.name, 2787 param-> clock_rate/1000);2790 param->base.clock_rate/1000); 2788 2791 pj_strset(&tmp, tmp_buf, tmp_buf_len); 2789 2792 pjmedia_conf_set_port0_name(pjsua_var.mconf, &tmp); … … 2884 2887 /* Attempts to open the sound device with different clock rates */ 2885 2888 for (i=0; i<alt_cr_cnt; ++i) { 2886 pjmedia_ aud_param param;2889 pjmedia_snd_port_param param; 2887 2890 unsigned samples_per_frame; 2888 2891 … … 2891 2894 pjsua_var.media_cfg.audio_frame_ptime * 2892 2895 pjsua_var.media_cfg.channel_count / 1000; 2893 status = create_aud_param(¶m , capture_dev, playback_dev,2896 status = create_aud_param(¶m.base, capture_dev, playback_dev, 2894 2897 alt_cr[i], pjsua_var.media_cfg.channel_count, 2895 2898 samples_per_frame, 16); … … 2898 2901 2899 2902 /* Open! */ 2903 param.options = 0; 2900 2904 status = open_snd_dev(¶m); 2901 2905 if (status == PJ_SUCCESS)
Note: See TracChangeset
for help on using the changeset viewer.