From 28e5b66e6e201259c6ad240552045314d2072595 Mon Sep 17 00:00:00 2001 From: Sven Göthel Date: Sun, 28 Jan 2024 09:08:28 +0100 Subject: GraphUI MediaButton: Clear cached subtitle data on uninit and init from GLMediaPlayer --- .../classes/com/jogamp/graph/ui/shapes/MediaButton.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/graphui/classes/com/jogamp/graph') diff --git a/src/graphui/classes/com/jogamp/graph/ui/shapes/MediaButton.java b/src/graphui/classes/com/jogamp/graph/ui/shapes/MediaButton.java index 931f12341..ff3747bdf 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/shapes/MediaButton.java +++ b/src/graphui/classes/com/jogamp/graph/ui/shapes/MediaButton.java @@ -169,8 +169,12 @@ public class MediaButton extends TexSeqButton { System.err.println("MediaButton AttributesChanges: "+eventMask+", when "+when); System.err.println("MediaButton State: "+mp); } + if( eventMask.isSet(GLMediaPlayer.EventMask.Bit.Uninit) ) { + clearSubtitleCache(); + } if( eventMask.isSet(GLMediaPlayer.EventMask.Bit.Init) ) { resetGL = true; + clearSubtitleCache(); } if( eventMask.isSet(GLMediaPlayer.EventMask.Bit.Size) ) { // FIXME: mPlayer.resetGLState(); @@ -229,7 +233,13 @@ public class MediaButton extends TexSeqButton { } markStateDirty(); // keep on going }; - protected final void drawSubtitle(final GL2ES2 gl, final RegionRenderer renderer) { + private final void clearSubtitleCache() { + draw_lastASS = null; + synchronized( assEventLock ) { + assEventQueue.clear(); + } + } + private final void drawSubtitle(final GL2ES2 gl, final RegionRenderer renderer) { // dequeue and earmark new subtitle final ASSEventLine ass; final boolean newASS; @@ -300,6 +310,6 @@ public class MediaButton extends TexSeqButton { } } - private ASSEventLine draw_lastASS; + private volatile ASSEventLine draw_lastASS; } -- cgit v1.2.3