1
1
use super :: * ;
2
2
use cidre:: * ;
3
3
use kameo:: prelude:: * ;
4
+ use tracing:: { debug, info, trace} ;
4
5
5
6
#[ derive( Debug ) ]
6
7
pub struct CMSampleBufferCapture ;
@@ -122,6 +123,8 @@ impl PipelineSourceTask for ScreenCaptureSource<CMSampleBufferCapture> {
122
123
ready_signal : crate :: pipeline:: task:: PipelineReadySignal ,
123
124
control_signal : crate :: pipeline:: control:: PipelineControlSignal ,
124
125
) -> Result < ( ) , String > {
126
+ trace ! ( "PipelineSourceTask::run" ) ;
127
+
125
128
let video_tx = self . video_tx . clone ( ) ;
126
129
let audio_tx = self . audio_tx . clone ( ) ;
127
130
let config = self . config . clone ( ) ;
@@ -140,6 +143,8 @@ impl PipelineSourceTask for ScreenCaptureSource<CMSampleBufferCapture> {
140
143
. await
141
144
. ok_or_else ( || SourceError :: AsContentFilter ) ?;
142
145
146
+ debug ! ( "SCK content filter: {:?}" , content_filter) ;
147
+
143
148
let size = {
144
149
let logical_size = config
145
150
. crop_bounds
@@ -153,7 +158,7 @@ impl PipelineSourceTask for ScreenCaptureSource<CMSampleBufferCapture> {
153
158
PhysicalSize :: new ( logical_size. width ( ) * scale, logical_size. height ( ) * scale)
154
159
} ;
155
160
156
- tracing :: info !( "size: {:?}" , size) ;
161
+ debug ! ( "size: {:?}" , size) ;
157
162
158
163
let mut settings = scap_screencapturekit:: StreamCfgBuilder :: default ( )
159
164
. with_width ( size. width ( ) as usize )
@@ -167,7 +172,7 @@ impl PipelineSourceTask for ScreenCaptureSource<CMSampleBufferCapture> {
167
172
settings. set_color_space_name ( cg:: color_space:: names:: srgb ( ) ) ;
168
173
169
174
if let Some ( crop_bounds) = config. crop_bounds {
170
- tracing :: info !( "crop bounds: {:?}" , crop_bounds) ;
175
+ debug ! ( "crop bounds: {:?}" , crop_bounds) ;
171
176
settings. set_src_rect ( cg:: Rect :: new (
172
177
crop_bounds. position ( ) . x ( ) ,
173
178
crop_bounds. position ( ) . y ( ) ,
@@ -178,6 +183,8 @@ impl PipelineSourceTask for ScreenCaptureSource<CMSampleBufferCapture> {
178
183
179
184
let ( error_tx, error_rx) = flume:: bounded ( 1 ) ;
180
185
186
+ trace ! ( "Spawning ScreenCaptureActor" ) ;
187
+
181
188
let capturer = ScreenCaptureActor :: spawn (
182
189
ScreenCaptureActor :: new (
183
190
content_filter,
@@ -188,11 +195,15 @@ impl PipelineSourceTask for ScreenCaptureSource<CMSampleBufferCapture> {
188
195
. map_err ( SourceError :: CreateActor ) ?,
189
196
) ;
190
197
198
+ info ! ( "Spawned ScreenCaptureActor" ) ;
199
+
191
200
capturer
192
201
. ask ( StartCapturing )
193
202
. await
194
203
. map_err ( SourceError :: StartCapturing ) ?;
195
204
205
+ info ! ( "Started capturing" ) ;
206
+
196
207
let _ = ready_signal. send ( Ok ( ( ) ) ) ;
197
208
198
209
let stop = async move {
@@ -307,15 +318,21 @@ impl Message<StartCapturing> for ScreenCaptureActor {
307
318
_: StartCapturing ,
308
319
_: & mut Context < Self , Self :: Reply > ,
309
320
) -> Self :: Reply {
321
+ trace ! ( "ScreenCaptureActor.StartCapturing" ) ;
322
+
310
323
if self . capturing {
311
324
return Err ( StartCapturingError :: AlreadyCapturing ) ;
312
325
}
313
326
327
+ trace ! ( "Starting SCK capturer" ) ;
328
+
314
329
self . capturer
315
330
. start ( )
316
331
. await
317
332
. map_err ( StartCapturingError :: Start ) ?;
318
333
334
+ info ! ( "Started SCK capturer" ) ;
335
+
319
336
self . capturing = true ;
320
337
321
338
Ok ( ( ) )
@@ -330,6 +347,8 @@ impl Message<StopCapturing> for ScreenCaptureActor {
330
347
_: StopCapturing ,
331
348
_: & mut Context < Self , Self :: Reply > ,
332
349
) -> Self :: Reply {
350
+ trace ! ( "ScreenCaptureActor.StopCapturing" ) ;
351
+
333
352
if !self . capturing {
334
353
return Err ( StopCapturingError :: NotCapturing ) ;
335
354
} ;
0 commit comments