sipsorcery icon indicating copy to clipboard operation
sipsorcery copied to clipboard

SDPAudioVideoMediaFormat WithUpdated methods should use current object not a format parameter

Open SteveAyre opened this issue 8 months ago • 0 comments

SDPAudioVideoMediaFormat has 3 WithUpdated methods:

        public SDPAudioVideoMediaFormat WithUpdatedID(int id, SDPAudioVideoMediaFormat format)
        public SDPAudioVideoMediaFormat WithUpdatedRtpmap(string rtpmap, SDPAudioVideoMediaFormat format)
        public SDPAudioVideoMediaFormat WithUpdatedFmtp(string fmtp, SDPAudioVideoMediaFormat format)

This format parameter would suggest these are static methods, but they are object methods. As such it would make more sense to copy the this object.

This is the approach already used on SDPApplicationMediaFormat:

        public SDPApplicationMediaFormat WithUpdatedID(string id)
        public SDPApplicationMediaFormat WithUpdatedRtpmap(string rtpmap)
        public SDPApplicationMediaFormat WithUpdatedFmtp(string fmtp)

It would make sense to use this interface on both for consistency.

SteveAyre avatar Jun 13 '24 10:06 SteveAyre