Default headphone audio switches to speaker when making call

This started a week ago when I tried out a new rom with this problem. I clean wiped and downloaded another more stock rom, and the problem still remains.


Basically, the headphone sounds great as always, other than the few times when too many apps are updated and the sound becomes choppy. However when someone calls me or I call someone, the headphone looses all connectivity yet it still thinks its connected. When I try to play music or any other audio after this, it too now plays through speakers and not the headphone. Only when I take it out it and put it back in does it sometimes turn to normal. Otherwise the only thing I can do is a reboot.

Tried this with 2 different headphones.

Lost root for now so don't have the logcat.