summaryrefslogtreecommitdiff
path: root/mozilla-1645671.patch
diff options
context:
space:
mode:
Diffstat (limited to 'mozilla-1645671.patch')
-rw-r--r--mozilla-1645671.patch94
1 files changed, 94 insertions, 0 deletions
diff --git a/mozilla-1645671.patch b/mozilla-1645671.patch
new file mode 100644
index 0000000..8e9e31e
--- /dev/null
+++ b/mozilla-1645671.patch
@@ -0,0 +1,94 @@
+diff --git a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h
+--- a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h
++++ b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.h
+@@ -156,7 +156,7 @@
+ MediaDataDecoder::DecodedData& aResults);
+
+ void ReleaseUnusedVAAPIFrames();
+- DMABufSurfaceWrapper* GetUnusedDMABufSurfaceWrapper();
++ int GetUnusedDMABufSurfaceWrapperIndex();
+ void ReleaseDMABufSurfaces();
+ #endif
+
+@@ -174,7 +174,7 @@
+ const bool mDisableHardwareDecoding;
+ VADisplay mDisplay;
+ bool mUseDMABufSurfaces;
+- nsTArray<DMABufSurfaceWrapper> mDMABufSurfaces;
++ nsTArray<UniquePtr<DMABufSurfaceWrapper>> mDMABufSurfaces;
+ #endif
+ RefPtr<KnowsCompositor> mImageAllocator;
+ RefPtr<ImageContainer> mImageContainer;
+diff --git a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
+--- a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
++++ b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
+@@ -698,21 +698,20 @@
+ void FFmpegVideoDecoder<LIBAV_VER>::ReleaseUnusedVAAPIFrames() {
+ int len = mDMABufSurfaces.Length();
+ for (int i = 0; i < len; i++) {
+- if (!mDMABufSurfaces[i].IsUsed()) {
+- mDMABufSurfaces[i].ReleaseVAAPIData();
++ if (!mDMABufSurfaces[i]->IsUsed()) {
++ mDMABufSurfaces[i]->ReleaseVAAPIData();
+ }
+ }
+ }
+
+-DMABufSurfaceWrapper*
+-FFmpegVideoDecoder<LIBAV_VER>::GetUnusedDMABufSurfaceWrapper() {
++int FFmpegVideoDecoder<LIBAV_VER>::GetUnusedDMABufSurfaceWrapperIndex() {
+ int len = mDMABufSurfaces.Length();
+ for (int i = 0; i < len; i++) {
+- if (!mDMABufSurfaces[i].IsUsed()) {
+- return &(mDMABufSurfaces[i]);
++ if (!mDMABufSurfaces[i]->IsUsed()) {
++ return i;
+ }
+ }
+- return nullptr;
++ return -1;
+ }
+
+ void FFmpegVideoDecoder<LIBAV_VER>::ReleaseDMABufSurfaces() {
+@@ -763,8 +762,8 @@
+
+ RefPtr<DMABufSurfaceYUV> surface;
+
+- DMABufSurfaceWrapper* surfaceWrapper = GetUnusedDMABufSurfaceWrapper();
+- if (!surfaceWrapper) {
++ int surfaceWrapperIndex = GetUnusedDMABufSurfaceWrapperIndex();
++ if (surfaceWrapperIndex < 0) {
+ if (mVAAPIDeviceContext) {
+ surface = DMABufSurfaceYUV::CreateYUVSurface(vaDesc);
+ } else {
+@@ -776,16 +775,16 @@
+ return MediaResult(NS_ERROR_OUT_OF_MEMORY,
+ RESULT_DETAIL("Unable to get DMABufSurfaceYUV"));
+ }
+-
+ # ifdef MOZ_LOGGING
+ static int uid = 0;
+ surface->SetUID(++uid);
+ FFMPEG_LOG("Created new DMABufSurface UID = %d", uid);
+ # endif
+- mDMABufSurfaces.AppendElement(DMABufSurfaceWrapper(surface, mLib));
+- surfaceWrapper = &(mDMABufSurfaces[mDMABufSurfaces.Length() - 1]);
++ mDMABufSurfaces.AppendElement(
++ MakeUnique<DMABufSurfaceWrapper>(surface, mLib));
++ surfaceWrapperIndex = mDMABufSurfaces.Length() - 1;
+ } else {
+- surface = surfaceWrapper->GetDMABufSurface();
++ surface = mDMABufSurfaces[surfaceWrapperIndex]->GetDMABufSurface();
+ bool ret;
+
+ if (mVAAPIDeviceContext) {
+@@ -803,7 +802,7 @@
+ }
+
+ if (mVAAPIDeviceContext) {
+- surfaceWrapper->LockVAAPIData(mCodecContext, mFrame);
++ mDMABufSurfaces[surfaceWrapperIndex]->LockVAAPIData(mCodecContext, mFrame);
+ }
+
+ surface->SetYUVColorSpace(GetFrameColorSpace());
+
bgstack15