File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
crates/enc-avfoundation/src Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -452,13 +452,25 @@ impl MP4Encoder {
452452 return Err ( FinishError :: NotWriting ) ;
453453 }
454454
455+ let mut finish_timestamp = timestamp;
456+
457+ if let Some ( pause_timestamp) = self . pause_timestamp {
458+ finish_timestamp = Some ( match finish_timestamp {
459+ Some ( ts) => ts. min ( pause_timestamp) ,
460+ None => pause_timestamp,
461+ } ) ;
462+ }
463+
455464 let Some ( mut most_recent_frame) = self . most_recent_frame . take ( ) else {
456465 warn ! ( "Encoder attempted to finish with no frame" ) ;
457466 return Err ( FinishError :: NoFrames ) ;
458467 } ;
459468
469+ self . is_paused = false ;
470+ self . pause_timestamp = None ;
471+
460472 // We extend the video to the provided timestamp if possible
461- if let Some ( timestamp) = timestamp
473+ if let Some ( timestamp) = finish_timestamp
462474 && let Some ( diff) = timestamp. checked_sub ( most_recent_frame. 1 )
463475 && diff > Duration :: from_millis ( 500 )
464476 {
You can’t perform that action at this time.
0 commit comments