[libbluray-devel] [Git][videolan/libbluray][master] 5 commits: Silence warnings.

Petri Hintukainen gitlab at videolan.org
Sun Aug 2 16:39:28 CEST 2020



Petri Hintukainen pushed to branch master at VideoLAN / libbluray


Commits:
9a9eba08 by hpi1 at 2020-08-02T17:28:02+03:00
Silence warnings.

We really want to compare object references, not string contents. But that triggers warnings.

- - - - -
7d4a3b74 by hpi1 at 2020-08-02T17:28:32+03:00
Add missing equals()

- - - - -
11eb0837 by hpi1 at 2020-08-02T17:29:07+03:00
Log error

- - - - -
023c803c by hpi1 at 2020-08-02T17:34:13+03:00
Use dedicated object for synchronized()

- - - - -
5d567c80 by hpi1 at 2020-08-02T17:35:47+03:00
Add missing locking to _get_title_info()

- - - - -


5 changed files:

- src/libbluray/bdj/java/java/io/BDFileSystem.java
- src/libbluray/bdj/java/org/bluray/ui/FrameAccurateAnimation.java
- src/libbluray/bdj/java/org/dvb/dsmcc/DSMCCObject.java
- src/libbluray/bdj/java/org/videolan/VFSCache.java
- src/libbluray/bluray.c


Changes:

=====================================
src/libbluray/bdj/java/java/io/BDFileSystem.java
=====================================
@@ -209,7 +209,7 @@ public abstract class BDFileSystem extends FileSystem {
 
         String resolvedPath = fs.resolve(parent, child);
         String cachePath = BDJLoader.getCachedFile(resolvedPath);
-        if (cachePath != resolvedPath) {
+        if (cachePath != resolvedPath && !cachePath.equals(resolvedPath)) {
             logger.info("resolve(p,c): using cached " + cachePath + " (" + resolvedPath + ")");
         }
         return cachePath;
@@ -238,7 +238,7 @@ public abstract class BDFileSystem extends FileSystem {
 
         String resolvedPath = fs.resolve(f);
         String cachePath = BDJLoader.getCachedFile(resolvedPath);
-        if (cachePath != resolvedPath) {
+        if (cachePath != resolvedPath && !cachePath.equals(resolvedPath)) {
             logger.info("resolve(f): using cached " + cachePath + " (" + resolvedPath + ")");
         }
         return cachePath;
@@ -250,7 +250,7 @@ public abstract class BDFileSystem extends FileSystem {
 
         String canonPath = fs.canonicalize(path);
         String cachePath = BDJLoader.getCachedFile(canonPath);
-        if (cachePath != canonPath) {
+        if (cachePath != canonPath && !cachePath.equals(canonPath)) {
             logger.info("canonicalize(): Using cached " + cachePath + " for " + canonPath + "(" + path + ")");
         }
         return cachePath;


=====================================
src/libbluray/bdj/java/org/bluray/ui/FrameAccurateAnimation.java
=====================================
@@ -62,13 +62,15 @@ public abstract class FrameAccurateAnimation extends Component {
         this.params = new AnimationParameters(params);
     }
 
-    public synchronized void destroy() {
-        if (context != null) {
-            context.removeFAA(this);
-            context = null;
-        }
+    public void destroy() {
+        synchronized (lock) {
+            if (context != null) {
+                context.removeFAA(this);
+                context = null;
+            }
 
-        destroyImpl();
+            destroyImpl();
+        }
     }
 
     public long getCompletedFrameCount() {
@@ -99,8 +101,10 @@ public abstract class FrameAccurateAnimation extends Component {
         return params.threadPriority;
     }
 
-    public synchronized boolean isAnimated() {
-        return running;
+    public boolean isAnimated() {
+        synchronized (lock) {
+            return running;
+        }
     }
 
     public void paint(Graphics g) {
@@ -108,10 +112,11 @@ public abstract class FrameAccurateAnimation extends Component {
         logger.unimplemented("paint");
     }
 
-    public synchronized void resetStartStopTime(
-            FrameAccurateAnimationTimer newTimer) {
-        params.faaTimer = new FrameAccurateAnimationTimer(newTimer);
-        logger.unimplemented("resetStartStopTime");
+    public void resetStartStopTime(FrameAccurateAnimationTimer newTimer) {
+        synchronized (lock) {
+            params.faaTimer = new FrameAccurateAnimationTimer(newTimer);
+            logger.unimplemented("resetStartStopTime");
+        }
     }
 
     public void setBounds(int x, int y, int width, int height) {
@@ -141,23 +146,27 @@ public abstract class FrameAccurateAnimation extends Component {
         logger.unimplemented("destroyImpl");
     }
 
-    public synchronized void start() {
-        if (!running) {
-            running = true;
-            // TODO: compare timer against video
+    public void start() {
+        synchronized (lock) {
+            if (!running) {
+                running = true;
+                // TODO: compare timer against video
 
-            if (params.faaTimer != null) {
-                logger.unimplemented("start(faaTimer)");
-            }
+                if (params.faaTimer != null) {
+                    logger.unimplemented("start(faaTimer)");
+                }
 
-            startImpl();
+                startImpl();
+            }
         }
     }
 
-    public synchronized void stop() {
-        if (running) {
-            running = false;
-            stopImpl();
+    public void stop() {
+        synchronized (lock) {
+            if (running) {
+                running = false;
+                stopImpl();
+            }
         }
     }
 
@@ -165,6 +174,7 @@ public abstract class FrameAccurateAnimation extends Component {
         return "FrameAccurateAnimation";
     }
 
+    private Object lock = new Object();
     private BDJXletContext context;
     protected boolean running;
     protected AnimationParameters params;


=====================================
src/libbluray/bdj/java/org/dvb/dsmcc/DSMCCObject.java
=====================================
@@ -116,6 +116,13 @@ public class DSMCCObject extends File {
         }
     }
 
+    public boolean equals(Object obj) {
+        if (!(obj instanceof DSMCCObject)) {
+            return false;
+        }
+        return super.equals(obj);
+    }
+
     public void addObjectChangeEventListener(ObjectChangeEventListener listener)
             throws InsufficientResourcesException {
         org.videolan.Logger.unimplemented(DSMCCObject.class.getName(), "addObjectChangeEventListener");


=====================================
src/libbluray/bdj/java/org/videolan/VFSCache.java
=====================================
@@ -102,7 +102,9 @@ class VFSCache {
 
         if (exception != null) {
             logger.error("Error caching to " + dstPath + ": " + exception);
-            new File(dstPath).delete();
+            if (outStream != null)
+                if (!(new File(dstPath).delete()))
+                    logger.info("Error removing " + dstPath);
             return false;
         }
 


=====================================
src/libbluray/bluray.c
=====================================
@@ -2739,9 +2739,13 @@ static BLURAY_TITLE_INFO *_get_title_info(BLURAY *bd, uint32_t title_idx, uint32
     BLURAY_TITLE_INFO *title_info;
 
     /* current title ? => no need to load mpls file */
+    bd_mutex_lock(&bd->mutex);
     if (bd->title && bd->title->angle == angle && !strcmp(bd->title->name, mpls_name)) {
-        return _fill_title_info(bd->title, title_idx, playlist);
+        title_info = _fill_title_info(bd->title, title_idx, playlist);
+        bd_mutex_unlock(&bd->mutex);
+        return title_info;
     }
+    bd_mutex_unlock(&bd->mutex);
 
     title = nav_title_open(bd->disc, mpls_name, angle);
     if (title == NULL) {



View it on GitLab: https://code.videolan.org/videolan/libbluray/-/compare/39304f38eeb0926ecb96ec40013bf275d175e3ce...5d567c805b98002c88088d3958668eb78298f56d

-- 
View it on GitLab: https://code.videolan.org/videolan/libbluray/-/compare/39304f38eeb0926ecb96ec40013bf275d175e3ce...5d567c805b98002c88088d3958668eb78298f56d
You're receiving this email because of your account on code.videolan.org.




More information about the libbluray-devel mailing list