(Obsolete?) Windows Camera Capture Always Uses 1FPS
JosephCatrambone opened this issue · 1 comments
Using 557eba6 because it's the last branch I can find that builds on Windows 10. This issue may be obsolete. Feel free to close if that's the case.
Steps to reproduce:
let camera = Camera::new(index, requested);
let camera = camera.unwrap();
println!("Opened camera with resolution {:?} and frame rate {:?}", &camera.resolution(), &camera.frame_rate());
Expected behavior:
If a camera exists that can deliver 30FPS (as is the case here), then a camera with the given framerate should be returned.
We should see, "Opened camera with resolution 1920x1080 and frame rate 30"
Observed behavior:
We see, "Opened camera with resolution 1920x1080 and frame rate 1"
Detailed observations:
Inside of msmf_backend, let desired
is being evaluated correctly and returning a camera with the correct resolution and frame rate. The mf_device.set_format
method, however, is always setting a frame-rate of one. This section is suspicious:
let fps = {
let frame_rate_u64 = 0_u64;
let mut bytes: [u8; 8] = frame_rate_u64.to_le_bytes();
bytes[7] = format.frame_rate() as u8;
bytes[3] = 0x01;
u64::from_le_bytes(bytes)
};
For a frame_rate of 30, the byte array [0, 0, 0, 1, 0, 0, 0, 30] produces an FPS of 2161727821154615296. My camera does not support a frame time of less than 0.46 attoseconds as there is no SI prefix small enough to describe it.
Closing, as I think this might be a duplicate of #110