File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,7 +25,8 @@ struct VideoFrameInfo {
2525 // padding, resize letterboxing), so this is part of the contract.
2626 LogicalRect contentRect;
2727 // Presentation timestamp mapped onto steady_clock (not delivery time), so
28- // frame age reflects how old the pixels actually are.
28+ // frame age reflects how old the pixels actually are. macOS can deliver a
29+ // frame before its display time, which makes this a few ms in the future.
2930 std::chrono::steady_clock::time_point capturedAt;
3031};
3132
Original file line number Diff line number Diff line change @@ -209,13 +209,15 @@ - (void)streamDidBecomeInactive:(SCStream*)stream {
209209 return value;
210210}
211211
212- std::expected<SCShareableContent*, Error> fetchShareableContent () {
212+ std::expected<SCShareableContent*, Error> fetchShareableContent (
213+ const BOOL isOnScreenOnly = YES
214+ ) {
213215 dispatch_semaphore_t semaphore = dispatch_semaphore_create (0 );
214216 __block SCShareableContent* content = nil ;
215217 __block NSError * error = nil ;
216218 [SCShareableContent
217219 getShareableContentExcludingDesktopWindows: YES
218- onScreenWindowsOnly: YES
220+ onScreenWindowsOnly: isOnScreenOnly
219221 completionHandler: ^(
220222 SCShareableContent* result, NSError * err
221223 ) {
@@ -538,7 +540,9 @@ void stop() override {
538540 );
539541 }
540542
541- auto contentResult = fetchShareableContent ();
543+ // Includes windows not on screen yet: a caller that creates its overlay just
544+ // before streaming would otherwise not be listed, and so not be excluded.
545+ auto contentResult = fetchShareableContent (NO );
542546 if (!contentResult) return std::unexpected (contentResult.error ());
543547
544548 SCDisplay* scDisplay = nil ;
You can’t perform that action at this time.
0 commit comments