@@ -341,7 +341,7 @@ impl RecordingSession {
341341 self . config . screen_logical_size . width as u32 ,
342342 self . config . screen_logical_size . height as u32 ,
343343 ) ;
344- let h264_writer = if self . config . enable_preview_mode {
344+ let h264_writer = if self . config . disable_save_file {
345345 None
346346 } else {
347347 Some ( H264Writer :: new (
@@ -363,6 +363,10 @@ impl RecordingSession {
363363 loop {
364364 match encoder_receiver. recv ( ) {
365365 Ok ( ( total_frame_index, img) ) => {
366+ if self . config . disable_save_file {
367+ continue ;
368+ }
369+
366370 let now = std:: time:: Instant :: now ( ) ;
367371 match video_encoder. encode_frame ( img. into ( ) ) {
368372 Ok ( EncodedFrame :: Frame ( ( _, encoded_frame) ) ) => {
@@ -429,7 +433,7 @@ impl RecordingSession {
429433 audio_recorder,
430434 device_name,
431435 audio_file_path,
432- self . config . enable_preview_mode ,
436+ self . config . disable_save_file ,
433437 )
434438 . map_err ( |e : AudioError | RecorderError :: AudioError ( e. to_string ( ) ) ) ?;
435439
@@ -453,9 +457,9 @@ impl RecordingSession {
453457 } ;
454458
455459 let amplification = self . config . speaker_amplification . clone ( ) ;
456- let enable_preview_mode = self . config . enable_preview_mode ;
460+ let disable_save_file = self . config . disable_save_file ;
457461 let handle = thread:: spawn ( move || {
458- let recorder = SpeakerRecorder :: new ( save_path, stop_sig, sender, enable_preview_mode )
462+ let recorder = SpeakerRecorder :: new ( save_path, stop_sig, sender, disable_save_file )
459463 . map_err ( |e| RecorderError :: SpeakerError ( e. to_string ( ) ) ) ?;
460464
461465 let recorder = if amplification. is_some ( ) {
@@ -485,7 +489,7 @@ impl RecordingSession {
485489 resolution : Resolution ,
486490 total_frame_count : Arc < AtomicU64 > ,
487491 loss_frame_count : Arc < AtomicU64 > ,
488- enable_previwe_model : bool ,
492+ enable_preview_mode : bool ,
489493 ) -> Vec < JoinHandle < ( ) > > {
490494 let mut thread_handles = vec ! [ ] ;
491495 let ( collect_sender, collect_receiver) = bounded ( ENCODER_WORKER_CHANNEL_SIZE ) ;
@@ -503,7 +507,6 @@ impl RecordingSession {
503507 collect_receiver,
504508 encoder_sender,
505509 loss_frame_count. clone ( ) ,
506- enable_previwe_model,
507510 ) ) ;
508511
509512 thread_handles. push ( Self :: resize_forward_worker (
@@ -513,6 +516,7 @@ impl RecordingSession {
513516 start_time,
514517 total_frame_count,
515518 loss_frame_count,
519+ enable_preview_mode,
516520 ) ) ;
517521
518522 thread_handles
@@ -574,7 +578,6 @@ impl RecordingSession {
574578 collect_receiver : Receiver < ( usize , u64 , ResizedImageBuffer ) > ,
575579 encoder_sender : Sender < EncoderChannelData > ,
576580 loss_frame_count : Arc < AtomicU64 > ,
577- enable_previwe_model : bool ,
578581 ) -> JoinHandle < ( ) > {
579582 let loss_frame_count_clone = loss_frame_count. clone ( ) ;
580583 let handle = thread:: spawn ( move || {
@@ -585,10 +588,6 @@ impl RecordingSession {
585588 loop {
586589 match collect_receiver. recv ( ) {
587590 Ok ( ( thread_index, total_frame_index, img) ) => {
588- if enable_previwe_model {
589- continue ;
590- }
591-
592591 // log::debug!("+++ {total_frame_index} - {expect_total_frame_index}");
593592 if expect_total_frame_index == total_frame_index {
594593 disorder_frame_counts = 0 ;
@@ -671,6 +670,7 @@ impl RecordingSession {
671670 start_time : Instant ,
672671 total_frame_count : Arc < AtomicU64 > ,
673672 loss_frame_count : Arc < AtomicU64 > ,
673+ enable_preview_mode : bool ,
674674 ) -> JoinHandle < ( ) > {
675675 let mut fps_counter = SimpleFpsCounter :: new ( ) ;
676676
@@ -701,7 +701,12 @@ impl RecordingSession {
701701 total_frames : total_frame_count,
702702 loss_frames : loss_frame_count. load ( Ordering :: Relaxed ) ,
703703 } ,
704- frame : frame. clone ( ) ,
704+
705+ frame : if enable_preview_mode {
706+ Some ( frame. clone ( ) )
707+ } else {
708+ None
709+ } ,
705710 } ;
706711 if let Err ( e) = sender. try_send ( frame_user) {
707712 log:: warn!( "try send frame to user frame channel failed: {e}" ) ;
@@ -752,7 +757,7 @@ impl RecordingSession {
752757 if let Err ( e) = audio_recorder. stop ( ) {
753758 log:: warn!( "Failed to stop audio recording: {}" , e) ;
754759 } else {
755- if !self . config . enable_preview_mode {
760+ if !self . config . disable_save_file {
756761 log:: info!(
757762 "Successfully save audio recorder file: {}" ,
758763 self . config
@@ -810,7 +815,7 @@ impl RecordingSession {
810815 writer. finish ( ) ?;
811816 }
812817
813- if !self . config . enable_preview_mode {
818+ if !self . config . disable_save_file {
814819 let tmp_output_file = self
815820 . config
816821 . output_path
0 commit comments