Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 6b651bf

Browse files
committed
Bug 1953677 [Linux] Delete snapshot GL context when VideoFramePool is deleted r=alwu
Differential Revision: https://phabricator.services.mozilla.com/D243289
1 parent 6d7462a commit 6b651bf

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

dom/media/platforms/ffmpeg/FFmpegVideoFramePool.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,11 @@ VideoFramePool<LIBAV_VER>::VideoFramePool(int aFFMPEGPoolSize)
124124
}
125125

126126
VideoFramePool<LIBAV_VER>::~VideoFramePool() {
127+
DMABUF_LOG("VideoFramePool::~VideoFramePool()");
127128
MutexAutoLock lock(mSurfaceLock);
128129
mDMABufSurfaces.Clear();
130+
131+
DMABufSurface::DeleteSnapshotGLContext();
129132
}
130133

131134
void VideoFramePool<LIBAV_VER>::ReleaseUnusedVAAPIFrames() {

widget/gtk/DMABufSurface.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,12 @@ void ReturnSnapshotGLContext(RefPtr<GLContext> aGLContext) {
167167
egl->fMakeCurrent(EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
168168
}
169169

170+
void DMABufSurface::DeleteSnapshotGLContext() {
171+
StaticMutexAutoLock lock(sSnapshotContextMutex);
172+
sSnapshotContext = nullptr;
173+
GLContextProviderEGL::Shutdown();
174+
}
175+
170176
bool DMABufSurface::UseDmaBufGL(GLContext* aGLContext) {
171177
static bool useDmabufGL =
172178
[&]() {

widget/gtk/DMABufSurface.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ class DMABufSurface {
184184
void GlobalRefAdd();
185185
void GlobalRefRelease();
186186

187+
static void DeleteSnapshotGLContext();
188+
187189
// Release all underlying data.
188190
virtual void ReleaseSurface() = 0;
189191

0 commit comments

Comments
 (0)