Commit dc2d250d authored by Guillaume BIENKOWSKI's avatar Guillaume BIENKOWSKI
Browse files

Perform sound card usage check when a call is dismissed or when a call transitions to pausing state

parent dc78b3fe
......@@ -1018,6 +1018,7 @@ void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const
if (cstate==LinphoneCallReleased){
linphone_call_set_released(call);
}
linphone_core_soundcard_hint_check(lc);
}
}
......
......@@ -6415,11 +6415,32 @@ bool_t linphone_core_can_we_add_call(LinphoneCore *lc)
static void notify_soundcard_usage(LinphoneCore *lc, bool_t used){
MSSndCard *card=lc->sound_conf.capt_sndcard;
if (card && ms_snd_card_get_capabilities(card) & MS_SND_CARD_CAP_IS_SLOW){
ms_message("Notifying soundcard that we don't need it anymore for calls.");
ms_snd_card_set_usage_hint(card,used);
}
}
void linphone_core_soundcard_hint_check( LinphoneCore* lc){
MSList* the_calls = lc->calls;
LinphoneCall* call = NULL;
bool_t remaining_paused = FALSE;
/* check if the remaining calls are paused */
while( the_calls ){
call = the_calls->data;
if( call->state == LinphoneCallPausing || call->state == LinphoneCallPaused ){
remaining_paused = TRUE;
break;
}
the_calls = the_calls->next;
}
/* if no more calls or all calls are paused, we can free the soundcard */
if ( (lc->calls==NULL || remaining_paused) && !lc->use_files){
ms_message("Notifying soundcard that we don't need it anymore for calls.");
notify_soundcard_usage(lc,FALSE);
}
}
int linphone_core_add_call( LinphoneCore *lc, LinphoneCall *call)
{
if (linphone_core_can_we_add_call(lc)){
......@@ -6446,7 +6467,9 @@ int linphone_core_del_call( LinphoneCore *lc, LinphoneCall *call)
return -1;
}
lc->calls = the_calls;
if (lc->calls==NULL) notify_soundcard_usage(lc,FALSE);
linphone_core_soundcard_hint_check(lc);
return 0;
}
......
......@@ -374,6 +374,8 @@ void linphone_notify_parse_presence(SalOp *op, const char *content_type, const c
void linphone_notify_convert_presence_to_xml(SalOp *op, SalPresenceModel *presence, const char *contact, char **content);
void linphone_notify_recv(LinphoneCore *lc, SalOp *op, SalSubscribeStatus ss, SalPresenceModel *model);
void linphone_proxy_config_process_authentication_failure(LinphoneCore *lc, SalOp *op);
void linphone_core_soundcard_hint_check(LinphoneCore* lc);
void linphone_subscription_answered(LinphoneCore *lc, SalOp *op);
void linphone_subscription_closed(LinphoneCore *lc, SalOp *op);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment