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 VideoFrameSurface< VideoFrameSurface::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::VideoFrame void VideoFrameSurface::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::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::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 { const RefPtr mSurface; const FFmpegLibWrapper* mLib; - AVBufferRef* mAVHWDeviceContext; + AVBufferRef* mAVHWFrameContext; AVBufferRef* mHWAVBuffer; };