gateship-one / odyssey

Odyssey music player
GNU General Public License v3.0
232 stars 39 forks source link

Sound explosion on switching songs stored as flac #158

Closed Xylon2 closed 6 years ago

Xylon2 commented 6 years ago

When playing a flac, and then switching to a different song half-way through, I get a massive explosion of sound. Like white noise but 100 times louder. It's about half a second I guess.

I converted my whole music library to wav because of this bug.

djselbeck commented 6 years ago

What phone and what firmware are you using. It is likely a bug in the system

Xylon2 commented 6 years ago

Samsung Galaxy S7 (SM-G930F).

Self-built LineageOS 14.1

Xylon2 commented 6 years ago

OK it actually happened to me today with the default Android music player too. I guess this can be closed.

Xylon2 commented 6 years ago

I've done some debugging on this and it happens when odysey calls mCurrentMediaPlayer.prepareAsync(); on line 206 of GaplessPlayer.java

Xylon2 commented 6 years ago

and FYI it happens with both flac and wav

djselbeck commented 6 years ago

It cannot happen (if everything works as expected) at line 206 of GaplessPlayer because the line can only be reached if no audio is playing.

djselbeck commented 6 years ago

With a high probability based on my experience with both Android high level and low level AOSP development, I would guess it is a bug in the hardware acceleration of audio decoding in your device firmware. But this is just a wild guess.

Xylon2 commented 6 years ago

Ah your right it happens at line 469 when it calls mp.start()

I tested by adding a Thread.sleep before and after.If it's before then there's delay before the explosion happens. If it's after then the explosion happens immediately.

I'm sure it's a system level issue but I thought there might be a way to avoid it at music-player level. It doesn't happen the first song it plays after I start Odyssey. It also doesn't happen if it runs through the playlist without being interrupted. The two things that cause it are:

If I can Neuter Odyssey's ability to switch songs halfway through maybe it will stop this happening. It's so loud it scares the hell out of me and probably damages my hearing so I'm just trying to develop a hack to stop it.