BrowserMultiFormatReader.reader.reset() never called, leaving video resources to consume lots of power.
kodecharlie opened this issue · comments
kodecharlie commented
The problem is that an invocation of BrowserMultiFormatReader.reset()
never results in a call to BrowserMultiFormatReader.reader.reset()
.
Here's the current snapshot of BrowserMultiFormatReader:
export class BrowserMultiFormatReader extends BrowserCodeReader {
protected readonly reader: MultiFormatReader;
public constructor(
hints: Map<DecodeHintType, any> = null,
timeBetweenScansMillis: number = 500
) {
const reader = new MultiFormatReader();
reader.setHints(hints);
super(reader, timeBetweenScansMillis);
}
/**
* Overwrite decodeBitmap to call decodeWithState, which will pay
* attention to the hints set in the constructor function
*/
public decodeBitmap(binaryBitmap: BinaryBitmap): Result {
return this.reader.decodeWithState(binaryBitmap);
}
}
To resolve, I propose overriding BrowserCodeReader.reset()inside BrowserMultiFormatReader like this:
// Overrides BrowserCodeReader
public reset(): void {
super.reset();
if (this.reader != null) {
this.reader.reset();
}
}
That way, we deactivate any state within the superclass as well as turning off resources allocated by
the masked instance of MultiFormatReader.
github-actions commented
Stale issue message