added auto-disable if autodetection takes too long
This commit is contained in:
parent
b5a5609898
commit
081f8e968f
@ -11,6 +11,7 @@ var ExtensionConf = {
|
|||||||
// 'blacklist' - work by default, problem sites need to be blocked
|
// 'blacklist' - work by default, problem sites need to be blocked
|
||||||
// 'whitelist' - only work if site has been specifically approved
|
// 'whitelist' - only work if site has been specifically approved
|
||||||
// 'disabled' - don't work at all
|
// 'disabled' - don't work at all
|
||||||
|
disabledReason: "", // if automatic aspect ratio has been disabled, show reason
|
||||||
allowedMisaligned: 0.05, // top and bottom letterbox thickness can differ by this much.
|
allowedMisaligned: 0.05, // top and bottom letterbox thickness can differ by this much.
|
||||||
// Any more and we don't adjust ar.
|
// Any more and we don't adjust ar.
|
||||||
allowedArVariance: 0.075, // amount by which old ar can differ from the new (1 = 100%)
|
allowedArVariance: 0.075, // amount by which old ar can differ from the new (1 = 100%)
|
||||||
@ -18,6 +19,11 @@ var ExtensionConf = {
|
|||||||
timer_paused: 3000,
|
timer_paused: 3000,
|
||||||
timer_error: 3000,
|
timer_error: 3000,
|
||||||
timer_minimumTimeout: 5, // but regardless of above, we wait this many msec before retriggering
|
timer_minimumTimeout: 5, // but regardless of above, we wait this many msec before retriggering
|
||||||
|
autoDisable: { // settings for automatically disabling the extension
|
||||||
|
maxExecutionTime: 15, // if execution time of main autodetect loop exceeds this many milliseconds,
|
||||||
|
// we disable it.
|
||||||
|
consecutiveTimeoutCount: 5 // we only do it if it happens this many consecutive times
|
||||||
|
},
|
||||||
hSamples: 640,
|
hSamples: 640,
|
||||||
vSamples: 360,
|
vSamples: 360,
|
||||||
samplingInterval: 10, // we sample at columns at (width/this) * [ 1 .. this - 1]
|
samplingInterval: 10, // we sample at columns at (width/this) * [ 1 .. this - 1]
|
||||||
|
@ -1381,8 +1381,20 @@ var _ard_isRunning = function(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function _ard_getTimeout(baseTimeout, startTime){
|
function _ard_getTimeout(baseTimeout, startTime){
|
||||||
// baseTimeout -= (performance.now() - startTime);
|
var execTime = (performance.now() - startTime);
|
||||||
|
|
||||||
|
if( execTime > ExtensionConf.arDetect.autoDisable.maxExecutionTime ){
|
||||||
|
GlobalVars.arDetect.autoDisable.eventCount++;
|
||||||
|
|
||||||
|
if(GlobalVars.arDetect.autoDisable.eventCount >= ExtensionConf.arDetect.autoDisable.consecutiveTimeoutCount ){
|
||||||
|
Comms.sendToBackgroundScript({cmd: 'disable-autoar', reason: 'Automatic aspect ratio detection was taking too much time and has been automatically disabled in order to avoid lag.'});
|
||||||
|
_ard_stop();
|
||||||
|
return 999999;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
GlobalVars.arDetect.autoDisable.eventCount = 0;
|
||||||
|
}
|
||||||
// return baseTimeout > ExtensionConf.arDetect.minimumTimeout ? baseTimeout : ExtensionConf.arDetect.minimumTimeout;
|
// return baseTimeout > ExtensionConf.arDetect.minimumTimeout ? baseTimeout : ExtensionConf.arDetect.minimumTimeout;
|
||||||
|
|
||||||
return baseTimeout;
|
return baseTimeout;
|
||||||
|
@ -22,6 +22,9 @@ var GlobalVars = {
|
|||||||
left: null
|
left: null
|
||||||
},
|
},
|
||||||
arDetect: {
|
arDetect: {
|
||||||
|
autoDisable: {
|
||||||
|
eventCount: 0
|
||||||
|
},
|
||||||
canvas: null,
|
canvas: null,
|
||||||
blackLevel: 10,
|
blackLevel: 10,
|
||||||
sampleCols_current: 0,
|
sampleCols_current: 0,
|
||||||
|
@ -212,6 +212,11 @@ function _uwbg_rcvmsg(message, sender, sendResponse){
|
|||||||
}
|
}
|
||||||
else if(message.cmd == "disable-autoar"){
|
else if(message.cmd == "disable-autoar"){
|
||||||
ExtensionConf.arDetect.mode = "disabled";
|
ExtensionConf.arDetect.mode = "disabled";
|
||||||
|
if(message.reason){
|
||||||
|
ExtensionConf.arDetect.disabledReason = message.reason;
|
||||||
|
} else {
|
||||||
|
ExtensionConf.arDetect.disabledReason = '';
|
||||||
|
}
|
||||||
Settings.save(ExtensionConf);
|
Settings.save(ExtensionConf);
|
||||||
// Comms.sendToAll({cmd: "reload-settings", sender: "uwbg"});
|
// Comms.sendToAll({cmd: "reload-settings", sender: "uwbg"});
|
||||||
if(Debug.debug){
|
if(Debug.debug){
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"name": "Ultrawidify",
|
"name": "Ultrawidify",
|
||||||
"version": "2.2.4",
|
"version": "2.2.5",
|
||||||
|
|
||||||
"icons": {
|
"icons": {
|
||||||
"32":"res/icons/uw-32.png",
|
"32":"res/icons/uw-32.png",
|
||||||
|
Loading…
Reference in New Issue
Block a user