From 8ad3d5cb24f23474dbf62c7702185675b36c466d Mon Sep 17 00:00:00 2001
From: Anthony Minessale <anthm@freeswitch.org>
Date: Tue, 26 Apr 2016 23:05:08 -0500
Subject: [PATCH] FS-9106 #resolve [vpx performance tweaks]

---
 src/mod/applications/mod_conference/conference_video.c | 2 +-
 src/switch_vpx.c                                       | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/mod/applications/mod_conference/conference_video.c b/src/mod/applications/mod_conference/conference_video.c
index 998486400e..01f87a8ac7 100644
--- a/src/mod/applications/mod_conference/conference_video.c
+++ b/src/mod/applications/mod_conference/conference_video.c
@@ -1514,7 +1514,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_write_thread_run(switch_thread_
 		return NULL;
 	}
 
-	switch_core_autobind_cpu();
+	//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) {
diff --git a/src/switch_vpx.c b/src/switch_vpx.c
index f195eab300..6ad449f14e 100644
--- a/src/switch_vpx.c
+++ b/src/switch_vpx.c
@@ -403,8 +403,8 @@ static switch_status_t init_encoder(switch_codec_t *codec)
 	config->g_h = context->codec_settings.video.height;	
 	config->rc_target_bitrate = context->bandwidth;
 	config->g_lag_in_frames = 0;
-	config->kf_max_dist = 2000;
-	config->g_threads = 1;//(cpus > 1) ? 2 : 1;
+	config->kf_max_dist = 360;//2000;
+	config->g_threads = cpus - 1;//(cpus > 1) ? 2 : 1;
 	
 	if (context->is_vp9) {
 		//config->rc_dropframe_thresh = 2;
@@ -435,7 +435,7 @@ static switch_status_t init_encoder(switch_codec_t *codec)
 		config->rc_end_usage = VPX_CBR;
 		//config->g_pass = VPX_RC_ONE_PASS;
 		config->kf_mode = VPX_KF_AUTO;
-		config->kf_max_dist = 1000;
+		config->kf_max_dist = 360;//1000;
 
 		//config->kf_mode = VPX_KF_DISABLED;
 		config->rc_resize_allowed = 1;
@@ -545,7 +545,7 @@ static switch_status_t init_encoder(switch_codec_t *codec)
 				vpx_codec_control(&context->encoder, VP8E_SET_CPUUSED, -8);
 			}
 
-			vpx_codec_control(&context->encoder, VP8E_SET_STATIC_THRESHOLD, 100);
+			vpx_codec_control(&context->encoder, VP8E_SET_STATIC_THRESHOLD, 1000);
 			vpx_codec_control(&context->encoder, VP8E_SET_TOKEN_PARTITIONS, token_parts);
 			vpx_codec_control(&context->encoder, VP9E_SET_TUNE_CONTENT, VP9E_CONTENT_SCREEN);