File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
crates/recording/src/output_pipeline Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,8 @@ impl Muxer for AVFoundationMp4Muxer {
6363impl VideoMuxer for AVFoundationMp4Muxer {
6464 type VideoFrame = screen_capture:: VideoFrame ;
6565
66+ const MAX_QUEUE_RETRIES : u32 = 500 ;
67+
6668 fn send_video_frame (
6769 & mut self ,
6870 frame : Self :: VideoFrame ,
@@ -76,10 +78,18 @@ impl VideoMuxer for AVFoundationMp4Muxer {
7678 mp4. resume ( ) ;
7779 }
7880
81+ let mut retry_count = 0 ;
7982 loop {
8083 match mp4. queue_video_frame ( frame. sample_buf . clone ( ) , timestamp) {
8184 Ok ( ( ) ) => break ,
8285 Err ( QueueFrameError :: NotReadyForMore ) => {
86+ retry_count += 1 ;
87+ if retry_count >= Self :: MAX_QUEUE_RETRIES {
88+ return Err ( anyhow ! (
89+ "send_video_frame/timeout after {} retries" ,
90+ Self :: MAX_QUEUE_RETRIES
91+ ) ) ;
92+ }
8393 std:: thread:: sleep ( Duration :: from_millis ( 2 ) ) ;
8494 continue ;
8595 }
You can’t perform that action at this time.
0 commit comments