Bug 1645671 [Linux/VA-API] Create DMABufSurfaceWrapper directly at nsTAttay and disable DMABufSurfaceWrapper class copy and assignment constructors, r=jya

When DMABufSurfaceWrapper is added to nsTArray, a temporary local DMABufSurfaceWrapper object is created. When the temporary
object is deleted after the adding, associated dmabuf data is released which leads to rendering artifact during VA-API video playback.

As a fix in this patch we create DMABufSurfaceWrapper 'in-place' at nsTAttay.
We also disable DMABufSurfaceWrapper class copy and assignment constructors to avoid similar potential issues.

Differential Revision: https://phabricator.services.mozilla.com/D85152
This commit is contained in:
Martin Stransky 2020-08-03 09:08:26 +00:00
Родитель 5221ba1823
Коммит e177990894
2 изменённых файлов: 7 добавлений и 1 удалений

Просмотреть файл

@ -782,7 +782,7 @@ MediaResult FFmpegVideoDecoder<LIBAV_VER>::CreateImageDMABuf(
surface->SetUID(++uid);
FFMPEG_LOG("Created new DMABufSurface UID = %d", uid);
# endif
mDMABufSurfaces.AppendElement(DMABufSurfaceWrapper(surface, mLib));
mDMABufSurfaces.EmplaceBack(surface, mLib);
surfaceWrapper = &(mDMABufSurfaces[mDMABufSurfaces.Length() - 1]);
} else {
surface = surfaceWrapper->GetDMABufSurface();

Просмотреть файл

@ -75,6 +75,12 @@ class DMABufSurfaceWrapper final {
return mSurface->GetAsDMABufSurfaceYUV();
}
// Don't allow DMABufSurfaceWrapper plain copy as it leads to
// enexpected DMABufSurface/HW buffer releases and we don't want to
// deep copy them.
DMABufSurfaceWrapper(const DMABufSurfaceWrapper&) = delete;
const DMABufSurfaceWrapper& operator=(DMABufSurfaceWrapper const&) = delete;
private:
const RefPtr<DMABufSurface> mSurface;
const FFmpegLibWrapper* mLib;