Commit 26aa7123 authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Build linphone-daemon on Windows.

parent e5d1749c
master 3.11.1-fixes 3.11.x 3.3.x android-3.2.3 android_3.3.x compat/ios_app_5_3 deleteme desktop_cmake_rework dev/parallel_tests dev_android dev_async_im_encryption_engine dev_lime_v2 dev_new_sha256 dev_proxy_auth dev_refactor_cpp dev_refactor_cpp_3.99.x dev_refactor_cpp_clonable_refactor dev_refactor_cpp_friend dev_refactor_cpp_signals feature/18-flexiapiclient-auth-token feature/4.1_linphone feature/5.0 feature/51-vcard-provisioning-fix feature/AEC3 feature/account_creator_domain feature/account_manager_services_devices_list feature/add_display_name_to_address feature/add_displayname_identity_address feature/add_external_regevent_tests feature/add_server_groupchat_tester feature/add_test_for_create_only_one_chatroom feature/added_event_log_deleted_callback feature/address-refactoring feature/allow-raw-mwi-notification feature/allow_ipv6_dns_servers_to_be_disabled feature/android_camera2 feature/android_service_and_push_in_library feature/android_vibrate_incoming_call_4.5 feature/audio-conference-package feature/authenticated-remote-provisioning feature/auto_download_incoming_messages_files feature/backward_compatibility_with_limev2_early_access feature/basic_auth feature/bctbx-vfs feature/cherry_pick_fixes feature/client_audio_mixer feature/client_video_mixer feature/conference-info-db feature/conference_availability feature/conference_media_description feature/cpp_threadsafe feature/csharp_doc feature/dependent_proxy feature/devices_reload feature/encrypted_conference feature/ephemeral_message feature/ephemeral_message_based_4.3 feature/ephemeral_participant feature/exhume_one_to_one_chat_rooms_squashed feature/external_domain_tests feature/fec feature/fec_adaptation feature/file_transfer_size_asserts feature/get-devices-name-from-conference-notify feature/h265 feature/h265_merge feature/hotfix_3.99.3 feature/ics_update_improved feature/java-wrapper-tests feature/keep-configuration-tester-51 feature/key_exchange_protocol_identification feature/ldap_failover feature/lime_status_by_uri feature/linphone-account-integration feature/load-static-ms2-plugins feature/local-recorder feature/media-streams-improvements-backport feature/media_encryption_settings_on_account feature/medialess feature/modify_tls_testers feature/moving_rootca_update_script_from_jenkins_to_gitlab_ci feature/new_cherry_pick_fixes feature/new_ephemeral_message feature/nix-flake feature/on_demand_full_state_conf_event_pkg feature/provisioning_header_for_fam1.4 feature/python_wrapper feature/python_wrapper_5.1 feature/python_wrapper_5.3 feature/remote_provisioning_headers feature/reply feature/resolver-api feature/rework_ephemeral feature/rfc_9078 feature/screensharing_clean feature/screensharing_packet_router feature/screensharing_signalling feature/sdk_android_audio_focus feature/sdk_push_notif feature/support_sfu feature/swap_db_version_prior_to_master_merge feature/swift_push_tests_5_1 feature/swift_push_unit_tests feature/test-new-ccmp-deployment feature/test_improvement feature/test_make_framewor_on_macos feature/timeline feature/to-delete-compile-last-wrapper feature/to_string feature/unify_audio_video_chat_conf_api feature/unitTestInCpp feature/validation_account_sent_through_push feature/vcard-contacts-list feature/video_codec_call_params feature/videoconf feature/wrap-account-creator-core-functions fix/4.4_LIME_restart_on_core_restart_provisioning fix/ECC-for-desktop fix/TLS_set_by_default fix/addEvent_error fix/add_debug_logs fix/address_call_logs fix/android_embedded_openh264 fix/android_metered_active_network_check fix/android_window fix/audio_codec_debug fix/audio_lost fix/audio_routes fix/audio_toggle_conf fix/auth_info_finding fix/avconf-crashes fix/avoid_download_file_crash fix/backport_50 fix/bad_stream_handling_backup fix/bad_stream_handling_rebased_backup fix/before-holidays fix/bodyless-testers fix/broadcast_flexisip fix/bugfixes-from-5.1 fix/bundle_mode_fix fix/cal_recovery_in_paused_state_with_ice fix/call_and_bluetooth fix/call_history_after_core_stop fix/call_recovery_in_multi_account_case fix/call_repair fix/call_resumed_with_video_4_5 fix/callback_on_core_restart fix/cancel_via_header fix/chat fix/chat_lesage_local_address_no_contact fix/chat_room_deleted_then_re_created fix/chat_room_state_created_message_sending fix/chat_test fix/chatroom_const_params fix/check-tests fix/cmake-builder-restore fix/conf_addr_to_addr fix/conf_memory_leaks fix/conf_unschedule_video fix/conference_called_after_joining_5_3 fix/conference_crash fix/conference_leak fix/conference_method_status fix/conference_with_all_listeners fix/conference_without_advanced_im fix/conference_without_bundle_mode fix/copy_message_id_content_operator fix/crash fix/crash_calllog fix/crash_csrc_changed fix/crash_decline_call fix/crash_multipart_with_empty_plain_text_content fix/crash_terminate fix/crash_test_ios_of_dns fix/crash_tests fix/database fix/db_friend_list_fix fix/debug_test_to_remove fix/default_options fix/delete_sensitive_logs fix/deprecated_methods fix/desktop-4.1-call-callbacks fix/didUpdatePushCredentials_debug_investigation fix/doc_upload fix/double_invite fix/dtls_default_path fix/empty_authinfo fix/encode_filename_transfert fix/encrypted_chat_subscription_failed fix/enum_swift_wrapper fix/error_feedback_flexiapi fix/extra_audio_route_logs_master fix/factory_c++_regressions fix/fec-find-payload-type-number fix/fix_call_transfert_final_notify fix/fixes-from-5.0.10 fix/flexi_api fix/flexiapi_enabling_core_init fix/flexisip-tester-2.3 fix/flexisip_build fix/flow-control-bad-effect-within-tones fix/fold-and-trim-ics fix/force_shared_lib_python_wrapper fix/force_terminate_duplicated_call fix/friend_lists fix/fs_test_crash fix/gcc_14 fix/group_chat fix/group_chat_unit_test fix/h265-glitches fix/ice-test-not-reliable fix/identity-address-performance fix/identity_address_without_gruu fix/imdn_no_proxy fix/import-from-legacy-db fix/improved_chat_room_removal fix/improved_custom_header_test fix/int_to_size_t fix/ios_foreground_push_incoming_received fix/ios_reactions_notif fix/ios_registerforpush_on_core_start_5_4 fix/ios_shared_core_reactions fix/itc-misuse fix/java_jni_wrapper fix/jni_weak_global_ref_crash fix/json_static fix/jvm_cpp_wrapper_on_android fix/lime_chat_room_left_notify fix/lime_struct_brackets fix/limev2_windows_build fix/linphone_web_fixes_master fix/local-permission-detection fix/log_file_updates fix/longer-random-username-tests fix/mac_freeze_camera fix/made_conference_get_state_public fix/magic_search_clone_crash fix/mandatory_encryption fix/master_push fix/media_local_ip_refresh fix/media_server_ip fix/message_not_sent_rework fix/message_tester_crashes fix/mid-warnings fix/missing_assingment_operator fix/no-longer-use-deprecated-findpythoninterp-cmake-module fix/no_ldap_tester fix/no_pulseaudio_for_tests fix/no_sound_because_the_sound_card_has_not_reset fix/no_unregister_if_remote_push_allowed fix/no_unregister_if_remote_push_allowed_5_0 fix/non_last_call_active fix/notify-stats fix/only_use_dns_from_active_network fix/participant_removed fix/participant_video_no_conf_event_pkg fix/pause-player fix/paused_by_remote_no_rtp_timeout_master fix/pdb_5_3 fix/performance_improvements fix/plugin_timeout fix/prack_auth fix/prack_retransmision_2 fix/prevent_notifying_same_presence_notify fix/proxy_cfg_contact fix/pulseaudio_crash fix/push_and_accounts_integration fix/push_config_changes_detection fix/push_notif_background_task fix/python_build_macos fix/python_const_build_warning fix/qt_crash fix/quickfix_52 fix/recorder_desktop fix/relay_ice_candidates_conference_tests fix/remote_address_without_admin_param fix/remote_conference_handler_crash fix/remote_media_changed_notify fix/remove-support-migration-calls-friends-rc fix/rename_linphone_for_wrapper_cs fix/rewrite-tone-manager fix/ring-category fix/rtt_message fix/screen_jul fix/sdp_direction fix/select-ip fix/set_ptr_to_null_after_unref fix/setlocale_utf8 fix/sip_address_table_creation_refused_utf8mb6_mariadb5.5 fix/slow-tests fix/small_bug_fixes fix/sound_lost_when_resuming_call_after_entering_background fix/specfile fix/split_call_suite fix/squash_commits fix/srtp_key_length fix/startup_restart fix/stream-deletion fix/stream_append fix/subject_not_changed fix/switch_data_sync_to_short_service fix/terminate_file_upload_background_task_with_core fix/test fix/test_flexiapi_backport fix/test_video_file_stream fix/tests_and_basic_chatrooms fix/timestamp_windows fix/toggle_video fix/tone-indications fix/tone-manager-crash fix/tone_manager_leak fix/transcient-video-stretching fix/transfer_state fix/tunnel-crash-rtp-transport fix/tunnel_deadlock fix/tunnel_tester fix/unsubscribe_upon_core_stop fix/unwanted_ring_on_stop fix/update-check fix/update_calllog_remote_address fix/utf8_conf fix/utf8_uwp_path fix/utf8_windows_paths fix/uuid4-generation fix/video_conf_fixes fix/video_refused fix/video_windows_store fix/videoconf_double fix/vp8-threads fix/webrtc-ice fix/win_crash_search fix/window_build_dec24 fix/window_id_creation fix/windows_cast fix/workaround_for_sip_simple_messages_with_bad_to_header fix/wrong_timestamp fix/zrtp_call hotfix/gh_issues_templates_syntax_error hotfix/lime-db-path hotfix/use-negotiated-extension-ids hotfix/wrong_selection_of_sender_crypto_key improve/encrypted_chat_multipart_selection release/3.12 release/4.0.1-android release/4.0.1-ios release/4.2 release/4.3 release/4.3-ephemeral release/4.4 release/4.5 release/5.0 release/5.1 release/5.2 release/5.3 release/5.4 release/linphone-desktop/4.2 smartwireless_sip_client test/android_connectivity_issue test/ansible test/b2bua test/call_no_routes test/flexisip-release-candidate-2-4 test/flexisip_b2bua_h264 test/lime_double_digest_auth_challenge tmp/android tmp/pq tmp/workaround_missing_tester_log_message_bug tmp/zrtp_stats_make_visible tmp_tunnel_http_proxy update/test_certificates update_documentation windows10 windows10_release 5.5.0-alpha 5.4.5 5.4.4 5.4.3 5.4.2 5.4.1 5.4.0 5.4.0-beta 5.4.0-alpha 5.3.110 5.3.107 5.3.106 5.3.105 5.3.104 5.3.103 5.3.102 5.3.101 5.3.100 5.3.99 5.3.97 5.3.96 5.3.95 5.3.94 5.3.93 5.3.92 5.3.91 5.3.90 5.3.89 5.3.88 5.3.87 5.3.86 5.3.85 5.3.84 5.3.83 5.3.81 5.3.79 5.3.78 5.3.77 5.3.76 5.3.75 5.3.74 5.3.73 5.3.72 5.3.71 5.3.70 5.3.69 5.3.68 5.3.67 5.3.66 5.3.65 5.3.64 5.3.63 5.3.62 5.3.61 5.3.60 5.3.59 5.3.58 5.3.57 5.3.56 5.3.55 5.3.54 5.3.53 5.3.52 5.3.51 5.3.50 5.3.49 5.3.48 5.3.46 5.3.45 5.3.44 5.3.43 5.3.42 5.3.41 5.3.40 5.3.39 5.3.38 5.3.37 5.3.36 5.3.35 5.3.34 5.3.33 5.3.32 5.3.30 5.3.29 5.3.28 5.3.27 5.3.26 5.3.25 5.3.24 5.3.23 5.3.22 5.3.21 5.3.19 5.3.18 5.3.17 5.3.16 5.3.15 5.3.14 5.3.13 5.3.12 5.3.11 5.3.10 5.3.9 5.3.8 5.3.7 5.3.6 5.3.5 5.3.4 5.3.3 5.3.2 5.3.1 5.3.0 5.3.0-beta 5.3.0-alpha 5.2.114 5.2.113 5.2.112 5.2.111 5.2.110 5.2.109 5.2.108 5.2.107 5.2.106 5.2.105 5.2.104 5.2.103 5.2.102 5.2.101 5.2.100 5.2.99 5.2.98 5.2.97 5.2.96 5.2.95 5.2.94 5.2.93 5.2.92 5.2.91 5.2.90 5.2.89 5.2.88 5.2.87 5.2.86 5.2.85 5.2.84 5.2.83 5.2.82 5.2.81 5.2.80 5.2.79 5.2.78 5.2.77 5.2.75 5.2.73 5.2.72 5.2.71 5.2.70 5.2.69 5.2.68 5.2.67 5.2.66 5.2.65 5.2.64 5.2.63 5.2.62 5.2.61 5.2.59 5.2.58 5.2.57 5.2.56 5.2.54 5.2.53 5.2.52 5.2.51 5.2.50 5.2.49 5.2.47 5.2.46 5.2.45 5.2.44 5.2.42 5.2.41 5.2.40 5.2.39 5.2.37 5.2.33 5.2.32 5.2.30 5.2.29 5.2.28 5.2.27 5.2.26 5.2.25 5.2.23 5.2.22 5.2.21 5.2.20 5.2.19 5.2.18 5.2.17 5.2.16 5.2.15 5.2.14 5.2.13 5.2.12 5.2.11 5.2.10 5.2.9 5.2.7 5.2.6 5.2.5 5.2.4 5.2.3 5.2.2 5.2.1 5.2.0 5.2.0-beta 5.2.0-alpha 5.1.73 5.1.72 5.1.71 5.1.70 5.1.68 5.1.67 5.1.66 5.1.65 5.1.64 5.1.63 5.1.62 5.1.61 5.1.59 5.1.58 5.1.57 5.1.56 5.1.55 5.1.54 5.1.53 5.1.52 5.1.51 5.1.50 5.1.49 5.1.48 5.1.46 5.1.45 5.1.44 5.1.43 5.1.42 5.1.41 5.1.38 5.1.37 5.1.36 5.1.35 5.1.34 5.1.33 5.1.32 5.1.31 5.1.30 5.1.28 5.1.24 5.1.23 5.1.22 5.1.21 5.1.20 5.1.19 5.1.17 5.1.16 5.1.15 5.1.14 5.1.13 5.1.12 5.1.11 5.1.10 5.1.9 5.1.8 5.1.7 5.1.6 5.1.5 5.1.4 5.1.3 5.1.2 5.1.1 5.1.0 5.1.0-beta 5.1.0-alpha 5.0.71 5.0.70 5.0.69 5.0.68 5.0.67 5.0.66 5.0.65 5.0.64 5.0.63 5.0.62 5.0.61 5.0.60 5.0.59 5.0.58 5.0.57 5.0.56 5.0.55 5.0.53 5.0.52 5.0.51 5.0.50 5.0.49 5.0.47 5.0.46 5.0.45 5.0.44 5.0.43 5.0.42 5.0.41 5.0.40 5.0.39 5.0.38 5.0.37 5.0.36 5.0.35 5.0.34 5.0.32 5.0.31 5.0.30 5.0.29 5.0.28 5.0.27 5.0.26 5.0.25 5.0.24 5.0.23 5.0.22 5.0.21 5.0.19 5.0.18 5.0.17 5.0.16 5.0.15 5.0.14 5.0.13 5.0.12 5.0.11 5.0.10 5.0.8 5.0.6 5.0.5 5.0.3 5.0.1 5.0.0 5.0.0-beta 5.0.0-alpha 4.5.26 4.5.25 4.5.24 4.5.23 4.5.22 4.5.21 4.5.20 4.5.19 4.5.18 4.5.17 4.5.16 4.5.15 4.5.14 4.5.13 4.5.11 4.5.10 4.5.7 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 4.5.1 4.5.0 4.5.0-beta 4.5.0-alpha 4.4.35 4.4.34 4.4.33 4.4.32 4.4.31 4.4.29 4.4.28 4.4.27 4.4.26 4.4.25 4.4.24 4.4.22 4.4.21 4.4.19 4.4.18 4.4.17 4.4.16 4.4.15 4.4.14 4.4.13 4.4.12 4.4.11 4.4.10 4.4.9 4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.0 4.4.0-beta 4.4.0-alpha 4.3.3 4.3.2 4.3.1 4.3.0 4.3.0-beta 4.3.0-alpha 4.0.25 3.12.0 3.11.2 3.11.1 3.11.0
No related merge requests found
Showing with 126 additions and 60 deletions
......@@ -40,7 +40,7 @@ option(ENABLE_SHARED "Build shared library." YES)
option(ENABLE_STATIC "Build static library." YES)
option(ENABLE_CONSOLE_UI "Turn on or off compilation of console interface." YES)
option(ENABLE_DATE "Use build date in internal version number." NO)
cmake_dependent_option(ENABLE_DAEMON "Enable the linphone daemon interface." YES "NOT WIN32" NO)
option(ENABLE_DAEMON "Enable the linphone daemon interface." YES)
option(ENABLE_DOC "Enable documentation generation with Doxygen." YES)
option(ENABLE_JAVADOC "Add a target to generate documentation for Java API" NO)
option(ENABLE_GTK_UI "Turn on or off compilation of gtk interface." YES)
......
......@@ -528,7 +528,7 @@ int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call);
LINPHONE_PUBLIC void linphone_core_enable_forced_ice_relay(LinphoneCore *lc, bool_t enable);
LINPHONE_PUBLIC void linphone_core_enable_short_turn_refresh(LinphoneCore *lc, bool_t enable);
void linphone_core_update_ice_state_in_call_stats(LinphoneCall *call);
void linphone_call_stats_fill(LinphoneCallStats *stats, MediaStream *ms, OrtpEvent *ev);
LINPHONE_PUBLIC void linphone_call_stats_fill(LinphoneCallStats *stats, MediaStream *ms, OrtpEvent *ev);
void linphone_call_stop_ice_for_inactive_streams(LinphoneCall *call, SalMediaDescription *result);
void _update_local_media_description_from_ice(SalMediaDescription *desc, IceSession *session, bool_t use_nortpproxy);
void linphone_call_update_local_media_description_from_ice_or_upnp(LinphoneCall *call);
......@@ -587,7 +587,7 @@ void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call);
bool_t linphone_core_incompatible_security(LinphoneCore *lc, SalMediaDescription *md);
extern SalCallbacks linphone_sal_callbacks;
LINPHONE_PUBLIC bool_t linphone_core_rtcp_enabled(const LinphoneCore *lc);
bool_t linphone_core_symmetric_rtp_enabled(LinphoneCore*lc);
LINPHONE_PUBLIC bool_t linphone_core_symmetric_rtp_enabled(LinphoneCore*lc);
void linphone_core_queue_task(LinphoneCore *lc, belle_sip_source_func_t task_fun, void *data, const char *task_description);
......@@ -1165,7 +1165,7 @@ int _linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *call);
void _post_configure_audio_stream(AudioStream *st, LinphoneCore *lc, bool_t muted);
bool_t linphone_core_sound_resources_available(LinphoneCore *lc);
void linphone_core_notify_refer_state(LinphoneCore *lc, LinphoneCall *referer, LinphoneCall *newcall);
unsigned int linphone_core_get_audio_features(LinphoneCore *lc);
LINPHONE_PUBLIC unsigned int linphone_core_get_audio_features(LinphoneCore *lc);
void _linphone_core_codec_config_write(LinphoneCore *lc);
......
......@@ -40,17 +40,17 @@ AdaptiveBufferCompensationResponse::AdaptiveBufferCompensationResponse(LinphoneC
ostringstream ost;
switch (type) {
case AudioStream:
enabled = linphone_core_audio_adaptive_jittcomp_enabled(core);
enabled = linphone_core_audio_adaptive_jittcomp_enabled(core) ? true : false;
outputAdaptiveBufferCompensation(core, ost, "Audio", enabled);
break;
case VideoStream:
enabled = linphone_core_video_adaptive_jittcomp_enabled(core);
enabled = linphone_core_video_adaptive_jittcomp_enabled(core) ? true : false;
outputAdaptiveBufferCompensation(core, ost, "Video", enabled);
break;
case AllStreams:
enabled = linphone_core_audio_adaptive_jittcomp_enabled(core);
enabled = linphone_core_audio_adaptive_jittcomp_enabled(core) ? true : false;
outputAdaptiveBufferCompensation(core, ost, "Audio", enabled);
enabled = linphone_core_video_adaptive_jittcomp_enabled(core);
enabled = linphone_core_video_adaptive_jittcomp_enabled(core) ? true : false;
outputAdaptiveBufferCompensation(core, ost, "Video", enabled);
break;
}
......
......@@ -87,25 +87,25 @@ void NetsimCommand::exec(Daemon* app, const char* args){
char value[128]={0};
ist >> parameters;
if (fmtp_get_value(parameters.c_str(),"max_bandwidth",value, sizeof(value))){
params.max_bandwidth=atoi(value);
params.max_bandwidth=(float)atoi(value);
}
if (fmtp_get_value(parameters.c_str(),"max_buffer_size",value, sizeof(value))){
params.max_buffer_size=atoi(value);
}
if (fmtp_get_value(parameters.c_str(),"loss_rate",value, sizeof(value))){
params.loss_rate=atoi(value);
params.loss_rate=(float)atoi(value);
}
if (fmtp_get_value(parameters.c_str(),"latency",value, sizeof(value))){
params.latency=atoi(value);
}
if (fmtp_get_value(parameters.c_str(),"consecutive_loss_probability",value, sizeof(value))){
params.consecutive_loss_probability=atof(value);
params.consecutive_loss_probability=(float)atof(value);
}
if (fmtp_get_value(parameters.c_str(),"jitter_burst_density",value, sizeof(value))){
params.jitter_burst_density=atof(value);
params.jitter_burst_density=(float)atof(value);
}
if (fmtp_get_value(parameters.c_str(),"jitter_strength",value, sizeof(value))){
params.jitter_strength=atof(value);
params.jitter_strength=(float)atof(value);
}
if (fmtp_get_value(parameters.c_str(),"mode",value, sizeof(value))){
OrtpNetworkSimulatorMode mode=ortp_network_simulator_mode_from_string(value);
......
......@@ -19,8 +19,11 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#define _GNU_SOURCE
#include <fcntl.h>
#include <stdio.h>
#ifndef _WIN32
#include <poll.h>
#endif
......@@ -29,9 +32,8 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
static int running=1;
int main(int argc, char *argv[]){
struct pollfd pfds[2]={{0}};
char buf[4096];
int fd;
char buf[32768];
ortp_pipe_t fd;
/* handle args */
if (argc < 2) {
......@@ -39,21 +41,51 @@ int main(int argc, char *argv[]){
return 1;
}
fd=ortp_client_pipe_connect(argv[1]);
ortp_init();
ortp_set_log_level_mask(NULL,ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL);
if (fd==-1){
ortp_set_log_level_mask(NULL, ORTP_MESSAGE | ORTP_WARNING | ORTP_ERROR | ORTP_FATAL);
fd=ortp_client_pipe_connect(argv[1]);
if (fd==(ortp_pipe_t)-1){
ortp_error("Could not connect to control pipe: %s",strerror(errno));
return -1;
}
#ifdef _WIN32
DWORD fdwMode, fdwOldMode;
HANDLE hin = GetStdHandle(STD_INPUT_HANDLE);
HANDLE hout = GetStdHandle(STD_OUTPUT_HANDLE);
GetConsoleMode(hin, &fdwOldMode);
fdwMode = fdwOldMode ^ ENABLE_MOUSE_INPUT ^ ENABLE_WINDOW_INPUT;
SetConsoleMode(hin, fdwMode);
FlushConsoleInputBuffer(hin);
while (running) {
DWORD read = 0;
DWORD written = 0;
ReadFile(hin, buf, sizeof(buf), &read, NULL);
if (read > 2) {
buf[read - 2] = '\0'; // Remove ending '\r\n'
if (ortp_pipe_write(fd, (uint8_t *)buf, strlen(buf)) < 0) {
running = 0;
} else {
read = ortp_pipe_read(fd, (uint8_t *)buf, sizeof(buf));
if (read > 0) {
WriteFile(hout, buf, read, &written, NULL);
} else {
running = 0;
}
}
}
}
SetConsoleMode(hin, fdwOldMode);
#else
struct pollfd pfds[2] = { { 0 } };
int bytes;
pfds[0].fd=fd;
pfds[0].events=POLLIN;
pfds[1].fd=1;
pfds[1].events=POLLIN;
while (running){
int err;
int bytes;
err=poll(pfds,2,-1);
if (err>0){
/*splice to stdout*/
......@@ -81,6 +113,8 @@ int main(int argc, char *argv[]){
}
}
}
#endif
return 0;
}
......@@ -18,18 +18,23 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <cstdio>
#ifndef _WIN32
#include <sys/ioctl.h>
#endif
#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <functional>
#ifdef HAVE_READLINE
#include <readline/readline.h>
#include <readline/history.h>
#endif
#ifndef _WIN32
#include <poll.h>
#endif
#include "daemon.h"
#include "commands/adaptive-jitter-compensation.h"
......@@ -315,8 +320,8 @@ bool DaemonCommand::matches(const char *name) const {
Daemon::Daemon(const char *config_path, const char *factory_config_path, const char *log_file, const char *pipe_name, bool display_video, bool capture_video) :
mLSD(0), mLogFile(NULL), mAutoVideo(0), mCallIds(0), mProxyIds(0), mAudioStreamIds(0) {
ms_mutex_init(&mMutex, NULL);
mServerFd = -1;
mChildFd = -1;
mServerFd = (ortp_pipe_t)-1;
mChildFd = (ortp_pipe_t)-1;
if (pipe_name == NULL) {
#ifdef HAVE_READLINE
const char *homedir = getenv("HOME");
......@@ -329,8 +334,12 @@ Daemon::Daemon(const char *config_path, const char *factory_config_path, const c
#endif
} else {
mServerFd = ortp_server_pipe_create(pipe_name);
#ifndef _WIN32
listen(mServerFd, 2);
fprintf(stdout, "Server unix socket created, name=%s fd=%i\n", pipe_name, mServerFd);
fprintf(stdout, "Server unix socket created, name=%s fd=%i\n", pipe_name, (int)mServerFd);
#else
fprintf(stdout, "Named pipe created, name=%s fd=%i\n", pipe_name, (int)mServerFd);
#endif
}
if (log_file != NULL) {
......@@ -566,7 +575,7 @@ void Daemon::iterateStreamStats() {
void Daemon::iterate() {
linphone_core_iterate(mLc);
iterateStreamStats();
if (mChildFd == -1) {
if (mChildFd == (ortp_pipe_t)-1) {
if (!mEventQueue.empty()) {
Response *r = mEventQueue.front();
mEventQueue.pop();
......@@ -595,8 +604,8 @@ void Daemon::sendResponse(const Response &resp) {
char buf[4096] = { 0 };
int size;
size = resp.toBuf(buf, sizeof(buf));
if (mChildFd != -1) {
if (write(mChildFd, buf, size) == -1) {
if (mChildFd != (ortp_pipe_t)-1) {
if (ortp_pipe_write(mChildFd, (uint8_t *)buf, size) == -1) {
ms_error("Fail to write to pipe: %s", strerror(errno));
}
} else {
......@@ -606,43 +615,64 @@ void Daemon::sendResponse(const Response &resp) {
}
char *Daemon::readPipe(char *buffer, int buflen) {
#ifdef _WIN32
if (mChildFd == (ortp_pipe_t)-1) {
mChildFd = ortp_server_pipe_accept_client(mServerFd);
ms_message("Client accepted");
}
if (mChildFd != (ortp_pipe_t)-1) {
int ret = ortp_pipe_read(mChildFd, (uint8_t *)buffer, buflen);
if (ret == -1) {
ms_error("Fail to read from pipe: %s", strerror(errno));
mChildFd = (ortp_pipe_t)-1;
} else {
if (ret == 0) {
ms_message("Client disconnected");
mChildFd = (ortp_pipe_t)-1;
return NULL;
}
buffer[ret] = 0;
return buffer;
}
}
#else
struct pollfd pfd[2];
int nfds = 1;
memset(&pfd[0], 0, sizeof(pfd));
if (mServerFd != -1) {
if (mServerFd != (ortp_pipe_t)-1) {
pfd[0].events = POLLIN;
pfd[0].fd = mServerFd;
}
if (mChildFd != -1) {
if (mChildFd != (ortp_pipe_t)-1) {
pfd[1].events = POLLIN;
pfd[1].fd = mChildFd;
nfds++;
}
int err = poll(pfd, nfds, 50);
if (err > 0) {
if (mServerFd != -1 && (pfd[0].revents & POLLIN)) {
if (mServerFd != (ortp_pipe_t)-1 && (pfd[0].revents & POLLIN)) {
struct sockaddr_storage addr;
socklen_t addrlen = sizeof(addr);
int childfd = accept(mServerFd, (struct sockaddr*) &addr, &addrlen);
if (childfd != -1) {
if (mChildFd != -1) {
if (mChildFd != (ortp_pipe_t)-1) {
ms_error("Cannot accept two client at the same time");
close(childfd);
} else {
mChildFd = childfd;
mChildFd = (ortp_pipe_t)childfd;
return NULL;
}
}
}
if (mChildFd != -1 && (pfd[1].revents & POLLIN)) {
if (mChildFd != (ortp_pipe_t)-1 && (pfd[1].revents & POLLIN)) {
int ret;
if ((ret = read(mChildFd, buffer, buflen)) == -1) {
if ((ret = ortp_pipe_read(mChildFd, (uint8_t *)buffer, buflen)) == -1) {
ms_error("Fail to read from pipe: %s", strerror(errno));
} else {
if (ret == 0) {
ms_message("Client disconnected");
close(mChildFd);
mChildFd = -1;
ortp_server_pipe_close_client(mChildFd);
mChildFd = (ortp_pipe_t)-1;
return NULL;
}
buffer[ret] = 0;
......@@ -650,6 +680,7 @@ char *Daemon::readPipe(char *buffer, int buflen) {
}
}
}
#endif
return NULL;
}
......@@ -780,7 +811,7 @@ int Daemon::run() {
startThread();
while (mRunning) {
bool eof=false;
if (mServerFd == -1) {
if (mServerFd == (ortp_pipe_t)-1) {
ret = readLine(line,&eof);
if (ret && ret[0] != '\0') {
#ifdef HAVE_READLINE
......@@ -793,7 +824,7 @@ int Daemon::run() {
if (ret && ret[0] != '\0') {
execCommand(ret);
}
if (mServerFd == -1 && ret != NULL) {
if (mServerFd == (ortp_pipe_t)-1 && ret != NULL) {
free(ret);
}
if (eof && mRunning) {
......@@ -836,10 +867,10 @@ Daemon::~Daemon() {
enableLSD(false);
linphone_core_destroy(mLc);
if (mChildFd != -1) {
close(mChildFd);
if (mChildFd != (ortp_pipe_t)-1) {
ortp_server_pipe_close_client(mChildFd);
}
if (mServerFd != -1) {
if (mServerFd != (ortp_pipe_t)-1) {
ortp_server_pipe_close(mServerFd);
}
if (mLogFile != NULL) {
......@@ -884,6 +915,7 @@ int main(int argc, char *argv[]) {
return -1;
}
pipe_name = argv[++i];
stats_enabled = false;
} else if (strcmp(argv[i], "--factory-config") == 0) {
if (i + 1 >= argc) {
fprintf(stderr, "no file specify after --factory-config\n");
......
......@@ -264,8 +264,8 @@ private:
LinphoneSoundDaemon *mLSD;
std::list<DaemonCommand*> mCommands;
std::queue<Response*> mEventQueue;
int mServerFd;
int mChildFd;
ortp_pipe_t mServerFd;
ortp_pipe_t mChildFd;
std::string mHistfile;
bool mRunning;
bool mUseStatsEvents;
......
......@@ -30,23 +30,23 @@ typedef struct _LinphoneSoundDaemon LinphoneSoundDaemon;
typedef void (*LsdEndOfPlayCallback)(LsdPlayer *p);
void lsd_player_set_callback(LsdPlayer *p, LsdEndOfPlayCallback cb);
void lsd_player_set_user_pointer(LsdPlayer *p, void *up);
void *lsd_player_get_user_pointer(const LsdPlayer *p);
int lsd_player_play(LsdPlayer *p, const char *filename);
int lsd_player_stop(LsdPlayer *p);
void lsd_player_enable_loop(LsdPlayer *p, bool_t loopmode);
bool_t lsd_player_loop_enabled(const LsdPlayer *p);
void lsd_player_set_gain(LsdPlayer *p, float gain);
LinphoneSoundDaemon *lsd_player_get_daemon(const LsdPlayer *p);
LinphoneSoundDaemon * linphone_sound_daemon_new(MSFactory* factory, const char *cardname, int rate, int nchannels);
LsdPlayer * linphone_sound_daemon_get_player(LinphoneSoundDaemon *lsd);
void linphone_sound_daemon_release_player(LinphoneSoundDaemon *lsd, LsdPlayer *lsdplayer);
void linphone_sound_daemon_stop_all_players(LinphoneSoundDaemon *obj);
void linphone_sound_daemon_release_all_players(LinphoneSoundDaemon *obj);
void linphone_core_use_sound_daemon(LinphoneCore *lc, LinphoneSoundDaemon *lsd);
void linphone_sound_daemon_destroy(LinphoneSoundDaemon *obj);
LINPHONE_PUBLIC void lsd_player_set_callback(LsdPlayer *p, LsdEndOfPlayCallback cb);
LINPHONE_PUBLIC void lsd_player_set_user_pointer(LsdPlayer *p, void *up);
LINPHONE_PUBLIC void *lsd_player_get_user_pointer(const LsdPlayer *p);
LINPHONE_PUBLIC int lsd_player_play(LsdPlayer *p, const char *filename);
LINPHONE_PUBLIC int lsd_player_stop(LsdPlayer *p);
LINPHONE_PUBLIC void lsd_player_enable_loop(LsdPlayer *p, bool_t loopmode);
LINPHONE_PUBLIC bool_t lsd_player_loop_enabled(const LsdPlayer *p);
LINPHONE_PUBLIC void lsd_player_set_gain(LsdPlayer *p, float gain);
LINPHONE_PUBLIC LinphoneSoundDaemon *lsd_player_get_daemon(const LsdPlayer *p);
LINPHONE_PUBLIC LinphoneSoundDaemon * linphone_sound_daemon_new(MSFactory* factory, const char *cardname, int rate, int nchannels);
LINPHONE_PUBLIC LsdPlayer * linphone_sound_daemon_get_player(LinphoneSoundDaemon *lsd);
LINPHONE_PUBLIC void linphone_sound_daemon_release_player(LinphoneSoundDaemon *lsd, LsdPlayer *lsdplayer);
LINPHONE_PUBLIC void linphone_sound_daemon_stop_all_players(LinphoneSoundDaemon *obj);
LINPHONE_PUBLIC void linphone_sound_daemon_release_all_players(LinphoneSoundDaemon *obj);
LINPHONE_PUBLIC void linphone_core_use_sound_daemon(LinphoneCore *lc, LinphoneSoundDaemon *lsd);
LINPHONE_PUBLIC void linphone_sound_daemon_destroy(LinphoneSoundDaemon *obj);
/**
* Enum describing the result of the echo canceller calibration process.
......
Supports Markdown
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