SampleBufferDiplayLayer should not need to create IOSurfaces
Created attachment 450531 [details] Patch
<rdar://problem/88329675>
Comment on attachment 450531 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=450531&action=review > Source/WebKit/GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.cpp:125 > + sample = MediaSampleAVFObjC::createImageSample(WTFMove(pixelBuffer), remoteSample.rotation(), remoteSample.mirrored()); > + sample->setTimestamps(remoteSample.time(), MediaTime { }); As a followup, it would be nice if createImageSample that took optional timestamps. > Source/WebKit/GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.cpp:172 > +void RemoteSampleBufferDisplayLayer::setSharedVideoFrameSemaphore(IPC::Semaphore&& semaphore) > +{ > + m_sharedVideoFrameReader.setSemaphore(WTFMove(semaphore)); > +} > + > +void RemoteSampleBufferDisplayLayer::setSharedVideoFrameMemory(const SharedMemory::IPCHandle& ipcHandle) > +{ > + auto memory = SharedMemory::map(ipcHandle.handle, SharedMemory::Protection::ReadOnly); > + if (!memory) > + return; > + > + m_sharedVideoFrameReader.setSharedMemory(memory.releaseNonNull()); > +} And it would be nice to put these into a "mixin" class with a pure virtual `SharedVideoFrameReader` getter others can derive from instead of duplicating in all of the classes that need them.
(In reply to Eric Carlson from comment #3) > Comment on attachment 450531 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=450531&action=review > > > Source/WebKit/GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.cpp:125 > > + sample = MediaSampleAVFObjC::createImageSample(WTFMove(pixelBuffer), remoteSample.rotation(), remoteSample.mirrored()); > > + sample->setTimestamps(remoteSample.time(), MediaTime { }); > > As a followup, it would be nice if createImageSample that took optional > timestamps. I filed https://bugs.webkit.org/show_bug.cgi?id=236067. > > Source/WebKit/GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.cpp:172 > > +void RemoteSampleBufferDisplayLayer::setSharedVideoFrameSemaphore(IPC::Semaphore&& semaphore) > > +{ > > + m_sharedVideoFrameReader.setSemaphore(WTFMove(semaphore)); > > +} > > + > > +void RemoteSampleBufferDisplayLayer::setSharedVideoFrameMemory(const SharedMemory::IPCHandle& ipcHandle) > > +{ > > + auto memory = SharedMemory::map(ipcHandle.handle, SharedMemory::Protection::ReadOnly); > > + if (!memory) > > + return; > > + > > + m_sharedVideoFrameReader.setSharedMemory(memory.releaseNonNull()); > > +} > > And it would be nice to put these into a "mixin" class with a pure virtual > `SharedVideoFrameReader` getter others can derive from instead of > duplicating in all of the classes that need them. I can at least make setSharedMemory take a IPCHandle to centralise more code. I filed https://bugs.webkit.org/show_bug.cgi?id=236068.
Committed r289038 (246745@main): <https://commits.webkit.org/246745@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 450531 [details].