[libbluray-devel] BD-J playlist player: Drop events when player is being stopped.
hpi1
git at videolan.org
Tue Nov 11 08:07:58 CET 2014
libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Fri Nov 7 14:40:23 2014 +0200| [52390df42fb9ed5152cc70c9f352a7db0136e8eb] | committer: hpi1
BD-J playlist player: Drop events when player is being stopped.
Fixes deadlock when seek is queued before stop.
> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=52390df42fb9ed5152cc70c9f352a7db0136e8eb
---
.../org/videolan/media/content/PlayerManager.java | 38 ++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/src/libbluray/bdj/java/org/videolan/media/content/PlayerManager.java b/src/libbluray/bdj/java/org/videolan/media/content/PlayerManager.java
index 61ba4e7..b30ce6c 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/PlayerManager.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/PlayerManager.java
@@ -41,6 +41,8 @@ public class PlayerManager {
private Object playlistPlayerLock = new Object();
private Object videoDripPlayerLock = new Object();
//private Object audioPlayerLock = new Object();
+ private stoppingLock = new Object();
+ private boolean stopping = false;
public void releaseAllPlayers(boolean unconditional) {
BDHandler[] players = null;
@@ -78,6 +80,9 @@ public class PlayerManager {
protected boolean allocateResource(BDHandler player) {
if (player instanceof org.videolan.media.content.playlist.Handler) {
+ synchronized (stoppingLock) {
+ stopping = true;
+ }
synchronized (playlistPlayerLock) {
if (playlistPlayer != null && player != playlistPlayer) {
playlistPlayer.stop();
@@ -85,6 +90,9 @@ public class PlayerManager {
}
playlistPlayer = player;
}
+ synchronized (stoppingLock) {
+ stopping = false;
+ }
return true;
}
if (player instanceof org.videolan.media.content.sound.Handler) {
@@ -121,72 +129,102 @@ public class PlayerManager {
*/
public void onPlaylistEnd(int playlist) {
+ synchronized (stoppingLock) {
+ if (stopping) return;
synchronized (playlistPlayerLock) {
if (playlistPlayer != null)
playlistPlayer.endOfMedia(playlist);
}
+ }
}
public void onPlaylistTime(int pts) {
+ synchronized (stoppingLock) {
+ if (stopping) return;
synchronized (playlistPlayerLock) {
if (playlistPlayer != null)
playlistPlayer.updateTime(pts);
}
+ }
}
public void onChapterReach(int param) {
+ synchronized (stoppingLock) {
+ if (stopping) return;
synchronized (playlistPlayerLock) {
if (playlistPlayer != null)
playlistPlayer.doChapterReach(param);
}
+ }
}
public void onMarkReach(int param) {
+ synchronized (stoppingLock) {
+ if (stopping) return;
synchronized (playlistPlayerLock) {
if (playlistPlayer != null)
playlistPlayer.doMarkReach(param);
}
+ }
}
public void onPlaylistStart(int param) {
+ synchronized (stoppingLock) {
+ if (stopping) return;
synchronized (playlistPlayerLock) {
if (playlistPlayer != null)
playlistPlayer.doPlaylistStart(param);
}
+ }
}
public void onPlayItemReach(int param) {
+ synchronized (stoppingLock) {
+ if (stopping) return;
synchronized (playlistPlayerLock) {
if (playlistPlayer != null)
playlistPlayer.doPlayItemReach(param);
}
+ }
}
public void onAngleChange(int param) {
+ synchronized (stoppingLock) {
+ if (stopping) return;
synchronized (playlistPlayerLock) {
if (playlistPlayer != null)
playlistPlayer.doAngleChange(param);
}
+ }
}
public void onRateChange(float rate) {
+ synchronized (stoppingLock) {
+ if (stopping) return;
synchronized (playlistPlayerLock) {
if (playlistPlayer != null)
playlistPlayer.updateRate(rate);
}
+ }
}
public void onSubtitleChange(int param) {
+ synchronized (stoppingLock) {
+ if (stopping) return;
synchronized (playlistPlayerLock) {
if (playlistPlayer != null)
playlistPlayer.doSubtitleChange(param);
}
+ }
}
public void onPiPChange(int param) {
+ synchronized (stoppingLock) {
+ if (stopping) return;
synchronized (playlistPlayerLock) {
if (playlistPlayer != null)
playlistPlayer.doPiPChange(param);
}
+ }
}
}
More information about the libbluray-devel
mailing list