Blob Blame History Raw
diff --git a/dom/media/platforms/ffmpeg/FFmpegVideoFramePool.h b/dom/media/platforms/ffmpeg/FFmpegVideoFramePool.h
--- a/dom/media/platforms/ffmpeg/FFmpegVideoFramePool.h
+++ b/dom/media/platforms/ffmpeg/FFmpegVideoFramePool.h
@@ -112,12 +112,13 @@
  public:
   VideoFramePool();
   ~VideoFramePool();
 
   RefPtr<VideoFrameSurface<LIBAV_VER>> GetVideoFrameSurface(
-      VADRMPRIMESurfaceDescriptor& aVaDesc, AVCodecContext* aAVCodecContext,
-      AVFrame* aAVFrame, FFmpegLibWrapper* aLib);
+      VADRMPRIMESurfaceDescriptor& aVaDesc, int aWidth, int aHeight,
+      AVCodecContext* aAVCodecContext, AVFrame* aAVFrame,
+      FFmpegLibWrapper* aLib);
   void ReleaseUnusedVAAPIFrames();
 
  private:
   RefPtr<VideoFrameSurface<LIBAV_VER>> GetFreeVideoFrameSurface();
 
diff --git a/dom/media/platforms/ffmpeg/FFmpegVideoFramePool.cpp b/dom/media/platforms/ffmpeg/FFmpegVideoFramePool.cpp
--- a/dom/media/platforms/ffmpeg/FFmpegVideoFramePool.cpp
+++ b/dom/media/platforms/ffmpeg/FFmpegVideoFramePool.cpp
@@ -111,12 +111,13 @@
   return nullptr;
 }
 
 RefPtr<VideoFrameSurface<LIBAV_VER>>
 VideoFramePool<LIBAV_VER>::GetVideoFrameSurface(
-    VADRMPRIMESurfaceDescriptor& aVaDesc, AVCodecContext* aAVCodecContext,
-    AVFrame* aAVFrame, FFmpegLibWrapper* aLib) {
+    VADRMPRIMESurfaceDescriptor& aVaDesc, int aWidth, int aHeight,
+    AVCodecContext* aAVCodecContext, AVFrame* aAVFrame,
+    FFmpegLibWrapper* aLib) {
   if (aVaDesc.fourcc != VA_FOURCC_NV12 && aVaDesc.fourcc != VA_FOURCC_YV12 &&
       aVaDesc.fourcc != VA_FOURCC_P010) {
     FFMPEG_LOG("Unsupported VA-API surface format %d", aVaDesc.fourcc);
     return nullptr;
   }
@@ -124,11 +125,11 @@
   MutexAutoLock lock(mSurfaceLock);
   RefPtr<VideoFrameSurface<LIBAV_VER>> videoSurface =
       GetFreeVideoFrameSurface();
   if (!videoSurface) {
     RefPtr<DMABufSurfaceYUV> surface =
-        DMABufSurfaceYUV::CreateYUVSurface(aVaDesc);
+        DMABufSurfaceYUV::CreateYUVSurface(aVaDesc, aWidth, aHeight);
     if (!surface) {
       return nullptr;
     }
     FFMPEG_LOG("Created new VA-API DMABufSurface UID = %d", surface->GetUID());
     RefPtr<VideoFrameSurface<LIBAV_VER>> surf =
@@ -142,11 +143,11 @@
     }
     videoSurface = surf;
     mDMABufSurfaces.AppendElement(std::move(surf));
   } else {
     RefPtr<DMABufSurfaceYUV> surface = videoSurface->GetDMABufSurface();
-    if (!surface->UpdateYUVData(aVaDesc)) {
+    if (!surface->UpdateYUVData(aVaDesc, aWidth, aHeight)) {
       return nullptr;
     }
     FFMPEG_LOG("Reusing VA-API DMABufSurface UID = %d", surface->GetUID());
   }
   videoSurface->LockVAAPIData(aAVCodecContext, aAVFrame, aLib);