I'm using screenCaptureKit for winodow capture.
I build a filter like follow code, (I'm not usng independent window filter, because sometime I need capture multi windows in the same time)
filter = [[SCContentFilter alloc] initWithDisplay:displayID
includingWindows:includingWindows];
At begining, the capture works OK.
When the target window's size or position changed, my code monitored this change and called updateConfiguration like below , I got completionHandler without error.
[streamConfiguration setSourceRect:newRect];
[streamConfiguration setWidth:newWidth];
[streamConfiguration setHeight:newHeight];
[scStream updateConfiguration:streamConfiguration
completionHandler:^(NSError *_Nullable error) {
if (error) {
// some error log
} else {
// update done
}
}];
But sometimes, it still output frame with old size, and the rect is still the old.
And int some other cases, it works fine.....
Is there any special work before call updateConfiguration to make it work ?
Post
Replies
Boosts
Views
Activity
Start carpture window A, it works fine.
After some time, I want to switch to capture window B without stop the scstream. My code is like this :
content_filter = [[SCContentFilter alloc] initWithDesktopIndependentWindow:winID_B];
[scStream_ updateContentFilter:content_filter
completionHandler:^(NSError *_Nullable error) {
if (error) {
"some error log"
} else {
"update OK"
}
}];
I cant get the "update OK" log, but sometimes it still output frame of the old window A.
Is there any special operation need do before call updateContentFilter ? Or, is my usage is not correct ?
I found that didOutputSampleBuffer would not be called for long time when the screen is no change. It sometimes make me confused for if there something wrong.
In my design, it will change to other screen shot method, such as CGWindowListCreateImage, when long time no data. But this is not what I expected.
I set the minimumFrameInterval to 30 but it seems no work.
[config setMinimumFrameInterval:CMTimeMake(1, 30)];
Is there any settings that can let me get a didOutputSampleBuffer, even given a CMSampleBufferRef with status SCFrameStatusIdle, called atlest one time per second? Which would make me think it works fine without any exception.