WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
231621
Adopt attribution AVCaptureSession SPI for GPU process
https://bugs.webkit.org/show_bug.cgi?id=231621
Summary
Adopt attribution AVCaptureSession SPI for GPU process
Kate Cheney
Reported
2021-10-12 14:35:18 PDT
Adopt attribution AVCaptureSession SPI for GPU process
Attachments
Patch
(12.72 KB, patch)
2021-10-12 14:55 PDT
,
Kate Cheney
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(13.11 KB, patch)
2021-10-12 15:06 PDT
,
Kate Cheney
no flags
Details
Formatted Diff
Diff
Patch
(13.12 KB, patch)
2021-10-12 16:42 PDT
,
Kate Cheney
no flags
Details
Formatted Diff
Diff
Patch
(13.05 KB, patch)
2021-10-13 09:29 PDT
,
Kate Cheney
no flags
Details
Formatted Diff
Diff
Patch
(28.36 KB, patch)
2021-10-13 13:37 PDT
,
Kate Cheney
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(28.61 KB, patch)
2021-10-13 14:16 PDT
,
Kate Cheney
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(28.46 KB, patch)
2021-10-13 14:27 PDT
,
Kate Cheney
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(28.36 KB, patch)
2021-10-13 14:34 PDT
,
Kate Cheney
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(28.38 KB, patch)
2021-10-13 14:44 PDT
,
Kate Cheney
no flags
Details
Formatted Diff
Diff
Patch
(28.06 KB, patch)
2021-10-14 13:04 PDT
,
Kate Cheney
no flags
Details
Formatted Diff
Diff
Patch for landing
(29.13 KB, patch)
2021-10-14 15:59 PDT
,
Kate Cheney
no flags
Details
Formatted Diff
Diff
Patch for build fix #3
(5.67 KB, patch)
2021-10-17 14:27 PDT
,
David Kilzer (:ddkilzer)
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch for build fix #3 v2
(5.67 KB, patch)
2021-10-17 14:33 PDT
,
David Kilzer (:ddkilzer)
no flags
Details
Formatted Diff
Diff
Show Obsolete
(11)
View All
Add attachment
proposed patch, testcase, etc.
Kate Cheney
Comment 1
2021-10-12 14:55:07 PDT
Created
attachment 440988
[details]
Patch
Kate Cheney
Comment 2
2021-10-12 14:55:22 PDT
rdar://80748535
Kate Cheney
Comment 3
2021-10-12 15:06:38 PDT
Created
attachment 440994
[details]
Patch
Kate Cheney
Comment 4
2021-10-12 16:42:55 PDT
Created
attachment 441019
[details]
Patch
Kate Cheney
Comment 5
2021-10-13 09:29:11 PDT
Created
attachment 441090
[details]
Patch
Eric Carlson
Comment 6
2021-10-13 10:13:17 PDT
Comment on
attachment 441090
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=441090&action=review
> Source/WebCore/platform/mediastream/RealtimeMediaSourceCenter.h:50 > +#if USE(APPLE_INTERNAL_SDK) > +#include <TCC/TCC.h> > +#endif
#include "TCCSPI.h"
> Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm:51 > +#if USE(APPLE_INTERNAL_SDK) > +#import <AVFoundation/AVCaptureSession_Private.h> > +#endif
This should go in AVFoundationSPI.h
> Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm:60 > +@interface AVCaptureSession (AVCaptureSessionPrivate) > +- (instancetype)initWithAssumedIdentity:(tcc_identity_t)tccIdentity SPI_AVAILABLE(ios(15.0)) API_UNAVAILABLE(macos, macCatalyst, watchos, tvos); > +@end > +
Ditto
> Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:34 > +#include "TCCSoftLink.h"
It looks like this isn't needed.
Kate Cheney
Comment 7
2021-10-13 10:36:14 PDT
(In reply to Eric Carlson from
comment #6
)
> Comment on
attachment 441090
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=441090&action=review
> > > Source/WebCore/platform/mediastream/RealtimeMediaSourceCenter.h:50 > > +#if USE(APPLE_INTERNAL_SDK) > > +#include <TCC/TCC.h> > > +#endif > > #include "TCCSPI.h" >
TCCSPI.h is in WebKit, I don't think it can be included from WebCore.
> > Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm:51 > > +#if USE(APPLE_INTERNAL_SDK) > > +#import <AVFoundation/AVCaptureSession_Private.h> > > +#endif > > This should go in AVFoundationSPI.h > > > Source/WebCore/platform/mediastream/mac/AVVideoCaptureSource.mm:60 > > +@interface AVCaptureSession (AVCaptureSessionPrivate) > > +- (instancetype)initWithAssumedIdentity:(tcc_identity_t)tccIdentity SPI_AVAILABLE(ios(15.0)) API_UNAVAILABLE(macos, macCatalyst, watchos, tvos); > > +@end > > + > > Ditto
Ok. Was getting errors trying to include AVFoundationSPI.h in this file. I will try again.
> > > Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:34 > > +#include "TCCSoftLink.h" > > It looks like this isn't needed.
Oops, leftover from a previous version. Will remove.
Eric Carlson
Comment 8
2021-10-13 10:54:34 PDT
Comment on
attachment 441090
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=441090&action=review
>>> Source/WebCore/platform/mediastream/RealtimeMediaSourceCenter.h:50 >>> +#endif >> >> #include "TCCSPI.h" > > TCCSPI.h is in WebKit, I don't think it can be included from WebCore.
You can move it to PAL. `:#if USE(APPLE_INTERNAL_SDK)` should generally only be used in *SPI and *SoftLink files
Kate Cheney
Comment 9
2021-10-13 13:37:20 PDT
Created
attachment 441129
[details]
Patch
Kate Cheney
Comment 10
2021-10-13 14:16:19 PDT
Created
attachment 441133
[details]
Patch
Kate Cheney
Comment 11
2021-10-13 14:27:44 PDT
Created
attachment 441135
[details]
Patch
Kate Cheney
Comment 12
2021-10-13 14:34:31 PDT
Created
attachment 441136
[details]
Patch
Kate Cheney
Comment 13
2021-10-13 14:44:03 PDT
Created
attachment 441137
[details]
Patch
Eric Carlson
Comment 14
2021-10-14 07:12:05 PDT
Comment on
attachment 441137
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=441137&action=review
Does this work when we capture in the web process?
> Source/WebKit/GPUProcess/cocoa/GPUConnectionToWebProcessCocoa.mm:88 > +std::optional<tcc_identity_t> GPUConnectionToWebProcess::setTCCIdentityInGPUProcess() > +{ > + auto auditToken = gpuProcess().parentProcessConnection()->getAuditToken(); > + if (!auditToken) > + return std::nullopt; > + > + NSError *error = nil; > + auto bundleProxy = [LSBundleProxy bundleProxyWithAuditToken:*auditToken error:&error]; > + if (error) > + return std::nullopt; > + > + tcc_identity_t identity = nil; > + identity = tcc_identity_create(TCC_IDENTITY_CODE_BUNDLE_ID, [bundleProxy.bundleIdentifier UTF8String]); > + if (!identity) > + return std::nullopt; > + > + WebCore::RealtimeMediaSourceCenter::singleton().setIdentity(identity); > + > + return identity; > +}
This name is wrong. It is a method on GPUConnectionToWebProcess, so "InGPUProcess" is redundant, and it returns a value so the "set" prefix is confusing. Does it need to return the identity token?
> Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:353 > + WebCore::RealtimeMediaSourceCenter::singleton().setIdentity(*identity);
Doesn't setTCCIdentityInGPUProcess already do this?
Kate Cheney
Comment 15
2021-10-14 13:04:24 PDT
Created
attachment 441264
[details]
Patch
Kate Cheney
Comment 16
2021-10-14 13:18:45 PDT
(In reply to Eric Carlson from
comment #14
)
> Comment on
attachment 441137
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=441137&action=review
> > Does this work when we capture in the web process? >
When I disable GPU Process for video capture in settings I am unable to use any video capture at all so I am not able to test. This is not related to my patch as it also reproduces without it. I can add a speculative implementation but it might be better to investigate that separately and post a fix after, especially since capture in GPU Process seems to be on by default.
Eric Carlson
Comment 17
2021-10-14 15:42:40 PDT
(In reply to Kate Cheney from
comment #16
)
> > When I disable GPU Process for video capture in settings I am unable to use > any video capture at all so I am not able to test. This is not related to my > patch as it also reproduces without it. I can add a speculative > implementation but it might be better to investigate that separately and > post a fix after, especially since capture in GPU Process seems to be on by > default.
> It is on by default, but the experimental setting is exposed so in theory it should be switchable. Please add a FIXME in the place you think the fix should go (UserMediaCaptureManager::setupCaptureProcesses?).
Eric Carlson
Comment 18
2021-10-14 15:43:39 PDT
Comment on
attachment 441264
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=441264&action=review
Thanks!
> Source/WebKit/ChangeLog:14 > + (WebKit::GPUConnectionToWebProcess::setTCCIdentityInGPUProcess):
This is now incorrect.
> Source/WebKit/ChangeLog:20 > + (WebKit::UserMediaCaptureManagerProxy::ConnectionProxy::setTCCIdentityInGPUProcess):
Ditto
Kate Cheney
Comment 19
2021-10-14 15:59:39 PDT
Created
attachment 441298
[details]
Patch for landing
Kate Cheney
Comment 20
2021-10-14 15:59:52 PDT
(In reply to Eric Carlson from
comment #17
)
> (In reply to Kate Cheney from
comment #16
) > > > > When I disable GPU Process for video capture in settings I am unable to use > > any video capture at all so I am not able to test. This is not related to my > > patch as it also reproduces without it. I can add a speculative > > implementation but it might be better to investigate that separately and > > post a fix after, especially since capture in GPU Process seems to be on by > > default. > > > It is on by default, but the experimental setting is exposed so in theory it > should be switchable. > > Please add a FIXME in the place you think the fix should go > (UserMediaCaptureManager::setupCaptureProcesses?).
Added.
Kate Cheney
Comment 21
2021-10-14 16:00:07 PDT
(In reply to Eric Carlson from
comment #18
)
> Comment on
attachment 441264
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=441264&action=review
> > Thanks! > > > Source/WebKit/ChangeLog:14 > > + (WebKit::GPUConnectionToWebProcess::setTCCIdentityInGPUProcess): > > This is now incorrect. > > > Source/WebKit/ChangeLog:20 > > + (WebKit::UserMediaCaptureManagerProxy::ConnectionProxy::setTCCIdentityInGPUProcess): > > Ditto
Fixed both, thanks for the review.
EWS
Comment 22
2021-10-14 17:39:59 PDT
Committed
r284220
(
243029@main
): <
https://commits.webkit.org/243029@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 441298
[details]
.
Alex Christensen
Comment 23
2021-10-14 18:24:30 PDT
r284222
Alex Christensen
Comment 24
2021-10-14 18:34:49 PDT
Comment on
attachment 441298
[details]
Patch for landing View in context:
https://bugs.webkit.org/attachment.cgi?id=441298&action=review
> Source/WebKit/GPUProcess/cocoa/GPUConnectionToWebProcessCocoa.mm:81 > + identity = tcc_identity_create(TCC_IDENTITY_CODE_BUNDLE_ID, [bundleProxy.bundleIdentifier UTF8String]);
tcc_identity_create is annotated with OS_OBJECT_RETURNS_RETAINED, which means this is probably a memory leak. It should probably be auto identity = adoptOSObject(tcc_identity_create(...)); which means my build fix of calling tcc_identity_t will probably also need to be changed to OS_OBJECT_DECL if OS_OBJECT_USE_OBJC is defined.
David Kilzer (:ddkilzer)
Comment 25
2021-10-17 14:09:48 PDT
(In reply to EWS from
comment #22
)
> Committed
r284220
(
243029@main
): <
https://commits.webkit.org/243029@main
> > > All reviewed patches have been landed. Closing bug and clearing flags on >
attachment 441298
[details]
.
(In reply to Alex Christensen from
comment #23
)
>
r284222
Second follow-up fix by Kate for MacCatalyst:
r284251
David Kilzer (:ddkilzer)
Comment 26
2021-10-17 14:27:47 PDT
Reopening to attach new patch.
David Kilzer (:ddkilzer)
Comment 27
2021-10-17 14:27:49 PDT
Created
attachment 441549
[details]
Patch for build fix #3
David Kilzer (:ddkilzer)
Comment 28
2021-10-17 14:29:48 PDT
(In reply to David Kilzer (:ddkilzer) from
comment #27
)
> Created
attachment 441549
[details]
> Patch for build fix #3
macOS 10.15 Catalina builds are still failing internally (inlining WebKit.framework). This attempts to fix them.
David Kilzer (:ddkilzer)
Comment 29
2021-10-17 14:32:12 PDT
Comment on
attachment 441549
[details]
Patch for build fix #3 Typo: #endf
David Kilzer (:ddkilzer)
Comment 30
2021-10-17 14:33:52 PDT
Created
attachment 441550
[details]
Patch for build fix #3 v2
David Kilzer (:ddkilzer)
Comment 31
2021-10-17 14:49:47 PDT
(In reply to Alex Christensen from
comment #24
)
> Comment on
attachment 441298
[details]
> Patch for landing > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=441298&action=review
> > > Source/WebKit/GPUProcess/cocoa/GPUConnectionToWebProcessCocoa.mm:81 > > + identity = tcc_identity_create(TCC_IDENTITY_CODE_BUNDLE_ID, [bundleProxy.bundleIdentifier UTF8String]); > > tcc_identity_create is annotated with OS_OBJECT_RETURNS_RETAINED, which > means this is probably a memory leak. It should probably be auto identity = > adoptOSObject(tcc_identity_create(...)); which means my build fix of calling > tcc_identity_t will probably also need to be changed to OS_OBJECT_DECL if > OS_OBJECT_USE_OBJC is defined.
Bug 231882
: WebKit::GPUConnectionToWebProcess::setTCCIdentity() leaks a tcc_identity_t
David Kilzer (:ddkilzer)
Comment 32
2021-10-17 15:35:09 PDT
Comment on
attachment 441550
[details]
Patch for build fix #3 v2 Marking cq+ as WebKit project built on Apple Cocoa platforms.
EWS
Comment 33
2021-10-17 16:15:55 PDT
Committed
r284344
(
243138@main
): <
https://commits.webkit.org/243138@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 441550
[details]
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug