Add .gitignore to exclude all node packages and lock files

This commit is contained in:
Adolfo Reyna
2026-02-23 21:56:04 -05:00
parent faae96c9ed
commit dcc5c6c044
9747 changed files with 1555105 additions and 2 deletions
@@ -0,0 +1,34 @@
/**
* Validates and processes a VideoFrame returned from an onFrame callback
*/
/**
* Validates that a VideoFrame returned from onFrame callback matches expected dimensions and timestamp
* If validation fails, closes both frames and throws an error
*/
export const validateVideoFrame = ({ originalFrame, returnedFrame, expectedWidth, expectedHeight, expectedTimestamp, }) => {
// Validate that the returned frame is actually a VideoFrame
if (!(returnedFrame instanceof VideoFrame)) {
originalFrame.close();
throw new Error('onFrame callback must return a VideoFrame or void');
}
// Check if it's the same frame (no validation needed)
if (returnedFrame === originalFrame) {
return returnedFrame;
}
// Validate dimensions
if (returnedFrame.displayWidth !== expectedWidth ||
returnedFrame.displayHeight !== expectedHeight) {
originalFrame.close();
returnedFrame.close();
throw new Error(`VideoFrame dimensions mismatch: expected ${expectedWidth}x${expectedHeight}, got ${returnedFrame.displayWidth}x${returnedFrame.displayHeight}`);
}
// Validate timestamp
if (returnedFrame.timestamp !== expectedTimestamp) {
originalFrame.close();
returnedFrame.close();
throw new Error(`VideoFrame timestamp mismatch: expected ${expectedTimestamp}, got ${returnedFrame.timestamp}`);
}
// If we got a different frame but it's valid, close the original and use the new one
originalFrame.close();
return returnedFrame;
};