From Islamic perspective, moral boundries defined by Quran should always be followed in all circumstances.
In order to determine prohibitions in religion, it is better to break them down in terms of prohibitions mentioned in Quran 7:33 which would be the following five categories:
1) Fawahish
2) Usurping the rights of Others
3) Oppression
4) Polytheism
5) Biddah
Contemporary comedy (as explained in the question) is seen to usually violate the prohibitions involving Fawahish and Oppression. Use of vulgur/abusive language cannot be tolerated just because something is a joke. Such language is by nature prohibited (in absolute sense), so it will stay prohibited irrespective of the scenario. The issue of oppression arises when jokes are cracked at the expense of another person by exploiting his/her physical traits, personality traits, age, race or caste etc. Such jokes are considered an attack on another person’s honour. In such matters, which involve absolute ethical prohibitions, the consent of the other person is not enough to make them acceptable. The same can be understood by comparing it to Gambling where consent of every person is available yet it is considered prohibited because of ethical violations which are not dependent on the consent of the person solely.
__
Following comments of Ghamidi Sahab are also relevant to the discussion:
https://www.javedahmedghamidi.org/#!/video/5aabdb57b951cb6c099ea6e3