goxr3plus / java-stream-player

🌌Java Advanced Audio Controller Library (WAV, AU, AIFF, MP3, OGG VORBIS, FLAC, MONKEY's AUDIO and SPEEX audio formats )
GNU General Public License v3.0
147 stars 33 forks source link

Solves "Synchronization on a non-final field 'audioLock'" #46

Closed HelgeStenstrom closed 5 years ago

HelgeStenstrom commented 5 years ago

as reported by IntelliJ: Analyze --> Inspect Code...

This shouldn't change any actual behavior, since there are no write operations on audioLock. So effectivly, it was already final and non-volatile. This change explicitly forbids write operations on audioLock.

Tested, of course.

goxr3plus commented 5 years ago

This needs to be tested with XR3Player which can pause, resume, play and skip all from different Threads. I am merging for now, this change has a big importance.

Probably we change all together synchronized blocks with something more recent like Atomic locks or something.

I have saw some guys implementing their own version of StreamPlayer which had very big performance boost.

I can't find their library on bit bucket.

It was a Java media player on SourceForge and they had their code published on Bitbucket.

They have an amazing implementation of StreamPlayer and new Spectrum Analyzer API.

I have to find it... Like literally I was impressed but I didn't had the knowledge back then.

goxr3plus commented 5 years ago

Please check => #47