windows-capture icon indicating copy to clipboard operation
windows-capture copied to clipboard

Fix: Resolve compilation errors for callback feature (builds on #151)

Open amangupta20 opened this issue 3 months ago • 2 comments

Hi there!

I'm working on a project that needs high-performance screen capture, and the callback feature from PR #151 is perfect for it.

I noticed the original PR was failing to build with the latest dependencies, so I dug in and patched the compilation errors. I'm opening this new PR so everyone can get it working without any issues.

This combines all the work from #151 with the necessary fixes. Hopefully, this helps anyone else who stumbles upon the same issue!

Changes:

  • Incorporates the callback argument in the start() method from PR #151.
  • Fixes compilation errors in src/encoder.rs and src/network.rs caused by dependency updates.

amangupta20 avatar Sep 08 '25 17:09 amangupta20

Thank you for the pull request. However, I noticed a few issues:

  1. There are two binary files in the commit that may not be necessary.
  2. I believe we should consider an abstraction that allows users to implement their own solutions, such as their specific WebRTC implementation or TCP frame ordering, instead of relying on our defaults.

I would love to hear your thoughts on this.

@codex, review this PR.

NiiightmareXD avatar Sep 09 '25 18:09 NiiightmareXD

Codex Review: Here are some suggestions.

https://github.com/NiiightmareXD/windows-capture/blob/9a76168ea80061519c7eb8c52111be9b147456cf/src/encoder.rs#L1463-L1468 [P1] Stop treating raw sample buffers as encoded video

The callback sends whatever MediaStreamSample::Buffer returns as an EncodedFrame. When the sample was created from Direct3D11 surfaces this property is typically empty or fails, so the handler will error out before the transcoder runs. Even when it succeeds, the bytes are the uncompressed BGRA frame, not the H264/AAC output generated by the MediaTranscoder, so the network layer sends multi‑megabyte raw frames and downstream decoders never receive keyframes. To stream encoded data you need to consume the transcoder’s output stream (or another post‑encode hook) instead of the pre‑encode sample.


https://github.com/NiiightmareXD/windows-capture/blob/9a76168ea80061519c7eb8c52111be9b147456cf/test_implementation#L1 [P2] Drop committed test binaries

The commit adds test_implementation and test_windows_integration binaries (~3.6 MB each). These compiled artifacts bloat the repository and will quickly become stale; they should be generated as part of CI or downloaded on demand instead of being versioned.


Reply with @codex fix comments to fix any unresolved comments.

About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".