From a2b806c01c86691465f06268656322ca69e951e3 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 29 Feb 2016 16:22:13 -0600 Subject: [PATCH] FS-8876 make function public and use it in conference also --- src/include/switch_core.h | 2 ++ src/mod/applications/mod_conference/conference_video.c | 2 ++ src/switch_core_media.c | 8 +++++--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/include/switch_core.h b/src/include/switch_core.h index e9e5082436..8014e95eae 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -2735,6 +2735,8 @@ SWITCH_DECLARE(const char *)switch_version_revision_human(void); SWITCH_DECLARE(const char *)switch_version_full(void); SWITCH_DECLARE(const char *)switch_version_full_human(void); +SWITCH_DECLARE(void) switch_core_autobind_cpu(void); + SWITCH_END_EXTERN_C #endif /* For Emacs: diff --git a/src/mod/applications/mod_conference/conference_video.c b/src/mod/applications/mod_conference/conference_video.c index 758e809969..3c9981d306 100644 --- a/src/mod/applications/mod_conference/conference_video.c +++ b/src/mod/applications/mod_conference/conference_video.c @@ -1486,6 +1486,8 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_write_thread_run(switch_thread_ return NULL; } + switch_core_autobind_cpu(); + while(conference_utils_member_test_flag(member, MFLAG_RUNNING)) { if (switch_queue_pop(member->mux_out_queue, &pop) == SWITCH_STATUS_SUCCESS) { mcu_layer_t *layer = NULL; diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 14ad59a73e..9a61980f44 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -5147,9 +5147,11 @@ int next_cpu(void) return x; } -static void bind_cpu(void) +SWITCH_DECLARE(void) switch_core_autobind_cpu(void) { - switch_core_thread_set_cpu_affinity(next_cpu()); + if (video_globals.cpu_count > 1) { + switch_core_thread_set_cpu_affinity(next_cpu()); + } } @@ -5174,7 +5176,7 @@ static void *SWITCH_THREAD_FUNC video_helper_thread(switch_thread_t *thread, voi return NULL; } - bind_cpu(); + switch_core_autobind_cpu(); if ((var = switch_channel_get_variable(session->channel, "core_video_blank_image"))) { blank_img = switch_img_read_png(var, SWITCH_IMG_FMT_I420);