Changeset 283369 in webkit
- Timestamp:
- Oct 1, 2021, 8:34:21 AM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 7 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/platform/graphics/RemoteVideoSample.h (modified) (2 diffs)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/GPUProcess/GPUConnectionToWebProcess.cpp (modified) (1 diff)
-
WebKit/GPUProcess/webrtc/LibWebRTCCodecsProxy.mm (modified) (4 diffs)
-
WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp (modified) (4 diffs)
-
WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r283367 r283369 1 2021-10-01 Youenn Fablet <youenn@apple.com> 2 3 Attribute IOSurfaces created by camera and decoders to responsible WebProcess 4 https://bugs.webkit.org/show_bug.cgi?id=231075 5 6 Reviewed by Chris Dumez. 7 8 Manually tested. 9 10 * platform/graphics/RemoteVideoSample.h: 11 1 12 2021-10-01 Antti Koivisto <antti@apple.com> 2 13 -
trunk/Source/WebCore/platform/graphics/RemoteVideoSample.h
r281984 r283369 48 48 WEBCORE_EXPORT static std::unique_ptr<RemoteVideoSample> create(RetainPtr<CVPixelBufferRef>&&, MediaTime&& presentationTime, MediaSample::VideoRotation = MediaSample::VideoRotation::None); 49 49 WEBCORE_EXPORT IOSurfaceRef surface() const; 50 51 #if HAVE(IOSURFACE_SET_OWNERSHIP_IDENTITY) 52 void setOwnershipIdentity(task_id_token_t newOwner); 53 #endif 50 54 51 55 const MediaTime& time() const { return m_time; } … … 116 120 }; 117 121 122 #if HAVE(IOSURFACE_SET_OWNERSHIP_IDENTITY) 123 inline void RemoteVideoSample::setOwnershipIdentity(task_id_token_t newOwner) 124 { 125 if (m_ioSurface) 126 m_ioSurface->setOwnershipIdentity(newOwner); 127 } 128 #endif 129 118 130 } 119 131 -
trunk/Source/WebKit/ChangeLog
r283361 r283369 1 2021-10-01 Youenn Fablet <youenn@apple.com> 2 3 Attribute IOSurfaces created by camera and decoders to responsible WebProcess 4 https://bugs.webkit.org/show_bug.cgi?id=231075 5 6 Reviewed by Chris Dumez. 7 8 Make sure to mark camera and decoder generated IOSurfaces as owned by the responsible WebProcess. 9 10 * GPUProcess/GPUConnectionToWebProcess.cpp: 11 * GPUProcess/webrtc/LibWebRTCCodecsProxy.mm: 12 * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp: 13 * UIProcess/Cocoa/UserMediaCaptureManagerProxy.h: 14 1 15 2021-10-01 Carlos Garcia Campos <cgarcia@igalia.com> 2 16 -
trunk/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp
r281640 r283369 189 189 } 190 190 191 #if HAVE(IOSURFACE_SET_OWNERSHIP_IDENTITY) 192 std::optional<task_id_token_t> webProcessIdentityToken() const final 193 { 194 return m_process.webProcessIdentityToken(); 195 } 196 #endif 197 191 198 GPUConnectionToWebProcess& m_process; 192 199 }; -
trunk/Source/WebKit/GPUProcess/webrtc/LibWebRTCCodecsProxy.mm
r283036 r283369 75 75 } 76 76 77 static Function<void(CVPixelBufferRef pixelBuffer, uint32_t timeStampNs, uint32_t timeStamp)> createDecoderCallback(RTCDecoderIdentifier identifier, GPUConnectionToWebProcess& gpuConnectionToWebProcess) 78 { 79 return [connection = Ref { gpuConnectionToWebProcess.connection() }, 80 #if HAVE(IOSURFACE_SET_OWNERSHIP_IDENTITY) 81 token = gpuConnectionToWebProcess.webProcessIdentityToken(), 82 #endif 83 identifier](CVPixelBufferRef pixelBuffer, uint32_t timeStampNs, uint32_t timeStamp) { 84 if (auto sample = WebCore::RemoteVideoSample::create(pixelBuffer, MediaTime(timeStampNs, 1))) { 85 #if HAVE(IOSURFACE_SET_OWNERSHIP_IDENTITY) 86 sample->setOwnershipIdentity(token); 87 #endif 88 connection->send(Messages::LibWebRTCCodecs::CompletedDecoding { identifier, timeStamp, *sample }, 0); 89 } 90 }; 91 } 92 77 93 void LibWebRTCCodecsProxy::createH264Decoder(RTCDecoderIdentifier identifier) 78 94 { … … 80 96 Locker locker { m_lock }; 81 97 ASSERT(!m_decoders.contains(identifier)); 82 m_decoders.add(identifier, webrtc::createLocalH264Decoder(makeBlockPtr([connection = Ref { m_gpuConnectionToWebProcess.connection() }, identifier](CVPixelBufferRef pixelBuffer, uint32_t timeStampNs, uint32_t timeStamp) { 83 if (auto sample = WebCore::RemoteVideoSample::create(pixelBuffer, MediaTime(timeStampNs, 1))) 84 connection->send(Messages::LibWebRTCCodecs::CompletedDecoding { identifier, timeStamp, *sample }, 0); 85 }).get())); 98 m_decoders.add(identifier, webrtc::createLocalH264Decoder(makeBlockPtr(createDecoderCallback(identifier, m_gpuConnectionToWebProcess)).get())); 86 99 } 87 100 … … 91 104 Locker locker { m_lock }; 92 105 ASSERT(!m_decoders.contains(identifier)); 93 m_decoders.add(identifier, webrtc::createLocalH265Decoder(makeBlockPtr([connection = Ref { m_gpuConnectionToWebProcess.connection() }, identifier](CVPixelBufferRef pixelBuffer, uint32_t timeStampNs, uint32_t timeStamp) { 94 if (auto sample = WebCore::RemoteVideoSample::create(pixelBuffer, MediaTime(timeStampNs, 1))) 95 connection->send(Messages::LibWebRTCCodecs::CompletedDecoding { identifier, timeStamp, *sample }, 0); 96 }).get())); 106 m_decoders.add(identifier, webrtc::createLocalH265Decoder(makeBlockPtr(createDecoderCallback(identifier, m_gpuConnectionToWebProcess)).get())); 97 107 } 98 108 … … 102 112 Locker locker { m_lock }; 103 113 ASSERT(!m_decoders.contains(identifier)); 104 m_decoders.add(identifier, webrtc::createLocalVP9Decoder(makeBlockPtr([connection = Ref { m_gpuConnectionToWebProcess.connection() }, identifier](CVPixelBufferRef pixelBuffer, uint32_t timeStampNs, uint32_t timeStamp) { 105 if (auto sample = WebCore::RemoteVideoSample::create(pixelBuffer, MediaTime(timeStampNs, 1))) 106 connection->send(Messages::LibWebRTCCodecs::CompletedDecoding { identifier, timeStamp, *sample }, 0); 107 }).get())); 114 m_decoders.add(identifier, webrtc::createLocalVP9Decoder(makeBlockPtr(createDecoderCallback(identifier, m_gpuConnectionToWebProcess)).get())); 108 115 } 109 116 -
trunk/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp
r280722 r283369 126 126 127 127 void setShouldApplyRotation(bool shouldApplyRotation) { m_shouldApplyRotation = true; } 128 #if HAVE(IOSURFACE_SET_OWNERSHIP_IDENTITY) 129 void setWebProcessIdentityToken(std::optional<task_id_token_t> token) { m_webProcessIdentityToken = token;} 130 #endif 128 131 129 132 private: … … 185 188 } else 186 189 remoteSample = RemoteVideoSample::create(sample); 187 if (remoteSample) 190 if (remoteSample) { 191 #if HAVE(IOSURFACE_SET_OWNERSHIP_IDENTITY) 192 if (m_webProcessIdentityToken) 193 remoteSample->setOwnershipIdentity(*m_webProcessIdentityToken); 194 #endif 188 195 m_connection->send(Messages::RemoteCaptureSampleManager::VideoSampleAvailable(m_id, WTFMove(*remoteSample)), 0); 196 } 189 197 } 190 198 … … 250 258 MediaTime m_startTime; 251 259 bool m_shouldReset { false }; 260 #if HAVE(TASK_IDENTITY_TOKEN) 261 std::optional<task_id_token_t> m_webProcessIdentityToken; 262 #endif 252 263 }; 253 264 … … 313 324 314 325 ASSERT(!m_proxies.contains(id)); 315 m_proxies.add(id, makeUnique<SourceProxy>(id, m_connectionProxy->connection(), WTFMove(source))); 326 auto proxy = makeUnique<SourceProxy>(id, m_connectionProxy->connection(), WTFMove(source)); 327 #if HAVE(IOSURFACE_SET_OWNERSHIP_IDENTITY) 328 if (device.type() != WebCore::CaptureDevice::DeviceType::Microphone) 329 proxy->setWebProcessIdentityToken(m_connectionProxy->webProcessIdentityToken()); 330 #endif 331 332 m_proxies.add(id, WTFMove(proxy)); 316 333 } else 317 334 invalidConstraints = WTFMove(sourceOrError.errorMessage); 318 319 335 320 336 completionHandler(succeeded, invalidConstraints, WTFMove(settings), WTFMove(capabilities), WTFMove(presets), size, frameRate); -
trunk/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.h
r279912 r283369 59 59 virtual Logger& logger() = 0; 60 60 virtual bool setCaptureAttributionString() { return true; } 61 #if HAVE(IOSURFACE_SET_OWNERSHIP_IDENTITY) 62 virtual std::optional<task_id_token_t> webProcessIdentityToken() const { return { }; }; 63 #endif 61 64 }; 62 65 explicit UserMediaCaptureManagerProxy(UniqueRef<ConnectionProxy>&&);
Note:
See TracChangeset
for help on using the changeset viewer.