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> 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> 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> VideoFramePool::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> videoSurface = GetFreeVideoFrameSurface(); if (!videoSurface) { RefPtr 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> surf = @@ -142,11 +143,11 @@ } videoSurface = surf; mDMABufSurfaces.AppendElement(std::move(surf)); } else { RefPtr 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);