Skip to content

Commit

Permalink
send stride with camera feed frames
Browse files Browse the repository at this point in the history
  • Loading branch information
Brendonovich committed Dec 16, 2024
1 parent f7895fa commit 210359d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
9 changes: 0 additions & 9 deletions apps/desktop/src/utils/socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,8 @@ export function createImageDataWS(
setIsConnected(false);
});

// let lastTime = Date.now();
ws.binaryType = "arraybuffer";
ws.onmessage = (event) => {
// console.log(Date.now() - lastTime);

// onmessage(new ImageData(new Uint8ClampedArray([0, 0, 0, 0]), 1, 1));

const buffer = event.data as ArrayBuffer;
const clamped = new Uint8ClampedArray(buffer);

Expand All @@ -54,16 +49,12 @@ export function createImageDataWS(
(strideArr[3] << 24)) /
4;

console.log({ stride, width, height });

const imageData = new ImageData(
clamped.slice(0, clamped.length - 12),
stride,
height
);

// lastTime = Date.now();

onmessage({ width, data: imageData });
};

Expand Down
1 change: 1 addition & 0 deletions crates/media/src/feeds/camera.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ impl FrameConverter {
}
};

data.extend_from_slice(&(resolution.width() * 4).to_le_bytes());
data.extend_from_slice(&resolution.height().to_le_bytes());
data.extend_from_slice(&resolution.width().to_le_bytes());

Expand Down

1 comment on commit 210359d

@vercel
Copy link

@vercel vercel bot commented on 210359d Dec 16, 2024

Choose a reason for hiding this comment

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

Please sign in to comment.