Masturbation and ED

Is there a definite connection between ED and viewing of pornography (accompanied by masturbation)?

I like to watch porn. I also like to write erotica. When I do either, I like to masturbate. I do wonder, though, if that is contributing to ED with my wife because of comparison, visual stimulation, and other various considerations.