From 34561b414eaf7de09e40ab86d1aa8f93ad9c233b Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Wed, 2 Apr 2014 13:30:13 +0200 Subject: [PATCH] Real early media switch to console. Allow using the real hardware to stream early media. --- console/linphonec.c | 15 ++++++++++++++- coreapi/linphonecore.c | 1 - 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/console/linphonec.c b/console/linphonec.c index 4385dbb09..f08c0f94d 100644 --- a/console/linphonec.c +++ b/console/linphonec.c @@ -148,6 +148,7 @@ static char last_in_history[256]; #endif //auto answer (-a) option static bool_t auto_answer=FALSE; +static bool_t real_early_media_sending=FALSE; static bool_t answer_call=FALSE; static bool_t vcap_enabled=FALSE; static bool_t display_enabled=FALSE; @@ -362,10 +363,17 @@ static void linphonec_call_state_changed(LinphoneCore *lc, LinphoneCall *call, L linphone_call_enable_camera (call,linphonec_camera_enabled); id=(long)linphone_call_get_user_pointer (call); linphonec_set_caller(from); + linphonec_out("Receiving new incoming call from %s, assigned id %i\n", from,id); if ( auto_answer) { answer_call=TRUE; + } else if (real_early_media_sending) { + linphonec_out("Sending early media using real hardware\n"); + LinphoneCallParams* callparams = linphone_core_create_default_call_parameters(lc); + linphone_call_params_enable_early_media_sending(callparams, TRUE); + if (vcap_enabled) linphone_call_params_enable_video(callparams, TRUE); + linphone_core_accept_early_media_with_params(lc, call, callparams); + linphone_call_params_destroy(callparams); } - linphonec_out("Receiving new incoming call from %s, assigned id %i\n", from,id); break; case LinphoneCallOutgoingInit: linphonec_call_identify(call); @@ -906,6 +914,7 @@ print_usage (int exit_status) " -l logfile specify the log file for your SIP phone\n" " -s sipaddress specify the sip call to do at startup\n" " -a enable auto answering for incoming calls\n" +" --real-early-media enable sending early media using real audio/video (beware of privacy issue)\n" " -V enable video features globally (disabled by default)\n" " -C enable video capture only (disabled by default)\n" " -D enable video display only (disabled by default)\n" @@ -1229,6 +1238,10 @@ linphonec_parse_cmdline(int argc, char **argv) { auto_answer = TRUE; } + else if (strncmp ("--real-early-media", argv[arg_num], 2) == 0) + { + real_early_media_sending = TRUE; + } else if (strncmp ("-C", argv[arg_num], 2) == 0) { vcap_enabled = TRUE; diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index fa94234a1..ce09625ce 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -3038,7 +3038,6 @@ int linphone_core_accept_early_media_with_params(LinphoneCore* lc, LinphoneCall* // if parameters are passed, update the media description if ( params ) { - md = sal_call_get_remote_media_description ( call->op ); _linphone_call_params_copy ( &call->params,params ); linphone_call_make_local_media_description ( lc,call ); sal_call_set_local_media_description ( call->op,call->localdesc );