optimize AudioUnit startup time

This commit is contained in:
Simon Morlat 2012-04-17 18:05:05 +02:00
parent 02369158f5
commit a1d057be71
3 changed files with 13 additions and 4 deletions

View file

@ -277,6 +277,9 @@ static void call_ringing(SalOp *h){
if (lc->sound_conf.play_sndcard!=NULL){
MSSndCard *ringcard=lc->sound_conf.lsd_card ? lc->sound_conf.lsd_card : lc->sound_conf.play_sndcard;
if (call->localdesc->streams[0].max_rate>0) ms_snd_card_set_preferred_sample_rate(ringcard, call->localdesc->streams[0].max_rate);
/*we release sound before playing ringback tone*/
if (call->audiostream)
audio_stream_unprepare_sound(call->audiostream);
lc->ringstream=ring_start(lc->sound_conf.remote_ring,2000,ringcard);
}
ms_message("Remote ringing...");
@ -285,7 +288,7 @@ static void call_ringing(SalOp *h){
linphone_call_set_state(call,LinphoneCallOutgoingRinging,"Remote ringing");
}else{
/*accept early media */
if (call->audiostream && call->audiostream->ticker!=NULL){
if (call->audiostream && audio_stream_started(call->audiostream)){
/*streams already started */
ms_message("Early media already started.");
return;
@ -299,7 +302,7 @@ static void call_ringing(SalOp *h){
lc->ringstream=NULL;
}
ms_message("Doing early media...");
linphone_core_update_streams (lc,call,md);
linphone_core_update_streams(lc,call,md);
}
}

View file

@ -2071,8 +2071,9 @@ int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call, LinphonePro
ms_free(contact);
}
//TODO : should probably not be done here
linphone_call_init_media_streams(call);
if (lc->ringstream==NULL)
audio_stream_prepare_sound(call->audiostream,lc->sound_conf.play_sndcard,lc->sound_conf.capt_sndcard);
if (!lc->sip_conf.sdp_200_ack){
call->media_pending=TRUE;
sal_call_set_local_media_description(call->op,call->localdesc);
@ -2459,6 +2460,7 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call,
const char *contact=NULL;
SalOp *replaced;
SalMediaDescription *new_md;
bool_t was_ringing=FALSE;
if (call==NULL){
//if just one call is present answer the only one ...
@ -2494,6 +2496,7 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call,
ring_stop(lc->ringstream);
ms_message("ring stopped");
lc->ringstream=NULL;
was_ringing=TRUE;
}
if (call->ringing_beep){
linphone_core_stop_dtmf(lc);
@ -2515,6 +2518,9 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call,
if (call->audiostream==NULL)
linphone_call_init_media_streams(call);
if (!was_ringing && call->audiostream->ticker==NULL){
audio_stream_prepare_sound(call->audiostream,lc->sound_conf.play_sndcard,lc->sound_conf.capt_sndcard);
}
if (params){
call->params=*params;

@ -1 +1 @@
Subproject commit c194c9209bf6c96d419c0513f979ca1114ff3111
Subproject commit bef50ee99700c4b6cb8c504fbec1686f3102edea