Skip to content

Commit

Permalink
Fix memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
xfangfang committed Jan 22, 2025
1 parent 0ea8620 commit dc059a2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 21 deletions.
4 changes: 2 additions & 2 deletions scripts/psv/mpv_gxm/VITABUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pkgname=mpv
pkgver=263756c30517a2b1329b1a96ad1a8d18160791f2
pkgrel=4
pkgver=11c16a2aa7d1e985b4d494da0a2ca19cc73bb5c4
pkgrel=3
url="https://mpv.io/"
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/xfangfang/mpv/archive/${pkgver}.tar.gz")
sha256sums=('SKIP')
Expand Down
40 changes: 21 additions & 19 deletions wiliwili/source/view/mpv_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -445,25 +445,27 @@ void MPVCore::init() {
{MPV_RENDER_PARAM_GXM_INIT_PARAMS, &gxm_params},
{MPV_RENDER_PARAM_INVALID, nullptr}};

int texture_width = DISPLAY_WIDTH;
int texture_height = DISPLAY_HEIGHT;
int texture_stride = ALIGN(texture_width, 8);
nvg_image = nvgCreateImageRGBA(vg, texture_width, texture_height, 0, nullptr);
NVGXMtexture *texture = nvgxmImageHandle(vg, nvg_image);

NVGXMframebufferInitOptions framebufferOpts = {
.display_buffer_count = 1, // Must be 1 for custom FBOs
.scenesPerFrame = 1,
.render_target = texture,
.color_format = SCE_GXM_COLOR_FORMAT_U8U8U8U8_ABGR,
.color_surface_type = SCE_GXM_COLOR_SURFACE_LINEAR,
.display_width = texture_width,
.display_height = texture_height,
.display_stride = texture_stride,
};
mpv_fbo.tex = gxmCreateFramebuffer(&framebufferOpts);
mpv_fbo.w = texture_width;
mpv_fbo.h = texture_height;
if (mpv_fbo.tex == nullptr) {
int texture_width = DISPLAY_WIDTH;
int texture_height = DISPLAY_HEIGHT;
int texture_stride = ALIGN(texture_width, 8);
nvg_image = nvgCreateImageRGBA(vg, texture_width, texture_height, 0, nullptr);
NVGXMtexture *texture = nvgxmImageHandle(vg, nvg_image);

NVGXMframebufferInitOptions framebufferOpts = {
.display_buffer_count = 1, // Must be 1 for custom FBOs
.scenesPerFrame = 1,
.render_target = texture,
.color_format = SCE_GXM_COLOR_FORMAT_U8U8U8U8_ABGR,
.color_surface_type = SCE_GXM_COLOR_SURFACE_LINEAR,
.display_width = texture_width,
.display_height = texture_height,
.display_stride = texture_stride,
};
mpv_fbo.tex = gxmCreateFramebuffer(&framebufferOpts);
mpv_fbo.w = texture_width;
mpv_fbo.h = texture_height;
}
#else
int advanced_control{1};
mpv_opengl_init_params gl_init_params{get_proc_address, nullptr};
Expand Down

0 comments on commit dc059a2

Please sign in to comment.