java-stream-player icon indicating copy to clipboard operation
java-stream-player copied to clipboard

Test with reset() behaves oddly

Open HelgeStenstrom opened this issue 6 years ago • 6 comments

reset() is a public method. If it's called when the player is playing, it seems to not return. I cannot really see what is executing when I run the test in the debugger.

The test print "play()", and goes on to play the song. It never prints "reset()"

Expected behavior: The player is stopped so quickly, that no music is heard. Maxium one frame of sound samples. The word "reset() should be printed after "play()".

What can be learnt from this behavior?

HelgeStenstrom avatar Sep 10 '19 20:09 HelgeStenstrom

This is more of a bug report than a real pull request. The PR has one test, and the test doesn't end quickly as tests should, so it's useless as a unit test. But it might be good for illustrating a problem.

HelgeStenstrom avatar Sep 10 '19 20:09 HelgeStenstrom

Reset never returns because (audiolock) is already locked by call method when the sound is playing, so it stuck on synchronized(audiolock) until the sound stops or pauses and the lock is getting free. One thing could be that reset internally calls stop first but actually we can make reset private if it's not needed.

goxr3plus avatar Sep 11 '19 00:09 goxr3plus

Should i merge this :)?

goxr3plus avatar Sep 13 '19 18:09 goxr3plus

No, that wasn't the intention. It's more of documentation for the bug report.

HelgeStenstrom avatar Sep 14 '19 11:09 HelgeStenstrom

Good

goxr3plus avatar Sep 15 '19 03:09 goxr3plus

I need to redesign then

goxr3plus avatar Sep 15 '19 03:09 goxr3plus