@@ -790,11 +790,17 @@ impl RecoveryManager {
790790 let system_audio_path = segment_dir. join ( "system_audio.ogg" ) ;
791791 let cursor_path = segment_dir. join ( "cursor.json" ) ;
792792
793+ let display_start_time = original_segment. and_then ( |s| s. display . start_time ) ;
794+
795+ let get_start_time_or_fallback = |original_time : Option < f64 > | -> Option < f64 > {
796+ original_time. or_else ( || display_start_time. map ( |_| 0.0 ) )
797+ } ;
798+
793799 MultipleSegment {
794800 display : VideoMeta {
795801 path : RelativePathBuf :: from ( format ! ( "{segment_base}/display.mp4" ) ) ,
796802 fps,
797- start_time : original_segment . and_then ( |s| s . display . start_time ) ,
803+ start_time : display_start_time ,
798804 device_id : original_segment. and_then ( |s| s. display . device_id . clone ( ) ) ,
799805 } ,
800806 camera : if camera_path. exists ( ) {
@@ -804,9 +810,11 @@ impl RecoveryManager {
804810 . and_then ( |s| s. camera . as_ref ( ) )
805811 . map ( |c| c. fps )
806812 . unwrap_or ( 30 ) ,
807- start_time : original_segment
808- . and_then ( |s| s. camera . as_ref ( ) )
809- . and_then ( |c| c. start_time ) ,
813+ start_time : get_start_time_or_fallback (
814+ original_segment
815+ . and_then ( |s| s. camera . as_ref ( ) )
816+ . and_then ( |c| c. start_time ) ,
817+ ) ,
810818 device_id : original_segment
811819 . and_then ( |s| s. camera . as_ref ( ) )
812820 . and_then ( |c| c. device_id . clone ( ) ) ,
@@ -817,9 +825,11 @@ impl RecoveryManager {
817825 mic : if mic_path. exists ( ) {
818826 Some ( AudioMeta {
819827 path : RelativePathBuf :: from ( format ! ( "{segment_base}/audio-input.ogg" ) ) ,
820- start_time : original_segment
821- . and_then ( |s| s. mic . as_ref ( ) )
822- . and_then ( |m| m. start_time ) ,
828+ start_time : get_start_time_or_fallback (
829+ original_segment
830+ . and_then ( |s| s. mic . as_ref ( ) )
831+ . and_then ( |m| m. start_time ) ,
832+ ) ,
823833 device_id : original_segment
824834 . and_then ( |s| s. mic . as_ref ( ) )
825835 . and_then ( |m| m. device_id . clone ( ) ) ,
@@ -830,9 +840,11 @@ impl RecoveryManager {
830840 system_audio : if system_audio_path. exists ( ) {
831841 Some ( AudioMeta {
832842 path : RelativePathBuf :: from ( format ! ( "{segment_base}/system_audio.ogg" ) ) ,
833- start_time : original_segment
834- . and_then ( |s| s. system_audio . as_ref ( ) )
835- . and_then ( |a| a. start_time ) ,
843+ start_time : get_start_time_or_fallback (
844+ original_segment
845+ . and_then ( |s| s. system_audio . as_ref ( ) )
846+ . and_then ( |a| a. start_time ) ,
847+ ) ,
836848 device_id : original_segment
837849 . and_then ( |s| s. system_audio . as_ref ( ) )
838850 . and_then ( |a| a. device_id . clone ( ) ) ,
0 commit comments