Windows Sender Demo
This is a simplified demo of the Windows Host sender for DisplayFlow. It demonstrates:
- Screen Capture using Desktop Duplication API (DXGI).
- Hardware H.264 Encoding using Media Foundation (MF).
- Network Transmission using UDP.
Prerequisites
- Windows 10/11
- Visual Studio 2019 or later (with C++ Desktop Development)
- CMake 3.10+
Build
- Open a terminal (Developer Command Prompt for VS).
- Navigate to this directory:
cd demo\windows_sender - Create a build directory:
mkdir build cd build - Configure and Build:
cmake .. cmake --build . --config Release
Run
Run the executable with target IP and Port (optional):
.\Release\WindowsSenderDemo.exe <TargetIP> <Port>
Example:
.\Release\WindowsSenderDemo.exe 192.168.1.100 8888
Implementation Details
- ScreenCapture: Uses
IDXGIOutputDuplicationto capture desktop frames. - VideoEncoder: Uses
IMFTransform(Media Foundation) to encode frames to H.264.- Note: This demo attempts to feed RGB32 textures to the encoder. If the hardware encoder only supports NV12, conversion logic is needed (not fully implemented in this minimal demo).
- NetworkSender: Fragments the H.264 stream into UDP packets (MTU ~1400 bytes) and sends them to the target.
Protocol
The demo uses a simple custom protocol for feasibility verification:
- Packet Header (Network Layer):
FrameID(4B),FragID(2B),TotalFrags(2B). - Frame Header (Application Layer, in first fragment/reassembled):
Timestamp(8B),Width(4B),Height(4B),Type(4B),Size(4B). - Payload: H.264 NAL units.