| Summary: | SampleBufferDiplayLayer should not need to create IOSurfaces | ||||||
|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | youenn fablet <youennf> | ||||
| Component: | WebRTC | Assignee: | youenn fablet <youennf> | ||||
| Status: | RESOLVED FIXED | ||||||
| Severity: | Normal | CC: | eric.carlson, kkinnunen, webkit-bug-importer, youennf | ||||
| Priority: | P2 | Keywords: | InRadar | ||||
| Version: | WebKit Nightly Build | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Bug Depends on: | 235951 | ||||||
| Bug Blocks: | |||||||
| Attachments: |
|
||||||
|
Description
youenn fablet
2022-02-01 08:15:46 PST
Created attachment 450531 [details]
Patch
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]. |