summaryrefslogtreecommitdiff
path: root/D146086.diff
blob: c6790ad57bdb2f869aa7fc408875ccfdf79dddf4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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);

bgstack15