File tree Expand file tree Collapse file tree
recording/src/sources/screen_capture Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,6 +57,26 @@ macro_rules! fail_err {
5757 }
5858 } ;
5959}
60+ #[ macro_export]
61+ macro_rules! fail_ret {
62+ ( $name: literal) => {
63+ #[ cfg( debug_assertions) ]
64+ {
65+ const NAME : & ' static str = concat!( env!( "CARGO_PKG_NAME" ) , "::" , $name) ;
66+
67+ $crate:: private:: inventory:: submit! {
68+ $crate:: Fail { name: NAME }
69+ }
70+
71+ let should_fail = $crate:: private:: should_fail( NAME ) ;
72+
73+ if should_fail {
74+ eprintln!( "Purposely returned at '{NAME}'" ) ;
75+ return ;
76+ }
77+ }
78+ } ;
79+ }
6080
6181#[ doc( hidden) ]
6282pub mod private {
Original file line number Diff line number Diff line change @@ -178,14 +178,7 @@ impl ScreenCaptureConfig<CMSampleBufferCapture> {
178178
179179 video_frame_count. fetch_add ( 1 , atomic:: Ordering :: Relaxed ) ;
180180
181- let check_skip_send = || {
182- cap_fail:: fail_err!(
183- "media::sources::screen_capture::skip_send" ,
184- ( )
185- ) ;
186-
187- Ok :: < ( ) , ( ) > ( ( ) )
188- } ;
181+ cap_fail:: fail_ret!( "screen_capture vidoe skip" ) ;
189182
190183 let _ = video_tx. try_send ( VideoFrame {
191184 sample_buf : sample_buffer. retained ( ) ,
@@ -195,13 +188,7 @@ impl ScreenCaptureConfig<CMSampleBufferCapture> {
195188 scap_screencapturekit:: Frame :: Audio ( _) => {
196189 use ffmpeg:: ChannelLayout ;
197190
198- let res = || {
199- cap_fail:: fail_err!( "screen_capture audio skip" , ( ) ) ;
200- Ok :: < ( ) , ( ) > ( ( ) )
201- } ;
202- if res ( ) . is_err ( ) {
203- return ;
204- }
191+ cap_fail:: fail_ret!( "screen_capture audio skip" ) ;
205192
206193 let Some ( audio_tx) = & mut audio_tx else {
207194 return ;
@@ -377,7 +364,7 @@ impl output_pipeline::VideoSource for VideoSource {
377364 let video_frame_count = self . video_frame_counter . clone ( ) ;
378365 async move {
379366 loop {
380- tokio:: time:: sleep ( Duration :: from_secs ( 3 ) ) . await ;
367+ tokio:: time:: sleep ( Duration :: from_secs ( 5 ) ) . await ;
381368 debug ! (
382369 "Captured {} frames" ,
383370 video_frame_count. load( atomic:: Ordering :: Relaxed )
Original file line number Diff line number Diff line change @@ -254,7 +254,7 @@ impl output_pipeline::VideoSource for VideoSource {
254254 let video_frame_count = video_frame_counter. clone ( ) ;
255255 async move {
256256 loop {
257- tokio:: time:: sleep ( Duration :: from_secs ( 3 ) ) . await ;
257+ tokio:: time:: sleep ( Duration :: from_secs ( 5 ) ) . await ;
258258 debug ! (
259259 "Captured {} frames" ,
260260 video_frame_count. load( atomic:: Ordering :: Relaxed )
You can’t perform that action at this time.
0 commit comments