Default My HTC One tries to make me deaf :(

Hey guys

I have a problem with listening music on my htc one. Sometimes (quite often) when I turn on music from my phone on headphones the music starts playing on maximum volume level before it goes back to the one that was set before. This causes those short superloud clicks that hurts my ears.

Does anyone know how do you fix it? I believe its a software problem since it was the problem on my earlier HTC One too.

thanks in advance