Skip to content

media: a G.722 offer with no a=rtpmap is rejected #158

Description

@Mliviu79

RFC 3551 section 6 assigns G.722 the static payload type 9, so an offer of

m=audio 34391 RTP/AVP 9

with no a=rtpmap line is conformant. diago rejects the call.

CodecsFromSDPRead only appends a codec from inside the a=rtpmap matching branch, apart from the static fast paths for 0 and 8. With G.722 as the only codec and no rtpmap, zero codecs resolve and RemoteSDP returns "no codecs found in SDP".

There is no caller-side workaround, since CodecsFromSDPRead is unexported.

Fix: add CodecAudioG722 (payload type 9, clock 8000, mono) and the FORMAT_TYPE_G722 SDP constant, and give the static path an arm for 9 alongside the existing ulaw and alaw ones. The static arm is placed before the rtpmap loop so a peer advertising G722/16000 does not override the clock.

On the clock: RFC 3551 section 4.5.2 sets the RTP clock for G.722 to 8000 even though the codec samples at 16 kHz. SampleTimestamp() is SampleRate * SampleDur, so 16000 would advance the RTP timestamp at twice the wire rate.

Both SDP generators get an explicit "a=rtpmap:9 G722/8000" arm rather than the generic default, which formats as "%d %s/%d/%d" and would emit "G722/8000/1" — some peers do not match the channel-count suffix.

The default codec set is unchanged, so G.722 only negotiates if a caller puts it in MediaConfig.Codecs — same as opus today.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions