Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Jan 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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>)
- 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: 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>)
- Auth token key is not returned when registering without email verification (<https://github.com/openvinotoolkit/cvat/pull/4092>)


### Security
- Updated ELK to 6.8.22 which uses log4j 2.17.0 (<https://github.com/openvinotoolkit/cvat/pull/4052>)

Expand Down
4 changes: 2 additions & 2 deletions cvat-core/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cvat-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"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",
"main": "babel.config.js",
"scripts": {
Expand Down
59 changes: 37 additions & 22 deletions cvat-core/src/frames.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2021 Intel Corporation
// Copyright (C) 2021-2022 Intel Corporation
//
// SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -477,31 +477,47 @@

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
// eslint-disable-next-line no-async-promise-executor
return new Promise(async (resolve, reject) => {
for (const chunkIdx in this._requestedChunks) {
if (Object.prototype.hasOwnProperty.call(this._requestedChunks, chunkIdx)) {
try {
const chunkFrames = await this.requestOneChunkFrames(chunkIdx);
if (chunkIdx in this._requestedChunks) {
bufferedFrames = new Set([...bufferedFrames, ...chunkFrames]);
this._buffer = {
...this._buffer,
...this._requestedChunks[chunkIdx].buffer,
};
delete this._requestedChunks[chunkIdx];
if (Object.keys(this._requestedChunks).length === 0) {
resolve(bufferedFrames);
}
} else {
reject(chunkIdx);
break;
for (const chunkIdx of Object.keys(this._requestedChunks)) {
try {
const chunkFrames = await this.requestOneChunkFrames(chunkIdx);
if (chunkIdx in this._requestedChunks) {
bufferedFrames = new Set([...bufferedFrames, ...chunkFrames]);

buffersToBeCommited.push(this._requestedChunks[chunkIdx].buffer);
delete this._requestedChunks[chunkIdx];
if (Object.keys(this._requestedChunks).length === 0) {
commitBuffers();
resolve(bufferedFrames);
}
} catch (error) {
reject(error);
} else {
commitBuffers();
reject(chunkIdx);
break;
}
} catch (error) {
commitBuffers();
reject(error);
break;
}
}
});
Expand All @@ -524,7 +540,7 @@

async require(frameNumber, taskID, jobID, fillBuffer, frameStep) {
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];
}
}
Expand Down Expand Up @@ -563,7 +579,6 @@
} else if (fillBuffer) {
this.clear();
await this.makeFillRequest(frameNumber, frameStep, fillBuffer ? null : 1);

frame = this._buffer[frameNumber];
} else {
this.clear();
Expand Down
11 changes: 8 additions & 3 deletions cvat-ui/src/containers/annotation-page/top-bar/top-bar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2021 Intel Corporation
// Copyright (C) 2021-2022 Intel Corporation
//
// SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -49,6 +49,7 @@ interface StateToProps {
frameStep: number;
frameSpeed: FrameSpeed;
frameDelay: number;
frameFetching: boolean;
playing: boolean;
saving: boolean;
canvasIsReady: boolean;
Expand Down Expand Up @@ -89,7 +90,9 @@ function mapStateToProps(state: CombinedState): StateToProps {
annotation: {
player: {
playing,
frame: { filename: frameFilename, number: frameNumber, delay: frameDelay },
frame: {
filename: frameFilename, number: frameNumber, delay: frameDelay, fetching: frameFetching,
},
},
annotations: {
saving: { uploading: saving, statuses: savingStatuses, forceExit },
Expand All @@ -112,6 +115,7 @@ function mapStateToProps(state: CombinedState): StateToProps {
frameStep,
frameSpeed,
frameDelay,
frameFetching,
playing,
canvasIsReady,
saving,
Expand Down Expand Up @@ -484,13 +488,14 @@ class AnnotationTopBarContainer extends React.PureComponent<Props, State> {
frameSpeed,
frameNumber,
frameDelay,
frameFetching,
playing,
canvasIsReady,
onSwitchPlay,
onChangeFrame,
} = this.props;

if (playing && canvasIsReady) {
if (playing && canvasIsReady && !frameFetching) {
if (frameNumber < jobInstance.stopFrame) {
let framesSkipped = 0;
if (frameSpeed === FrameSpeed.Fast && frameNumber + 1 < jobInstance.stopFrame) {
Expand Down