Fixed: Could not receive frame N. TypeError: Cannot read properties of undefined (#4187)

* Fixed issue with async frames fetching

* Updated versions and changelog
main
Boris Sekachev 4 years ago committed by GitHub
parent 182d941fad
commit bc4ff49bf0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -56,10 +56,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added intelligent function when paste labels to another task (<https://github.com/openvinotoolkit/cvat/pull/4161>) - Added intelligent function when paste labels to another task (<https://github.com/openvinotoolkit/cvat/pull/4161>)
- Uncaught TypeError: this.el.node.getScreenCTM() is null in Firefox (<https://github.com/openvinotoolkit/cvat/pull/4175>) - Uncaught TypeError: this.el.node.getScreenCTM() is null in Firefox (<https://github.com/openvinotoolkit/cvat/pull/4175>)
- Bug: canvas is busy when start playing, start resizing a shape and do not release the mouse cursor (<https://github.com/openvinotoolkit/cvat/pull/4151>) - Bug: canvas is busy when start playing, start resizing a shape and do not release the mouse cursor (<https://github.com/openvinotoolkit/cvat/pull/4151>)
- Bug: could not receive frame N. TypeError: Cannot read properties of undefined (reding "filename") (<https://github.com/openvinotoolkit/cvat/pull/4187>)
- Fixed tus upload error over https (<https://github.com/openvinotoolkit/cvat/pull/4154>) - Fixed tus upload error over https (<https://github.com/openvinotoolkit/cvat/pull/4154>)
- Auth token key is not returned when registering without email verification (<https://github.com/openvinotoolkit/cvat/pull/4092>) - Auth token key is not returned when registering without email verification (<https://github.com/openvinotoolkit/cvat/pull/4092>)
### Security ### Security
- Updated ELK to 6.8.22 which uses log4j 2.17.0 (<https://github.com/openvinotoolkit/cvat/pull/4052>) - Updated ELK to 6.8.22 which uses log4j 2.17.0 (<https://github.com/openvinotoolkit/cvat/pull/4052>)

@ -1,12 +1,12 @@
{ {
"name": "cvat-core", "name": "cvat-core",
"version": "4.1.0", "version": "4.1.1",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "cvat-core", "name": "cvat-core",
"version": "4.1.0", "version": "4.1.1",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"axios": "^0.21.4", "axios": "^0.21.4",

@ -1,6 +1,6 @@
{ {
"name": "cvat-core", "name": "cvat-core",
"version": "4.1.0", "version": "4.1.1",
"description": "Part of Computer Vision Tool which presents an interface for client-side integration", "description": "Part of Computer Vision Tool which presents an interface for client-side integration",
"main": "babel.config.js", "main": "babel.config.js",
"scripts": { "scripts": {

@ -1,4 +1,4 @@
// Copyright (C) 2021 Intel Corporation // Copyright (C) 2021-2022 Intel Corporation
// //
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
@ -477,31 +477,47 @@
let bufferedFrames = new Set(); let bufferedFrames = new Set();
// if we send one request to get frame 1 with filling the buffer
// then quicky send one more request to get frame 1
// frame 1 will be already decoded and written to buffer
// the second request gets frame 1 from the buffer, removes it from there and returns
// after the first request finishes decoding it tries to get frame 1, but failed
// because frame 1 was already removed from the buffer by the second request
// to prevent this behavior we do not write decoded frames to buffer till the end of decoding all chunks
const buffersToBeCommited = [];
const commitBuffers = () => {
for (const buffer of buffersToBeCommited) {
this._buffer = {
...this._buffer,
...buffer,
};
}
};
// Need to decode chunks in sequence // Need to decode chunks in sequence
// eslint-disable-next-line no-async-promise-executor // eslint-disable-next-line no-async-promise-executor
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
for (const chunkIdx in this._requestedChunks) { for (const chunkIdx of Object.keys(this._requestedChunks)) {
if (Object.prototype.hasOwnProperty.call(this._requestedChunks, chunkIdx)) { try {
try { const chunkFrames = await this.requestOneChunkFrames(chunkIdx);
const chunkFrames = await this.requestOneChunkFrames(chunkIdx); if (chunkIdx in this._requestedChunks) {
if (chunkIdx in this._requestedChunks) { bufferedFrames = new Set([...bufferedFrames, ...chunkFrames]);
bufferedFrames = new Set([...bufferedFrames, ...chunkFrames]);
this._buffer = { buffersToBeCommited.push(this._requestedChunks[chunkIdx].buffer);
...this._buffer, delete this._requestedChunks[chunkIdx];
...this._requestedChunks[chunkIdx].buffer, if (Object.keys(this._requestedChunks).length === 0) {
}; commitBuffers();
delete this._requestedChunks[chunkIdx]; resolve(bufferedFrames);
if (Object.keys(this._requestedChunks).length === 0) {
resolve(bufferedFrames);
}
} else {
reject(chunkIdx);
break;
} }
} catch (error) { } else {
reject(error); commitBuffers();
reject(chunkIdx);
break; break;
} }
} catch (error) {
commitBuffers();
reject(error);
break;
} }
} }
}); });
@ -524,7 +540,7 @@
async require(frameNumber, taskID, jobID, fillBuffer, frameStep) { async require(frameNumber, taskID, jobID, fillBuffer, frameStep) {
for (const frame in this._buffer) { for (const frame in this._buffer) {
if (frame < frameNumber || frame >= frameNumber + this._size * frameStep) { if (+frame < frameNumber || +frame >= frameNumber + this._size * frameStep) {
delete this._buffer[frame]; delete this._buffer[frame];
} }
} }
@ -563,7 +579,6 @@
} else if (fillBuffer) { } else if (fillBuffer) {
this.clear(); this.clear();
await this.makeFillRequest(frameNumber, frameStep, fillBuffer ? null : 1); await this.makeFillRequest(frameNumber, frameStep, fillBuffer ? null : 1);
frame = this._buffer[frameNumber]; frame = this._buffer[frameNumber];
} else { } else {
this.clear(); this.clear();

@ -1,4 +1,4 @@
// Copyright (C) 2021 Intel Corporation // Copyright (C) 2021-2022 Intel Corporation
// //
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
@ -49,6 +49,7 @@ interface StateToProps {
frameStep: number; frameStep: number;
frameSpeed: FrameSpeed; frameSpeed: FrameSpeed;
frameDelay: number; frameDelay: number;
frameFetching: boolean;
playing: boolean; playing: boolean;
saving: boolean; saving: boolean;
canvasIsReady: boolean; canvasIsReady: boolean;
@ -89,7 +90,9 @@ function mapStateToProps(state: CombinedState): StateToProps {
annotation: { annotation: {
player: { player: {
playing, playing,
frame: { filename: frameFilename, number: frameNumber, delay: frameDelay }, frame: {
filename: frameFilename, number: frameNumber, delay: frameDelay, fetching: frameFetching,
},
}, },
annotations: { annotations: {
saving: { uploading: saving, statuses: savingStatuses, forceExit }, saving: { uploading: saving, statuses: savingStatuses, forceExit },
@ -112,6 +115,7 @@ function mapStateToProps(state: CombinedState): StateToProps {
frameStep, frameStep,
frameSpeed, frameSpeed,
frameDelay, frameDelay,
frameFetching,
playing, playing,
canvasIsReady, canvasIsReady,
saving, saving,
@ -484,13 +488,14 @@ class AnnotationTopBarContainer extends React.PureComponent<Props, State> {
frameSpeed, frameSpeed,
frameNumber, frameNumber,
frameDelay, frameDelay,
frameFetching,
playing, playing,
canvasIsReady, canvasIsReady,
onSwitchPlay, onSwitchPlay,
onChangeFrame, onChangeFrame,
} = this.props; } = this.props;
if (playing && canvasIsReady) { if (playing && canvasIsReady && !frameFetching) {
if (frameNumber < jobInstance.stopFrame) { if (frameNumber < jobInstance.stopFrame) {
let framesSkipped = 0; let framesSkipped = 0;
if (frameSpeed === FrameSpeed.Fast && frameNumber + 1 < jobInstance.stopFrame) { if (frameSpeed === FrameSpeed.Fast && frameNumber + 1 < jobInstance.stopFrame) {

Loading…
Cancel
Save