Use AVBufferRefs to keep EGLImages and DRM FDs around for the lifetime of the frame

This commit is contained in:
Cameron Gutman
2026-01-04 18:06:24 -06:00
parent 67cba9e397
commit 46c76534bc
8 changed files with 68 additions and 100 deletions
+4 -2
View File
@@ -73,13 +73,11 @@ public:
virtual AVPixelFormat getEGLImagePixelFormat() override;
virtual bool initializeEGL(EGLDisplay dpy, const EGLExtensions &ext) override;
virtual ssize_t exportEGLImages(AVFrame *frame, EGLDisplay dpy, EGLImage images[EGL_MAX_PLANES]) override;
virtual void freeEGLImages() override;
#endif
#ifdef HAVE_DRM
virtual bool canExportDrmPrime() override;
virtual bool mapDrmPrimeFrame(AVFrame* frame, AVDRMFrameDescriptor* drmDescriptor) override;
virtual void unmapDrmPrimeFrame(AVDRMFrameDescriptor* drmDescriptor) override;
#endif
private:
@@ -91,6 +89,10 @@ private:
bool canExportSurfaceHandle(int layerTypeFlag, VADRMPRIMESurfaceDescriptor* descriptor);
#endif
#ifdef HAVE_DRM
static void freeDrmDescriptorBuffer(void* opaque, uint8_t* data);
#endif
int m_DecoderSelectionPass;
int m_WindowSystem;
AVBufferRef* m_HwContext;