Changes between Version 6 and Version 7 of Nokia_APS_VAS_Direct
- Timestamp:
- Feb 14, 2009 12:56:49 PM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Nokia_APS_VAS_Direct
v6 v7 123 123 {{{ 124 124 /* Global sound port. */ 125 static pjmedia_snd_port * snd_port;125 static pjmedia_snd_port *g_snd_port; 126 126 127 127 /* Reopen sound device on on_stream_created() pjsua callback. */ 128 static void on_stream_created(pjsua_call_id call_id,128 static void on_stream_created(pjsua_call_id, 129 129 pjmedia_session *sess, 130 130 unsigned stream_idx, 131 pjmedia_port 131 pjmedia_port**) 132 132 { 133 133 pjmedia_port *conf; … … 159 159 /* Reset conference port attributes. */ 160 160 conf->info.samples_per_frame = samples_per_frame; 161 conf->info.clock_rate = 8000;162 conf->info.channel_count = 1;161 conf->info.clock_rate = strm_info->param->info.clock_rate; 162 conf->info.channel_count = strm_info->param->info.channel_cnt; 163 163 conf->info.bits_per_sample = 16; 164 164 … … 168 168 0, 169 169 0, 170 8000,171 1,170 strm_info->param->info.clock_rate, 171 strm_info->param->info.channel_cnt, 172 172 samples_per_frame, 173 173 16, 174 174 &setting, 175 & snd_port);175 &g_snd_port); 176 176 177 177 /* Connect sound to conference port. */ 178 pjmedia_snd_port_connect( snd_port, conf);178 pjmedia_snd_port_connect(g_snd_port, conf); 179 179 } 180 180 }}} 181 - Note that sound device instance is now owned and managed by application, so {{{pjsua_media_config.snd_auto_close_time}}} will not work. Here is a very simple sample code to close the sound device immediately when a call get disconnected: 182 {{{ 183 /* Callback called by the pjsua-lib when call's state has changed. */ 184 static void on_call_state(pjsua_call_id call_id, pjsip_event *) 181 - Note that sound device instance is now owned and managed by application, so {{{pjsua_media_config.snd_auto_close_time}}} will not work. Here is the sample code to utilize {{{on_stream_destroyed()}}} pjsua callback as the trigger of closing the sound device: 182 {{{ 183 /* Close sound device on on_stream_destroyed() pjsua callback. */ 184 static void on_stream_destroyed(pjsua_call_id, 185 pjmedia_session*, 186 unsigned) 185 187 { 186 pjsua_call_info ci; 187 188 pjsua_call_get_info(call_id, &ci); 189 190 if (ci.state == PJSIP_INV_STATE_DISCONNECTED) { 191 if (snd_port) { 192 pjmedia_snd_port_destroy(snd_port); 193 snd_port = NULL; 194 } 188 if (g_snd_port) { 189 pjmedia_snd_port_destroy(g_snd_port); 190 g_snd_port = NULL; 195 191 } 196 192 } 193 197 194 }}} 198 195