Skip to content

Commit

Permalink
Video: Fix null fps structure
Browse files Browse the repository at this point in the history
  • Loading branch information
stephendade committed Feb 4, 2024
1 parent 3d0f5a0 commit c3a6d40
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions server/videostream.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ class videoStream {
if (!this.active) {
return callback(null, this.devices, this.active, this.devices[0], this.devices[0].caps[0],
{ label: '0°', value: 0 }, 1100, fpsSelected, false, '127.0.0.1', 5400, false,
this.devices[0].caps[0].fps, this.devices[0].caps[0].fpsmax, this.devices[0].caps)
(this.devices[0].caps[0].fps !== undefined) ? this.devices[0].caps[0].fps : [],
this.devices[0].caps[0].fpsmax, this.devices[0].caps)
} else {
// format saved settings
const seldevice = this.devices.filter(it => it.value === this.savedDevice.device)
Expand All @@ -86,7 +87,8 @@ class videoStream {
this.resetVideo()
return callback(null, this.devices, this.active, this.devices[0], this.devices[0].caps[0],
{ label: '0°', value: 0 }, 1100, fpsSelected, false, '127.0.0.1', 5400, false,
this.devices[0].caps[0].fps, this.devices[0].caps[0].fpsmax, this.devices[0].caps)
(this.devices[0].caps[0].fps !== undefined) ? this.devices[0].caps[0].fps : [],
this.devices[0].caps[0].fpsmax, this.devices[0].caps)
}
const selRes = seldevice[0].caps.filter(it => it.value === this.savedDevice.width.toString() + 'x' + this.savedDevice.height.toString() + 'x' + this.savedDevice.format.toString().split('/')[1])
let selFPS = this.savedDevice.fps
Expand All @@ -99,7 +101,7 @@ class videoStream {
return callback(null, this.devices, this.active, seldevice[0], selRes[0],
{ label: this.savedDevice.rotation.toString() + '°', value: this.savedDevice.rotation },
this.savedDevice.bitrate, selFPS, this.savedDevice.useUDP, this.savedDevice.useUDPIP,
this.savedDevice.useUDPPort, this.savedDevice.useTimestamp, selRes[0].fps,
this.savedDevice.useUDPPort, this.savedDevice.useTimestamp, (selRes[0].fps !== undefined) ? selRes[0].fps : [],
selRes[0].fpsmax, seldevice[0].caps)
} else {
// bad settings
Expand All @@ -108,7 +110,8 @@ class videoStream {
this.resetVideo()
return callback(null, this.devices, this.active, this.devices[0], this.devices[0].caps[0],
{ label: '0°', value: 0 }, 1100, fpsSelected, false, '127.0.0.1', 5400, false,
this.devices[0].caps[0].fps, this.devices[0].caps[0].fpsmax, this.devices[0].caps)
(this.devices[0].caps[0].fps !== undefined) ? this.devices[0].caps[0].fps : [],
this.devices[0].caps[0].fpsmax, this.devices[0].caps)
}
}
}
Expand Down

5 comments on commit c3a6d40

@ddd999
Copy link

@ddd999 ddd999 commented on c3a6d40 Feb 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may have introduced a new bug. If I start a video stream, navigate away from the Video Streaming page on the web UI, and then click on Video Streaming again, the web UI hangs with a progress bar forever, and this shows up in the app log:

2024-02-04 19:10:02 error [server/networkManager.js]: uncaughtException: Cannot read properties of undefined (reading 'fpsmax') TypeError: Cannot read properties of undefined (reading 'fpsmax') at /home/pi/Rpanion-server/server/videostream.js:95:25 at ChildProcess.exithandler (node:child_process:414:7) at ChildProcess.emit (node:events:518:28) at maybeClose (node:internal/child_process:1105:16) at ChildProcess._handle.onexit (node:internal/child_process:305:5)

I've repeated this test several times and had the same result every time.

The only way I've been able to get the Video Streaming page back to normal is by deleting settings.json and restarting the rpanion server with npm run dev.

Edit: I tried reverting just this commit, and still had the same result.

@stephendade
Copy link
Owner Author

@stephendade stephendade commented on c3a6d40 Feb 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What board (Rpi?) are you running and with which connected cameras?

EDIT: You may need to run npm run build to re-build the front-end to get it working.

@ddd999
Copy link

@ddd999 ddd999 commented on c3a6d40 Feb 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am running a Pi Zero 2W, and this is happening with just the test stream (bouncing ball video).

Edit: I got the same error again after running:
npm run build
npm run dev

@stephendade
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the report. Fixed in #200. Was an issue specific to the testvideosrc and Jetson CSI cameras.

@ddd999
Copy link

@ddd999 ddd999 commented on c3a6d40 Feb 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, that was fast! Appears to be fixed now. Thanks!!

Please sign in to comment.