File tree 2 files changed +10
-25
lines changed
src/org/freedesktop/gstreamer
2 files changed +10
-25
lines changed Original file line number Diff line number Diff line change 35
35
import com .sun .jna .Pointer ;
36
36
import com .sun .jna .ptr .PointerByReference ;
37
37
import java .util .Locale ;
38
+ import java .util .logging .Level ;
38
39
import org .freedesktop .gstreamer .glib .Natives ;
39
40
40
41
import org .freedesktop .gstreamer .lowlevel .GstAPI .GErrorStruct ;
@@ -834,9 +835,13 @@ public synchronized <T> void disconnect(Class<T> listenerClass, T listener) {
834
835
*/
835
836
private void dispatchMessage (Message msg ) {
836
837
// Dispatch to listeners
837
- for (Object listener : messageProxies ) {
838
- ((MessageProxy ) listener ).busMessage (this , msg );
839
- }
838
+ messageProxies .forEach ((listener ) -> {
839
+ try {
840
+ ((MessageProxy ) listener ).busMessage (this , msg );
841
+ } catch (Throwable t ) {
842
+ LOG .log (Level .SEVERE , "Exception thrown by bus message handler" , t );
843
+ }
844
+ });
840
845
}
841
846
842
847
private static class MessageProxy implements MESSAGE {
Original file line number Diff line number Diff line change @@ -630,30 +630,10 @@ public static boolean testVersion(int major, int minor) {
630
630
private static final ThreadFactory threadFactory = new ThreadFactory () {
631
631
private final AtomicInteger counter = new AtomicInteger (0 );
632
632
633
- /**
634
- * Determines if Gst has been started from an applet and returns it's
635
- * parent group.
636
- *
637
- * This is to avoid a problem where the service thread is killed when an
638
- * applet is destroyed. If multiple applets are active simultaneously,
639
- * this could be a problem.
640
- *
641
- * @return Applet's parent ("main") thread group or null, if not running
642
- * inside an applet
643
- */
644
- private ThreadGroup getThreadGroup () {
645
- ThreadGroup tg = Thread .currentThread ().getThreadGroup ();
646
- try {
647
- Class <?> atgClass = Class .forName ("sun.applet.AppletThreadGroup" );
648
- return atgClass .isInstance (tg ) ? tg .getParent () : null ;
649
- } catch (ClassNotFoundException ex ) {
650
- return null ;
651
- }
652
- }
653
-
633
+ @ Override
654
634
public Thread newThread (Runnable task ) {
655
635
final String name = "gstreamer service thread " + counter .incrementAndGet ();
656
- Thread t = new Thread (getThreadGroup (), task , name );
636
+ Thread t = new Thread (task , name );
657
637
t .setDaemon (true );
658
638
t .setPriority (Thread .NORM_PRIORITY );
659
639
return t ;
You can’t perform that action at this time.
0 commit comments