This happened over a year ago so there's not much point bringing it up at work now, but I did see a senior (male) colleague repeatedly masturbating in the office. At the time I (also male, junior) was taken aback and didn't really know what to do. It made me feel uncomfortable, and I still can't look at this colleague the same way now. It's not abhorrent behaviour in and of itself; everyone masturbates, but not at work in view of people, come on.
The incidents happened during the evening when most people had gone home. We were in different rooms, but I could see him through a window from where I sat. He could kind of see me but I had a better view of him. He never did it when anyone was in the room with him. I don't know whether he was aware that he was visible to me - he could see me if he looked, so I think he probably was aware.
This colleague is very senior, well-known and respected, and is very good at his job. That was one reason why I didn't say anything at the time; losing him would be a fairly large blow to the company.
Another reason I didn't say anything was that it felt very awkward doing so. Usually I'm pretty direct, but I couldn't bring myself to go up to him and say:
Oh by the way, I saw you masturbating and it made me feel uncomfortable, please don't do that.
Or going to my manager/HR and saying something similar.
So ultimately I let it be. I don't know if anyone else was aware of it.
Since then I haven't seen him masturbating at work.
I don't want to get him in trouble, and I certainly don't want to get him fired - he's a nice enough guy, maybe he was going through a rough patch in life, I don't know. But I want to know what the most appropriate way to get him to stop at the time would have been, because it did happen for several weeks, and it did distract me and make me feel uncomfortable.
I have spoken to close friends about it, and they mostly say that I should have raised it with HR - but I don't think they appreciate how uncomfortable the whole thing made me feel. It's easy for others to say what you should do when they don't have to do it themselves.