Diff
Modified: trunk/Source/WebCore/ChangeLog (283368 => 283369)
--- trunk/Source/WebCore/ChangeLog 2021-10-01 15:28:34 UTC (rev 283368)
+++ trunk/Source/WebCore/ChangeLog 2021-10-01 15:34:21 UTC (rev 283369)
@@ -1,3 +1,14 @@
+2021-10-01 Youenn Fablet <you...@apple.com>
+
+ Attribute IOSurfaces created by camera and decoders to responsible WebProcess
+ https://bugs.webkit.org/show_bug.cgi?id=231075
+
+ Reviewed by Chris Dumez.
+
+ Manually tested.
+
+ * platform/graphics/RemoteVideoSample.h:
+
2021-10-01 Antti Koivisto <an...@apple.com>
Rename InlineIterator to LegacyInlineIterator
Modified: trunk/Source/WebCore/platform/graphics/RemoteVideoSample.h (283368 => 283369)
--- trunk/Source/WebCore/platform/graphics/RemoteVideoSample.h 2021-10-01 15:28:34 UTC (rev 283368)
+++ trunk/Source/WebCore/platform/graphics/RemoteVideoSample.h 2021-10-01 15:34:21 UTC (rev 283369)
@@ -48,6 +48,10 @@
WEBCORE_EXPORT static std::unique_ptr<RemoteVideoSample> create(RetainPtr<CVPixelBufferRef>&&, MediaTime&& presentationTime, MediaSample::VideoRotation = MediaSample::VideoRotation::None);
WEBCORE_EXPORT IOSurfaceRef surface() const;
+#if HAVE(IOSURFACE_SET_OWNERSHIP_IDENTITY)
+ void setOwnershipIdentity(task_id_token_t newOwner);
+#endif
+
const MediaTime& time() const { return m_time; }
uint32_t videoFormat() const { return m_videoFormat; }
IntSize size() const { return m_size; }
@@ -115,6 +119,14 @@
bool m_mirrored { false };
};
+#if HAVE(IOSURFACE_SET_OWNERSHIP_IDENTITY)
+inline void RemoteVideoSample::setOwnershipIdentity(task_id_token_t newOwner)
+{
+ if (m_ioSurface)
+ m_ioSurface->setOwnershipIdentity(newOwner);
}
+#endif
+}
+
#endif // ENABLE(MEDIA_STREAM)
Modified: trunk/Source/WebKit/ChangeLog (283368 => 283369)
--- trunk/Source/WebKit/ChangeLog 2021-10-01 15:28:34 UTC (rev 283368)
+++ trunk/Source/WebKit/ChangeLog 2021-10-01 15:34:21 UTC (rev 283369)
@@ -1,3 +1,17 @@
+2021-10-01 Youenn Fablet <you...@apple.com>
+
+ Attribute IOSurfaces created by camera and decoders to responsible WebProcess
+ https://bugs.webkit.org/show_bug.cgi?id=231075
+
+ Reviewed by Chris Dumez.
+
+ Make sure to mark camera and decoder generated IOSurfaces as owned by the responsible WebProcess.
+
+ * GPUProcess/GPUConnectionToWebProcess.cpp:
+ * GPUProcess/webrtc/LibWebRTCCodecsProxy.mm:
+ * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
+ * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
+
2021-10-01 Carlos Garcia Campos <cgar...@igalia.com>
[GTK][a11y] Add initial implementation of accessible interface when building with ATSPI
Modified: trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp (283368 => 283369)
--- trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp 2021-10-01 15:28:34 UTC (rev 283368)
+++ trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp 2021-10-01 15:34:21 UTC (rev 283369)
@@ -188,6 +188,13 @@
return m_process.setCaptureAttributionString();
}
+#if HAVE(IOSURFACE_SET_OWNERSHIP_IDENTITY)
+ std::optional<task_id_token_t> webProcessIdentityToken() const final
+ {
+ return m_process.webProcessIdentityToken();
+ }
+#endif
+
GPUConnectionToWebProcess& m_process;
};
Modified: trunk/Source/WebKit/GPUProcess/webrtc/LibWebRTCCodecsProxy.mm (283368 => 283369)
--- trunk/Source/WebKit/GPUProcess/webrtc/LibWebRTCCodecsProxy.mm 2021-10-01 15:28:34 UTC (rev 283368)
+++ trunk/Source/WebKit/GPUProcess/webrtc/LibWebRTCCodecsProxy.mm 2021-10-01 15:34:21 UTC (rev 283369)
@@ -74,15 +74,28 @@
});
}
+static Function<void(CVPixelBufferRef pixelBuffer, uint32_t timeStampNs, uint32_t timeStamp)> createDecoderCallback(RTCDecoderIdentifier identifier, GPUConnectionToWebProcess& gpuConnectionToWebProcess)
+{
+ return [connection = Ref { gpuConnectionToWebProcess.connection() },
+#if HAVE(IOSURFACE_SET_OWNERSHIP_IDENTITY)
+ token = gpuConnectionToWebProcess.webProcessIdentityToken(),
+#endif
+ identifier](CVPixelBufferRef pixelBuffer, uint32_t timeStampNs, uint32_t timeStamp) {
+ if (auto sample = WebCore::RemoteVideoSample::create(pixelBuffer, MediaTime(timeStampNs, 1))) {
+#if HAVE(IOSURFACE_SET_OWNERSHIP_IDENTITY)
+ sample->setOwnershipIdentity(token);
+#endif
+ connection->send(Messages::LibWebRTCCodecs::CompletedDecoding { identifier, timeStamp, *sample }, 0);
+ }
+ };
+}
+
void LibWebRTCCodecsProxy::createH264Decoder(RTCDecoderIdentifier identifier)
{
ASSERT(!isMainRunLoop());
Locker locker { m_lock };
ASSERT(!m_decoders.contains(identifier));
- m_decoders.add(identifier, webrtc::createLocalH264Decoder(makeBlockPtr([connection = Ref { m_gpuConnectionToWebProcess.connection() }, identifier](CVPixelBufferRef pixelBuffer, uint32_t timeStampNs, uint32_t timeStamp) {
- if (auto sample = WebCore::RemoteVideoSample::create(pixelBuffer, MediaTime(timeStampNs, 1)))
- connection->send(Messages::LibWebRTCCodecs::CompletedDecoding { identifier, timeStamp, *sample }, 0);
- }).get()));
+ m_decoders.add(identifier, webrtc::createLocalH264Decoder(makeBlockPtr(createDecoderCallback(identifier, m_gpuConnectionToWebProcess)).get()));
}
void LibWebRTCCodecsProxy::createH265Decoder(RTCDecoderIdentifier identifier)
@@ -90,10 +103,7 @@
ASSERT(!isMainRunLoop());
Locker locker { m_lock };
ASSERT(!m_decoders.contains(identifier));
- m_decoders.add(identifier, webrtc::createLocalH265Decoder(makeBlockPtr([connection = Ref { m_gpuConnectionToWebProcess.connection() }, identifier](CVPixelBufferRef pixelBuffer, uint32_t timeStampNs, uint32_t timeStamp) {
- if (auto sample = WebCore::RemoteVideoSample::create(pixelBuffer, MediaTime(timeStampNs, 1)))
- connection->send(Messages::LibWebRTCCodecs::CompletedDecoding { identifier, timeStamp, *sample }, 0);
- }).get()));
+ m_decoders.add(identifier, webrtc::createLocalH265Decoder(makeBlockPtr(createDecoderCallback(identifier, m_gpuConnectionToWebProcess)).get()));
}
void LibWebRTCCodecsProxy::createVP9Decoder(RTCDecoderIdentifier identifier)
@@ -101,10 +111,7 @@
ASSERT(!isMainRunLoop());
Locker locker { m_lock };
ASSERT(!m_decoders.contains(identifier));
- m_decoders.add(identifier, webrtc::createLocalVP9Decoder(makeBlockPtr([connection = Ref { m_gpuConnectionToWebProcess.connection() }, identifier](CVPixelBufferRef pixelBuffer, uint32_t timeStampNs, uint32_t timeStamp) {
- if (auto sample = WebCore::RemoteVideoSample::create(pixelBuffer, MediaTime(timeStampNs, 1)))
- connection->send(Messages::LibWebRTCCodecs::CompletedDecoding { identifier, timeStamp, *sample }, 0);
- }).get()));
+ m_decoders.add(identifier, webrtc::createLocalVP9Decoder(makeBlockPtr(createDecoderCallback(identifier, m_gpuConnectionToWebProcess)).get()));
}
void LibWebRTCCodecsProxy::releaseDecoder(RTCDecoderIdentifier identifier)
Modified: trunk/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp (283368 => 283369)
--- trunk/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp 2021-10-01 15:28:34 UTC (rev 283368)
+++ trunk/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp 2021-10-01 15:34:21 UTC (rev 283369)
@@ -125,6 +125,9 @@
}
void setShouldApplyRotation(bool shouldApplyRotation) { m_shouldApplyRotation = true; }
+#if HAVE(IOSURFACE_SET_OWNERSHIP_IDENTITY)
+ void setWebProcessIdentityToken(std::optional<task_id_token_t> token) { m_webProcessIdentityToken = token;}
+#endif
private:
void sourceStopped() final {
@@ -184,8 +187,13 @@
remoteSample = RemoteVideoSample::create(pixelBuffer.get(), sample.presentationTime());
} else
remoteSample = RemoteVideoSample::create(sample);
- if (remoteSample)
+ if (remoteSample) {
+#if HAVE(IOSURFACE_SET_OWNERSHIP_IDENTITY)
+ if (m_webProcessIdentityToken)
+ remoteSample->setOwnershipIdentity(*m_webProcessIdentityToken);
+#endif
m_connection->send(Messages::RemoteCaptureSampleManager::VideoSampleAvailable(m_id, WTFMove(*remoteSample)), 0);
+ }
}
RetainPtr<CVPixelBufferRef> rotatePixelBuffer(MediaSample& sample)
@@ -249,6 +257,9 @@
size_t m_frameChunkSize { 0 };
MediaTime m_startTime;
bool m_shouldReset { false };
+#if HAVE(TASK_IDENTITY_TOKEN)
+ std::optional<task_id_token_t> m_webProcessIdentityToken;
+#endif
};
UserMediaCaptureManagerProxy::UserMediaCaptureManagerProxy(UniqueRef<ConnectionProxy>&& connectionProxy)
@@ -312,11 +323,16 @@
}
ASSERT(!m_proxies.contains(id));
- m_proxies.add(id, makeUnique<SourceProxy>(id, m_connectionProxy->connection(), WTFMove(source)));
+ auto proxy = makeUnique<SourceProxy>(id, m_connectionProxy->connection(), WTFMove(source));
+#if HAVE(IOSURFACE_SET_OWNERSHIP_IDENTITY)
+ if (device.type() != WebCore::CaptureDevice::DeviceType::Microphone)
+ proxy->setWebProcessIdentityToken(m_connectionProxy->webProcessIdentityToken());
+#endif
+
+ m_proxies.add(id, WTFMove(proxy));
} else
invalidConstraints = WTFMove(sourceOrError.errorMessage);
-
completionHandler(succeeded, invalidConstraints, WTFMove(settings), WTFMove(capabilities), WTFMove(presets), size, frameRate);
}
Modified: trunk/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.h (283368 => 283369)
--- trunk/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.h 2021-10-01 15:28:34 UTC (rev 283368)
+++ trunk/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.h 2021-10-01 15:34:21 UTC (rev 283369)
@@ -58,6 +58,9 @@
virtual bool willStartCapture(WebCore::CaptureDevice::DeviceType) const = 0;
virtual Logger& logger() = 0;
virtual bool setCaptureAttributionString() { return true; }
+#if HAVE(IOSURFACE_SET_OWNERSHIP_IDENTITY)
+ virtual std::optional<task_id_token_t> webProcessIdentityToken() const { return { }; };
+#endif
};
explicit UserMediaCaptureManagerProxy(UniqueRef<ConnectionProxy>&&);
~UserMediaCaptureManagerProxy();