I've been having trouble with ED recently as well (the two girls I've had it with were more attractive than any of the girls I slept with pre-game) and I only masturbate once per week and never watch porn. When I broke up with my last gf in January I started jacking it every day for a week, then not at all in February and since the beginning of March I've done it maybe 6 times. So masturbating too much isn't necessarily the cause. It seems the opposite, not masturbating enough, can have the same effect. Ofc, it could be something else entirely, like the fact that I've fallen back into my old sleeping habits (or, should I say, not-sleeping-enough habits). To combat it I've started going to the gym, masturbating 3-4 times per week (and using light touches to resensitise my penis while not trying to last long -- I usually "edge" and started doing Kegels to last longer), bought 5-HTP to help me sleep, and I'm working on my diet. Basically I've taken stock of every lifestyle change I've made recently that could have negatively affected hormones, blood flow, sensation or psychology and I'm undoing them.
Permanent ED is extremely rare by the way -- it only happens when there's severe damage to the nerves or other tissues involved in erection -- and the fact that you can get strong erections in some situations but not others proves that you don't have a purely physiological problem: it's psychological, same for me and same for probably 75% of men under 40 with ED. Of course, there could be a physiological defect like poor bloodflow or low testosterone as well, but diet, exercise and more/better sleep will almost always improve either condition. And even if it is psychological, lifestyle changes will still help: just doing things that you believe help the condition will ease the psychological issues. Also knowing that psychological ED is impermanent even though it can last several months should make you feel better. Taking something like Viagra might help too because seeing that you can get erections when you stop worrying will help you stop working, like a virtuous cycle of positive feedback, but I wouldn't use that as my go-to solution. Next time you have sex make a conscious effort to get out of your head and just enjoy the woman's body and what she's doing to you. Concentrate on the sensations and emotions and try not to think about your díck deflating. If you try all these things and don't notice an improvement after a couple of weeks, see a doctor.
p.s. although I am going to start masturbating more frequently (about every other day) again I'm going to continue being abstinent from porn, and I suggest you do the same. I noticed that when I do masturbate I get the urge to do it again that day and the next day, but if I leave it for a day then the urge doesn't come back. So I figure if I keep doing it on alternate days I'll always have the urge to masturbate or have sex like I used to and my problems will disappear. I hope.