Skip to content

Commit

Permalink
Merge pull request media-kit#481 from birros/fix/mpv-context-free
Browse files Browse the repository at this point in the history
fix(video): fix mpv_render_context_free call
  • Loading branch information
alexmercerind authored Sep 22, 2023
2 parents 8926ede + 70d7777 commit 350e43a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public class TextureSW: NSObject, FlutterTexture, ResizableTextureProtocol {
}

private func disposeMPV() {
mpv_render_context_set_update_callback(renderContext, nil, nil)
mpv_render_context_free(renderContext)
}

Expand Down
7 changes: 7 additions & 0 deletions media_kit_video/ios/Classes/plugin/TextureHW.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ public class TextureHW: NSObject, FlutterTexture, ResizableTextureProtocol {
}

private func disposeMPV() {
EAGLContext.setCurrent(context)
defer {
OpenGLESHelpers.checkError("disposeMPV")
EAGLContext.setCurrent(nil)
}

mpv_render_context_set_update_callback(renderContext, nil, nil)
mpv_render_context_free(renderContext)
}

Expand Down
7 changes: 7 additions & 0 deletions media_kit_video/macos/Classes/plugin/TextureHW.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,13 @@ public class TextureHW: NSObject, FlutterTexture, ResizableTextureProtocol {
}

private func disposeMPV() {
CGLSetCurrentContext(context)
defer {
OpenGLHelpers.checkError("disposeMPV")
CGLSetCurrentContext(nil)
}

mpv_render_context_set_update_callback(renderContext, nil, nil)
mpv_render_context_free(renderContext)
}

Expand Down

0 comments on commit 350e43a

Please sign in to comment.