From 6db2415a5160a88004c117fe04f762546e060e69 Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Tue, 22 Nov 2016 17:18:36 +0100 Subject: [PATCH 1/3] Fixing rtp_io problem for sound in linphone-daemon. Adding warning message when using unknown options with linphone-daemon --- coreapi/linphonecore.c | 2 ++ daemon/commands/video.cc | 5 ++++- daemon/daemon.cc | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index bea0fff1b..10ebab2d0 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1187,6 +1187,8 @@ static PayloadType* find_payload_type_from_list(const char* type, int rate, int static bool_t linphone_core_codec_supported(LinphoneCore *lc, SalStreamType type, const char *mime){ if (type == SalVideo && lp_config_get_int(lc->config, "video", "rtp_io", FALSE)){ return TRUE; /*in rtp io mode, we don't transcode video, thus we can support a format for which we have no encoder nor decoder.*/ + if (type == SalAudio && lp_config_get_int(lc->config, "sound", "rtp_io", FALSE)){ + return TRUE; /*in rtp io mode, we don't transcode video, thus we can support a format for which we have no encoder nor decoder.*/ } else if (type == SalText) { return TRUE; } diff --git a/daemon/commands/video.cc b/daemon/commands/video.cc index 78d5d50fd..46c2c125f 100644 --- a/daemon/commands/video.cc +++ b/daemon/commands/video.cc @@ -159,8 +159,11 @@ AutoVideo::AutoVideo(): void AutoVideo::exec(Daemon* app, const char* args) { - bool enable = (strcmp(args,"on") == 0); + LinphoneCore *lc = app->getCore(); + LinphoneVideoPolicy vpol = {TRUE, TRUE}; + bool enable = (strcmp(args,"on") == 0); + linphone_core_set_video_policy(lc, &vpol); app->setAutoVideo(enable); app->sendResponse(Response(enable?"Auto video ON": "Auto video OFF", Response::Ok)); diff --git a/daemon/daemon.cc b/daemon/daemon.cc index 4d86cca35..808177481 100644 --- a/daemon/daemon.cc +++ b/daemon/daemon.cc @@ -925,6 +925,9 @@ int main(int argc, char *argv[]) { } else if (strcmp(argv[i], "--enable-lsd") == 0) { lsd_enabled = true; } + else{ + fprintf(stderr, "Unrecognized option : %s", argv[i]); + } } Daemon app(config_path, factory_config_path, log_file, pipe_name, display_video, capture_video); app.enableStatsEvents(stats_enabled); From f6f72cc5ffd8371ec081916e454c3041b5d876a9 Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Tue, 22 Nov 2016 17:38:44 +0100 Subject: [PATCH 2/3] Fix typo. --- coreapi/linphonecore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 10ebab2d0..4e011b332 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1187,7 +1187,7 @@ static PayloadType* find_payload_type_from_list(const char* type, int rate, int static bool_t linphone_core_codec_supported(LinphoneCore *lc, SalStreamType type, const char *mime){ if (type == SalVideo && lp_config_get_int(lc->config, "video", "rtp_io", FALSE)){ return TRUE; /*in rtp io mode, we don't transcode video, thus we can support a format for which we have no encoder nor decoder.*/ - if (type == SalAudio && lp_config_get_int(lc->config, "sound", "rtp_io", FALSE)){ + } else if (type == SalAudio && lp_config_get_int(lc->config, "sound", "rtp_io", FALSE)){ return TRUE; /*in rtp io mode, we don't transcode video, thus we can support a format for which we have no encoder nor decoder.*/ } else if (type == SalText) { return TRUE; From 0435a0219767f14a058f1cbbee72cf01b1936794 Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Mon, 26 Dec 2016 15:33:16 +0100 Subject: [PATCH 3/3] 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); }