Synchronize on activeAudioPlayers when changing them

master
jvoisin 5 years ago committed by GitHub
parent e7bd5da6fa
commit 8ba97026a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 22
      airsonic-main/src/main/java/org/airsonic/player/service/JukeboxJavaService.java

@ -255,17 +255,19 @@ public class JukeboxJavaService {
return airsonicPlayer.getPlayQueue().getIndex(); return airsonicPlayer.getPlayQueue().getIndex();
} }
}); });
// Close any other player using the same mixer. synchronized (activeAudioPlayers) {
String mixer = airsonicPlayer.getJavaJukeboxMixer(); // Close any other player using the same mixer.
if (StringUtils.isBlank(mixer)) { String mixer = airsonicPlayer.getJavaJukeboxMixer();
mixer = DEFAULT_MIXER_ENTRY_KEY; if (StringUtils.isBlank(mixer)) {
} mixer = DEFAULT_MIXER_ENTRY_KEY;
List<com.github.biconou.AudioPlayer.api.Player> playersForSameMixer = activeAudioPlayersPerMixer.get(mixer);
playersForSameMixer.forEach(player -> {
if (player != audioPlayer) {
player.close();
} }
}); List<com.github.biconou.AudioPlayer.api.Player> playersForSameMixer = activeAudioPlayersPerMixer.get(mixer);
playersForSameMixer.forEach(player -> {
if (player != audioPlayer) {
player.close();
}
});
}
audioPlayer.play(); audioPlayer.play();
} }
} }

Loading…
Cancel
Save