From 0435a0219767f14a058f1cbbee72cf01b1936794 Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Mon, 26 Dec 2016 15:33:16 +0100 Subject: [PATCH] Adding option in linphonerc rtp_io_enable_local_output to enable using local speaker in rtp_io mode. Option checked in [sound] section only. --- coreapi/linphonecall.c | 24 ++++++++++++++++++++---- coreapi/linphonecore.c | 3 ++- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 1893f705e..f4d8b28fb 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -3133,6 +3133,7 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, LinphoneCallSta int crypto_idx; MSMediaStreamIO io = MS_MEDIA_STREAM_IO_INITIALIZER; bool_t use_rtp_io = lp_config_get_int(lc->config, "sound", "rtp_io", FALSE); + bool_t use_rtp_io_enable_local_output = lp_config_get_int(lc->config, "sound", "rtp_io_enable_local_output", FALSE); stream = sal_media_description_find_best_stream(call->resultdesc, SalAudio); if (stream && stream->dir!=SalStreamInactive && stream->rtp_port!=0){ @@ -3181,7 +3182,7 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, LinphoneCallSta } } /*if playfile are supplied don't use soundcards*/ - if (lc->use_files || use_rtp_io) { + if (lc->use_files || (use_rtp_io && !use_rtp_io_enable_local_output)) { captcard=NULL; playcard=NULL; } @@ -3225,12 +3226,27 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, LinphoneCallSta rtp_session_set_multicast_ttl(call->audiostream->ms.sessions.rtp_session,stream->ttl); if (use_rtp_io) { - io.input.type = io.output.type = MSResourceRtp; - io.input.session = io.output.session = create_audio_rtp_io_session(call); + if(use_rtp_io_enable_local_output){ + io.input.type = MSResourceRtp; + io.input.session = create_audio_rtp_io_session(call); + + if (playcard){ + io.output.type = MSResourceSoundcard; + io.output.soundcard = playcard; + }else{ + io.output.type = MSResourceFile; + io.output.file = recfile; + } + } + else { + io.input.type = io.output.type = MSResourceRtp; + io.input.session = io.output.session = create_audio_rtp_io_session(call); + } + if (io.input.session == NULL) { ok = FALSE; } - }else { + }else { if (playcard){ io.output.type = MSResourceSoundcard; io.output.soundcard = playcard; diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 4e011b332..db61f641f 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -6937,6 +6937,7 @@ void linphone_core_soundcard_hint_check( LinphoneCore* lc){ LinphoneCall* call = NULL; bool_t dont_need_sound = TRUE; bool_t use_rtp_io = lp_config_get_int(lc->config, "sound", "rtp_io", FALSE); + bool_t use_rtp_io_enable_local_output = lp_config_get_int(lc->config, "sound", "rtp_io_enable_local_output", FALSE); /* check if the remaining calls are paused */ while( the_calls ){ @@ -6949,7 +6950,7 @@ void linphone_core_soundcard_hint_check( LinphoneCore* lc){ } /* if no more calls or all calls are paused, we can free the soundcard */ - if ( (lc->calls==NULL || dont_need_sound) && !lc->use_files && !use_rtp_io){ + if ( (lc->calls==NULL || dont_need_sound) && !lc->use_files && (!use_rtp_io || (use_rtp_io && use_rtp_io_enable_local_output))){ ms_message("Notifying soundcard that we don't need it anymore for calls."); notify_soundcard_usage(lc,FALSE); }