diff --git a/src/main.rs b/src/main.rs index df079c6..5032cee 100644 --- a/src/main.rs +++ b/src/main.rs @@ -35,12 +35,20 @@ fn main() -> Result <(), Error> let mut buf = vec! [0u8; cap.size_image ()]; let mut bytesused = 0; - for _ in 0..5 + for _ in 0..30 + { + cap.wait_for_frame (&mut buf); + } + + let start = Instant::now (); + for _ in 0..30 { let rc = cap.wait_for_frame (&mut buf); bytesused = rc.unwrap (); - dbg! (bytesused); } + let stop = Instant::now (); + + dbg! (30_000.0f32 / (stop - start).as_millis () as f32); let mut f = std::fs::File::create ("data.jpeg").unwrap (); f.write_all (&buf [0..bytesused]).unwrap ();