11use super :: * ;
22use cidre:: * ;
33use kameo:: prelude:: * ;
4+ use tracing:: { debug, info, trace} ;
45
56#[ derive( Debug ) ]
67pub struct CMSampleBufferCapture ;
@@ -122,6 +123,8 @@ impl PipelineSourceTask for ScreenCaptureSource<CMSampleBufferCapture> {
122123 ready_signal : crate :: pipeline:: task:: PipelineReadySignal ,
123124 control_signal : crate :: pipeline:: control:: PipelineControlSignal ,
124125 ) -> Result < ( ) , String > {
126+ trace ! ( "PipelineSourceTask::run" ) ;
127+
125128 let video_tx = self . video_tx . clone ( ) ;
126129 let audio_tx = self . audio_tx . clone ( ) ;
127130 let config = self . config . clone ( ) ;
@@ -140,6 +143,8 @@ impl PipelineSourceTask for ScreenCaptureSource<CMSampleBufferCapture> {
140143 . await
141144 . ok_or_else ( || SourceError :: AsContentFilter ) ?;
142145
146+ debug ! ( "SCK content filter: {:?}" , content_filter) ;
147+
143148 let size = {
144149 let logical_size = config
145150 . crop_bounds
@@ -153,7 +158,7 @@ impl PipelineSourceTask for ScreenCaptureSource<CMSampleBufferCapture> {
153158 PhysicalSize :: new ( logical_size. width ( ) * scale, logical_size. height ( ) * scale)
154159 } ;
155160
156- tracing :: info !( "size: {:?}" , size) ;
161+ debug ! ( "size: {:?}" , size) ;
157162
158163 let mut settings = scap_screencapturekit:: StreamCfgBuilder :: default ( )
159164 . with_width ( size. width ( ) as usize )
@@ -167,7 +172,7 @@ impl PipelineSourceTask for ScreenCaptureSource<CMSampleBufferCapture> {
167172 settings. set_color_space_name ( cg:: color_space:: names:: srgb ( ) ) ;
168173
169174 if let Some ( crop_bounds) = config. crop_bounds {
170- tracing :: info !( "crop bounds: {:?}" , crop_bounds) ;
175+ debug ! ( "crop bounds: {:?}" , crop_bounds) ;
171176 settings. set_src_rect ( cg:: Rect :: new (
172177 crop_bounds. position ( ) . x ( ) ,
173178 crop_bounds. position ( ) . y ( ) ,
@@ -178,6 +183,8 @@ impl PipelineSourceTask for ScreenCaptureSource<CMSampleBufferCapture> {
178183
179184 let ( error_tx, error_rx) = flume:: bounded ( 1 ) ;
180185
186+ trace ! ( "Spawning ScreenCaptureActor" ) ;
187+
181188 let capturer = ScreenCaptureActor :: spawn (
182189 ScreenCaptureActor :: new (
183190 content_filter,
@@ -188,11 +195,15 @@ impl PipelineSourceTask for ScreenCaptureSource<CMSampleBufferCapture> {
188195 . map_err ( SourceError :: CreateActor ) ?,
189196 ) ;
190197
198+ info ! ( "Spawned ScreenCaptureActor" ) ;
199+
191200 capturer
192201 . ask ( StartCapturing )
193202 . await
194203 . map_err ( SourceError :: StartCapturing ) ?;
195204
205+ info ! ( "Started capturing" ) ;
206+
196207 let _ = ready_signal. send ( Ok ( ( ) ) ) ;
197208
198209 let stop = async move {
@@ -307,15 +318,21 @@ impl Message<StartCapturing> for ScreenCaptureActor {
307318 _: StartCapturing ,
308319 _: & mut Context < Self , Self :: Reply > ,
309320 ) -> Self :: Reply {
321+ trace ! ( "ScreenCaptureActor.StartCapturing" ) ;
322+
310323 if self . capturing {
311324 return Err ( StartCapturingError :: AlreadyCapturing ) ;
312325 }
313326
327+ trace ! ( "Starting SCK capturer" ) ;
328+
314329 self . capturer
315330 . start ( )
316331 . await
317332 . map_err ( StartCapturingError :: Start ) ?;
318333
334+ info ! ( "Started SCK capturer" ) ;
335+
319336 self . capturing = true ;
320337
321338 Ok ( ( ) )
@@ -330,6 +347,8 @@ impl Message<StopCapturing> for ScreenCaptureActor {
330347 _: StopCapturing ,
331348 _: & mut Context < Self , Self :: Reply > ,
332349 ) -> Self :: Reply {
350+ trace ! ( "ScreenCaptureActor.StopCapturing" ) ;
351+
333352 if !self . capturing {
334353 return Err ( StopCapturingError :: NotCapturing ) ;
335354 } ;
0 commit comments