File tree Expand file tree Collapse file tree 1 file changed +15
-11
lines changed Expand file tree Collapse file tree 1 file changed +15
-11
lines changed Original file line number Diff line number Diff line change 11use flume:: { Receiver , Sender } ;
22use std:: time:: { Instant , SystemTime } ;
3- use tracing:: { error, info} ;
3+ use tracing:: { error, info, warn } ;
44
55use crate :: {
66 data:: { FFVideo , VideoInfo } ,
@@ -32,16 +32,20 @@ impl CameraSource {
3232
3333 fn process_frame ( & self , camera_frame : RawCameraFrame ) -> Result < ( ) , MediaError > {
3434 let RawCameraFrame { frame, captured_at } = camera_frame;
35- if let Err ( _) = self . output . send ( (
36- frame,
37- captured_at
38- . duration_since ( self . start_time )
39- . unwrap ( )
40- . as_secs_f64 ( ) ,
41- ) ) {
42- return Err ( MediaError :: Any (
43- "Pipeline is unreachable! Stopping capture" . into ( ) ,
44- ) ) ;
35+ match captured_at. duration_since ( self . start_time ) {
36+ Ok ( time) => {
37+ if let Err ( _) = self . output . send ( ( frame, time. as_secs_f64 ( ) ) ) {
38+ return Err ( MediaError :: Any (
39+ "Pipeline is unreachable! Stopping capture" . into ( ) ,
40+ ) ) ;
41+ }
42+ }
43+ Err ( error) => {
44+ warn ! (
45+ "Camera frame captured {} millis before start time" ,
46+ error. duration( ) . as_millis( )
47+ ) ;
48+ }
4549 }
4650
4751 Ok ( ( ) )
You can’t perform that action at this time.
0 commit comments