summaryrefslogtreecommitdiff
path: root/D145094.diff
blob: 711acc973289bc4d4531d702c39399493c7b3bc0 (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
diff -up firefox-100.0/dom/media/platforms/ffmpeg/FFmpegVideoFramePool.cpp.D145094 firefox-100.0/dom/media/platforms/ffmpeg/FFmpegVideoFramePool.cpp
--- firefox-100.0/dom/media/platforms/ffmpeg/FFmpegVideoFramePool.cpp.D145094	2022-04-29 01:01:46.000000000 +0200
+++ firefox-100.0/dom/media/platforms/ffmpeg/FFmpegVideoFramePool.cpp	2022-05-03 09:51:48.570471687 +0200
@@ -23,7 +23,7 @@ RefPtr<layers::Image> VideoFrameSurface<
 VideoFrameSurface<LIBAV_VER>::VideoFrameSurface(DMABufSurface* aSurface)
     : mSurface(aSurface),
       mLib(nullptr),
-      mAVHWDeviceContext(nullptr),
+      mAVHWFrameContext(nullptr),
       mHWAVBuffer(nullptr) {
   // Create global refcount object to track mSurface usage over
   // gects rendering engine. We can't release it until it's used
@@ -38,16 +38,22 @@ VideoFrameSurface<LIBAV_VER>::VideoFrame
 void VideoFrameSurface<LIBAV_VER>::LockVAAPIData(
     AVCodecContext* aAVCodecContext, AVFrame* aAVFrame,
     FFmpegLibWrapper* aLib) {
-  FFMPEG_LOG("VideoFrameSurface: VAAPI locking dmabuf surface UID = %d",
-             mSurface->GetUID());
+  MOZ_DIAGNOSTIC_ASSERT(aAVCodecContext->hw_frames_ctx);
   mLib = aLib;
-  mAVHWDeviceContext = aLib->av_buffer_ref(aAVCodecContext->hw_device_ctx);
+  mAVHWFrameContext = aLib->av_buffer_ref(aAVCodecContext->hw_frames_ctx);
   mHWAVBuffer = aLib->av_buffer_ref(aAVFrame->buf[0]);
+  FFMPEG_LOG(
+      "VideoFrameSurface: VAAPI locking dmabuf surface UID = %d "
+      "mAVHWFrameContext %p mHWAVBuffer %p",
+      mSurface->GetUID(), mAVHWFrameContext, mHWAVBuffer);
 }
 
 void VideoFrameSurface<LIBAV_VER>::ReleaseVAAPIData(bool aForFrameRecycle) {
-  FFMPEG_LOG("VideoFrameSurface: VAAPI releasing dmabuf surface UID = %d",
-             mSurface->GetUID());
+  FFMPEG_LOG(
+      "VideoFrameSurface: VAAPI releasing dmabuf surface UID = %d "
+      "aForFrameRecycle %d mLib %p mAVHWFrameContext %p mHWAVBuffer %p",
+      mSurface->GetUID(), aForFrameRecycle, mLib, mAVHWFrameContext,
+      mHWAVBuffer);
 
   // It's possible to unref GPU data while IsUsed() is still set.
   // It can happens when VideoFramePool is deleted while decoder shutdown
@@ -57,7 +63,7 @@ void VideoFrameSurface<LIBAV_VER>::Relea
   // is closed.
   if (mLib) {
     mLib->av_buffer_unref(&mHWAVBuffer);
-    mLib->av_buffer_unref(&mAVHWDeviceContext);
+    mLib->av_buffer_unref(&mAVHWFrameContext);
   }
 
   // If we want to recycle the frame, make sure it's not used
diff -up firefox-100.0/dom/media/platforms/ffmpeg/FFmpegVideoFramePool.h.D145094 firefox-100.0/dom/media/platforms/ffmpeg/FFmpegVideoFramePool.h
--- firefox-100.0/dom/media/platforms/ffmpeg/FFmpegVideoFramePool.h.D145094	2022-04-29 00:02:40.000000000 +0200
+++ firefox-100.0/dom/media/platforms/ffmpeg/FFmpegVideoFramePool.h	2022-05-03 09:33:27.110885715 +0200
@@ -102,7 +102,7 @@ class VideoFrameSurface<LIBAV_VER> {
 
   const RefPtr<DMABufSurface> mSurface;
   const FFmpegLibWrapper* mLib;
-  AVBufferRef* mAVHWDeviceContext;
+  AVBufferRef* mAVHWFrameContext;
   AVBufferRef* mHWAVBuffer;
 };
 
bgstack15