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

a few typos #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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 lib/VideoDecoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class VideoDecoder extends Emitter
const stats = this.decoder.GetStats();

//Ensure they are not too old
if (stats.timestamp + 1000 < new Date().time)
if (stats.timestamp + 1000 < new Date().getTime())
//Nothing
return null;

Expand Down
8 changes: 4 additions & 4 deletions lib/VideoEncoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ class VideoEncoder extends Emitter
const scaleResolutionToHeight = params.scaleResolutionToHeight ? parseInt(params.scaleResolutionToHeight) : 0;
const allowedDownScaling = scaleResolutionToHeight && params.hasOwnProperty("allowSameHeight")? (params.allowSameHeight ? 1 : 2) : 0;
//Get default for width and heights
const width = parseInt(params.width) ? parseInt(params.width) : (scaleResolutionDownBy ? 640 : 0);
const height = parseInt(params.height) ? parseInt(params.height) : (scaleResolutionDownBy ? 480 : 0);
const width = params.width ? parseInt(params.width) : (scaleResolutionDownBy ? 640 : 0);
Copy link
Member

Choose a reason for hiding this comment

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

we need to sanitize input data, iirc swig crashes if wrong type is used

Suggested change
const width = params.width ? parseInt(params.width) : (scaleResolutionDownBy ? 640 : 0);
const width = parseInt(params.width) ?? 0;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

your suggestion removes the default of 640, are you sure we want that?

Copy link
Member

Choose a reason for hiding this comment

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

I think that should be the ultimate goal, we can be consertative and just do this instead

Suggested change
const width = params.width ? parseInt(params.width) : (scaleResolutionDownBy ? 640 : 0);
const width = parseInt(params.width) ?? (scaleResolutionDownBy ? 640 : 0);

const height = params.height ? parseInt(params.height) : (scaleResolutionDownBy ? 480 : 0);
//Set codec
if (!encoder.SetVideoCodec(codec,width,height,parseInt(params.fps),parseInt(params.bitrate),parseInt(params.intraPeriod || 0), properties))
//Error
Expand Down Expand Up @@ -105,7 +105,7 @@ class VideoEncoder extends Emitter
const stats = this.encoder.GetStats();

//Ensure they are not too old
if (stats.timestamp + 1000 < new Date().time)
if (stats.timestamp + 1000 < new Date().getTime())
//Nothing
return null;

Expand All @@ -120,7 +120,7 @@ class VideoEncoder extends Emitter
avg : stats.avgEncodingTime,
},
capturingTime : {
maxa : stats.maxCapturingTime,
max : stats.maxCapturingTime,
avg : stats.avgCapturingTime,
}
};
Expand Down