misc fixes
This commit is contained in:
parent
86a8c23999
commit
b8cd441109
@ -291,7 +291,7 @@ class ArDetector {
|
|||||||
this.noLetterboxCanvasReset = false;
|
this.noLetterboxCanvasReset = false;
|
||||||
|
|
||||||
if (this.settings.canStartAutoAr() ) {
|
if (this.settings.canStartAutoAr() ) {
|
||||||
this.main();
|
// this.main();
|
||||||
this.start();
|
this.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -303,7 +303,7 @@ class ArDetector {
|
|||||||
this.conf.arSetupComplete = true;
|
this.conf.arSetupComplete = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
destroy(){
|
destroy(){¸
|
||||||
this.logger.log('info', 'init', `%c[ArDetect::destroy] <@${this.arid}> Destroying aard.`, _ard_console_stop);
|
this.logger.log('info', 'init', `%c[ArDetect::destroy] <@${this.arid}> Destroying aard.`, _ard_console_stop);
|
||||||
// this.debugCanvas.destroy();
|
// this.debugCanvas.destroy();
|
||||||
this.halt();
|
this.halt();
|
||||||
@ -329,16 +329,21 @@ class ArDetector {
|
|||||||
this._paused = false;
|
this._paused = false;
|
||||||
|
|
||||||
// start autodetection
|
// start autodetection
|
||||||
if (this.animationFrameHandle) {
|
this.startLoop();
|
||||||
window.cancelAnimationFrame(this.animationFrameHandle);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.animationFrameHandle = window.requestAnimationFrame( (ts) => this.animationFrameBootstrap(ts));
|
|
||||||
|
|
||||||
// automatic detection starts halted. If halted=false when main first starts, extension won't run
|
// automatic detection starts halted. If halted=false when main first starts, extension won't run
|
||||||
// this._paused is undefined the first time we run this function, which is effectively the same thing
|
// this._paused is undefined the first time we run this function, which is effectively the same thing
|
||||||
// as false. Still, we'll explicitly fix this here.
|
// as false. Still, we'll explicitly fix this here.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
startLoop() {
|
||||||
|
if (this.animationFrameHandle) {
|
||||||
|
window.cancelAnimationFrame(this.animationFrameHandle);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.animationFrameHandle = window.requestAnimationFrame( (ts) => this.animationFrameBootstrap(ts));
|
||||||
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
if (this.animationFrameHandle) {
|
if (this.animationFrameHandle) {
|
||||||
window.cancelAnimationFrame(this.animationFrameHandle);
|
window.cancelAnimationFrame(this.animationFrameHandle);
|
||||||
@ -347,7 +352,7 @@ class ArDetector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unpause() {
|
unpause() {
|
||||||
this.start();
|
this.startLoop();
|
||||||
}
|
}
|
||||||
|
|
||||||
pause() {
|
pause() {
|
||||||
@ -438,7 +443,7 @@ class ArDetector {
|
|||||||
this.setupTimer = setTimeout(function(){
|
this.setupTimer = setTimeout(function(){
|
||||||
ths.setupTimer = null;
|
ths.setupTimer = null;
|
||||||
try{
|
try{
|
||||||
ths.main();
|
ths.start();
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
this.logger('error', 'debug', `[ArDetector::scheduleInitRestart] <@${this.arid}> Failed to start main(). Error:`,e);
|
this.logger('error', 'debug', `[ArDetector::scheduleInitRestart] <@${this.arid}> Failed to start main(). Error:`,e);
|
||||||
}
|
}
|
||||||
@ -519,41 +524,6 @@ class ArDetector {
|
|||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
async main() {
|
|
||||||
try {
|
|
||||||
if (this._paused) {
|
|
||||||
this.start();
|
|
||||||
return; // main loop still keeps executing. Return is needed to avoid a million instances of autodetection
|
|
||||||
}
|
|
||||||
if (!this._halted) {
|
|
||||||
// we are already running, don't run twice
|
|
||||||
// this would have handled the 'paused' from before, actually.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let exitedRetries = 10;
|
|
||||||
|
|
||||||
while (!this._exited && exitedRetries --> 0) {
|
|
||||||
this.logger.log('warn', 'debug', `[ArDetect::main] <@${this.arid}> We are trying to start another instance of autodetection on current video, but the previous instance hasn't exited yet. Waiting for old instance to exit ...`);
|
|
||||||
await sleep(this.settings.active.arDetect.timers.tickrate);
|
|
||||||
}
|
|
||||||
if (!this._exited) {
|
|
||||||
this.logger.log('error', 'debug', `[ArDetect::main] <@${this.arid}> Previous instance didn't exit in time. Not starting a new one.`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.logger.log('info', 'debug', `%c[ArDetect::main] <@${this.arid}> Previous instance didn't exit in time. Not starting a new one.`);
|
|
||||||
|
|
||||||
// we need to unhalt:
|
|
||||||
this._halted = false;
|
|
||||||
this._exited = false;
|
|
||||||
|
|
||||||
this.start();
|
|
||||||
} catch (e) {
|
|
||||||
this.logger.log('error', 'debug', `[ArDetect::main] <${this.arid} failed to start autodetection for some reason.`, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the "main loop" for aspect ratio autodetection
|
* This is the "main loop" for aspect ratio autodetection
|
||||||
*/
|
*/
|
||||||
@ -719,6 +689,7 @@ class ArDetector {
|
|||||||
// And if we're here while DRM is detected, we know we'll be looking at black frames.
|
// And if we're here while DRM is detected, we know we'll be looking at black frames.
|
||||||
// We won't be able to do anything useful, therefore we're just gonna call it quits.
|
// We won't be able to do anything useful, therefore we're just gonna call it quits.
|
||||||
if (this.conf.hasDrm) {
|
if (this.conf.hasDrm) {
|
||||||
|
this.logger.log('info', 'debug', 'we have drm, doing nothing.', this.conf.hasDrm);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -796,6 +767,7 @@ class ArDetector {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Če preverjamo naprej, potem moramo postaviti to vrednost nazaj na 'false'. V nasprotnem primeru se bo
|
// Če preverjamo naprej, potem moramo postaviti to vrednost nazaj na 'false'. V nasprotnem primeru se bo
|
||||||
// css resetiral enkrat na video/pageload namesto vsakič, ko so za nekaj časa obrobe odstranejene
|
// css resetiral enkrat na video/pageload namesto vsakič, ko so za nekaj časa obrobe odstranejene
|
||||||
// if we look further we need to reset this value back to false. Otherwise we'll only get CSS reset once
|
// if we look further we need to reset this value back to false. Otherwise we'll only get CSS reset once
|
||||||
@ -1066,6 +1038,13 @@ class ArDetector {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Does a quick test to see if the aspect ratio is correct
|
||||||
|
* Returns 'true' if there's a chance of letterbox existing, false if not.
|
||||||
|
* @param imageData
|
||||||
|
* @param sampleCols
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
fastLetterboxPresenceTest(imageData, sampleCols) {
|
fastLetterboxPresenceTest(imageData, sampleCols) {
|
||||||
// fast test to see if aspect ratio is correct.
|
// fast test to see if aspect ratio is correct.
|
||||||
// returns 'true' if presence of letterbox is possible.
|
// returns 'true' if presence of letterbox is possible.
|
||||||
@ -1105,8 +1084,11 @@ class ArDetector {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentMin < this.blackLevel)
|
|
||||||
|
|
||||||
|
if (currentMin < this.blackLevel) {
|
||||||
this.blackLevel = currentMin
|
this.blackLevel = currentMin
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -438,7 +438,7 @@ class VideoData {
|
|||||||
*/
|
*/
|
||||||
private _processDimensionsChanged() {
|
private _processDimensionsChanged() {
|
||||||
if (!this.player) {
|
if (!this.player) {
|
||||||
console.warn(`[VideoData::_processDimensionsChanged] Player is not defined. This is super haram.`, this.player)
|
this.logger.log('warn', 'debug', `[VideoData::_processDimensionsChanged] Player is not defined. This is super haram.`, this.player)
|
||||||
}
|
}
|
||||||
// adding player observer taught us that if element size gets triggered by a class, then
|
// adding player observer taught us that if element size gets triggered by a class, then
|
||||||
// the 'style' attributes don't necessarily trigger. This means we also need to trigger
|
// the 'style' attributes don't necessarily trigger. This means we also need to trigger
|
||||||
|
@ -218,7 +218,7 @@ class Resizer {
|
|||||||
this.logger.log('info', 'resizer', `[Resizer::setAr] <${this.resizerId}> Something wrong with ar or the player. Doing nothing.`);
|
this.logger.log('info', 'resizer', `[Resizer::setAr] <${this.resizerId}> Something wrong with ar or the player. Doing nothing.`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.lastAr = {type: ar.type, ratio: ar.ratio}
|
this.lastAr = {type: ar.type, ratio: ar.ratio};
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (this.extensionMode === ExtensionMode.Basic && !PlayerData.isFullScreen() && ar.type !== AspectRatioType.Reset) {
|
// if (this.extensionMode === ExtensionMode.Basic && !PlayerData.isFullScreen() && ar.type !== AspectRatioType.Reset) {
|
||||||
@ -293,7 +293,6 @@ class Resizer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.zoom.applyZoom(stretchFactors);
|
this.zoom.applyZoom(stretchFactors);
|
||||||
|
|
||||||
this.stretcher.chromeBugMitigation(stretchFactors);
|
this.stretcher.chromeBugMitigation(stretchFactors);
|
||||||
|
|
||||||
let translate = this.computeOffsets(stretchFactors);
|
let translate = this.computeOffsets(stretchFactors);
|
||||||
|
Loading…
Reference in New Issue
Block a user