From 88ce7397fcbe1e9724728798af5905d00ee2d8a5 Mon Sep 17 00:00:00 2001 From: Julien Isorce Date: Mon, 27 Jan 2020 15:17:27 -0800 Subject: [PATCH] vp8enc/vp8enc: set 1 for the default value of VP8E_SET_STATIC_THRESHOLD In Google webrtc, the setting VP8E_SET_STATIC_THRESHOLD is set to 1 (except when the content is known to be static very often in which case it is set to 100, i.e. when sharing screen with Google Hangouts). The cpu usage drops a lot when using 1 for above setting because it allows the encoder to skip static/low content blocks. The current 0 default value uses too much cpu and confuses the user regarding the cpu usage expectations. User expects vp8enc to use low cpu by default. Documentation of VP8E_SET_STATIC_THRESHOLD: https://github.com/webmproject/libvpx/blob/master/vpx/vp8cx.h#L188 chromium/webrtc: https://chromium.googlesource.com/external/webrtc/+/b484ec0082948ae086c2ba4142b4d2bf8bc4dd4b/modules/video_coding/codecs/vp8/libvpx_vp8_encoder.cc#822 Closes #58 --- ext/vpx/gstvpxenc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ext/vpx/gstvpxenc.c b/ext/vpx/gstvpxenc.c index 12a3b4dd31..88cfe22c6e 100644 --- a/ext/vpx/gstvpxenc.c +++ b/ext/vpx/gstvpxenc.c @@ -88,7 +88,10 @@ GST_DEBUG_CATEGORY_STATIC (gst_vpxenc_debug); #define DEFAULT_DEADLINE VPX_DL_BEST_QUALITY #define DEFAULT_NOISE_SENSITIVITY 0 #define DEFAULT_SHARPNESS 0 -#define DEFAULT_STATIC_THRESHOLD 0 + +/* Use same default value as Chromium/webrtc. */ +#define DEFAULT_STATIC_THRESHOLD 1 + #define DEFAULT_TOKEN_PARTITIONS 0 #define DEFAULT_ARNR_MAXFRAMES 0 #define DEFAULT_ARNR_STRENGTH 3 @@ -582,8 +585,8 @@ gst_vpx_enc_class_init (GstVPXEncClass * klass) g_object_class_install_property (gobject_class, PROP_STATIC_THRESHOLD, g_param_spec_int ("static-threshold", "Static Threshold", - "Motion detection threshold", - 0, G_MAXINT, DEFAULT_STATIC_THRESHOLD, + "Motion detection threshold. Recommendation is to set 100 for " + "screen/window sharing", 0, G_MAXINT, DEFAULT_STATIC_THRESHOLD, (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS))); g_object_class_install_property (gobject_class, PROP_TOKEN_PARTITIONS,