Skip to content

Commit

Permalink
fix(video/darwin): fix mpv_render_context_free call
Browse files Browse the repository at this point in the history
  • Loading branch information
birros committed Sep 15, 2023
1 parent 8926ede commit 0b7c6b0
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() {
CGLSetCurrentContext(context)
defer {
OpenGLHelpers.checkError("disposeMPV")
CGLSetCurrentContext(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 0b7c6b0

Please sign in to comment.