зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1616892
[Wayland] Use VAAPIFrameHolder at release callback, r=sotaro
FFmpeg decoder needs to keep reference to more strucures for each frame so Bug 1616185 implements a VAAPIFrameHolder strucure and keeps the reference there. Let's use that also in WaylandDMABUFSurfaceImage. Differential Revision: https://phabricator.services.mozilla.com/D63513 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
1b3a3daa80
Коммит
f12714395b
|
@ -12,25 +12,28 @@
|
|||
#include "mozilla/gfx/Point.h"
|
||||
#include "mozilla/layers/TextureClient.h"
|
||||
|
||||
namespace mozilla {
|
||||
class VAAPIFrameHolder;
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
// An alias for av_buffer_unref(AVBufferRef**)
|
||||
typedef void (*AVFrameReleaseCallback)(void** aFrameRef);
|
||||
typedef void (*AVFrameReleaseCallback)(VAAPIFrameHolder* aFrameHolder);
|
||||
|
||||
class WaylandDMABUFSurfaceImage : public Image {
|
||||
public:
|
||||
explicit WaylandDMABUFSurfaceImage(WaylandDMABufSurface* aSurface,
|
||||
AVFrameReleaseCallback aReleaseCallback,
|
||||
void* aDecoder, void* aFrameRef)
|
||||
VAAPIFrameHolder* aFrameHolder)
|
||||
: Image(nullptr, ImageFormat::WAYLAND_DMABUF),
|
||||
mSurface(aSurface),
|
||||
mReleaseCallback(aReleaseCallback),
|
||||
mFrameRef(aFrameRef) {}
|
||||
mFrameHolder(aFrameHolder) {}
|
||||
|
||||
~WaylandDMABUFSurfaceImage() {
|
||||
if (mReleaseCallback) {
|
||||
mReleaseCallback(&mFrameRef);
|
||||
mReleaseCallback(mFrameHolder);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,12 +55,8 @@ class WaylandDMABUFSurfaceImage : public Image {
|
|||
|
||||
// When WaylandDMABUFSurfaceImage is created on top of ffmpeg frame located at
|
||||
// GPU memory we need to keep it until painting of the frame is finished.
|
||||
|
||||
// mReleaseCallback points to av_buffer_unref() from libva library.
|
||||
AVFrameReleaseCallback mReleaseCallback;
|
||||
// AVBufferRef* which points to a frame located at GPU.
|
||||
// We own this reference.
|
||||
void* mFrameRef;
|
||||
VAAPIFrameHolder* mFrameHolder;
|
||||
};
|
||||
|
||||
} // namespace layers
|
||||
|
|
Загрузка…
Ссылка в новой задаче