Skip to content

Commit

Permalink
Account for identity in UserMediaCaptureManagerProxy::startProducingD…
Browse files Browse the repository at this point in the history
…ata for camera

https://bugs.webkit.org/show_bug.cgi?id=270995
rdar://124631514

Reviewed by Eric Carlson.

When media environment is not available, we can still rely on identity safely.
The camera check is only accounting for media environment so we update it to check for identity as well,
so that it does not unnecessarily fail capture.

* Source/WebCore/platform/mediastream/RealtimeMediaSourceCenter.h:
* Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
(WebKit::UserMediaCaptureManagerProxy::startProducingData):

Canonical link: https://commits.webkit.org/276147@main
  • Loading branch information
youennf committed Mar 15, 2024
1 parent 53d402b commit 448446e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ class WEBCORE_EXPORT RealtimeMediaSourceCenter : public ThreadSafeRefCounted<Rea
#if ENABLE(APP_PRIVACY_REPORT)
void setIdentity(OSObjectPtr<tcc_identity_t>&& identity) { m_identity = WTFMove(identity); }
OSObjectPtr<tcc_identity_t> identity() const { return m_identity; }
bool hasIdentity() const { return !!m_identity; }
#endif

#if ENABLE(EXTENSION_CAPABILITIES)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -572,8 +572,8 @@ void UserMediaCaptureManagerProxy::startProducingData(RealtimeMediaSourceIdentif
m_connectionProxy->setTCCIdentity();
#endif
#if ENABLE(EXTENSION_CAPABILITIES)
bool hasValidMediaEnvironment = m_connectionProxy->setCurrentMediaEnvironment(pageIdentifier);
if (!hasValidMediaEnvironment && proxy->source().deviceType() == CaptureDevice::DeviceType::Camera && WTF::processHasEntitlement("com.apple.developer.web-browser-engine.rendering"_s)) {
bool hasValidMediaEnvironmentOrIdentity = m_connectionProxy->setCurrentMediaEnvironment(pageIdentifier) || RealtimeMediaSourceCenter::singleton().hasIdentity();
if (!hasValidMediaEnvironmentOrIdentity && proxy->source().deviceType() == CaptureDevice::DeviceType::Camera && WTF::processHasEntitlement("com.apple.developer.web-browser-engine.rendering"_s)) {
RELEASE_LOG_ERROR(WebRTC, "Unable to set media environment, failing capture.");
proxy->source().captureFailed();
return;
Expand Down

0 comments on commit 448446e

Please sign in to comment.