DEV Community

Masui Masanori
Masui Masanori

Posted on

[Pion/WebRTC] Try reading Answer messages 1 (msid-semantic, ssrc)


From this time, I will try reading answer messages.
Most of the lines are same as offer messages because the answer messages are made according to the offer message.

I think the main difference between offer and answer is the addition of msid-semantic and ssrc.
So I will try reading them.


"a=msid-semantic:~" row is added in the session-level section.

SDP Answer Message

o=- 8405074721153909150 2 IN IP4 
t=0 0 
a=group:BUNDLE 0 1 2 
a=msid-semantic: WMS tJtqHKSvpmU907ayq0TVoHEXZKasH43rfz0S
Enter fullscreen mode Exit fullscreen mode

This attribute has a group identifier(tJtqHKSvpmU907ayq0TVoHEXZKasH43rfz0S) and its group semantic(WMS:WebRTC Media Stream).
The value of the identifier is the same as the MediaStream ID of the client that sent the answer.

According to the document below, this attribute is for using "a=msid:~" for WebRTC Media Stream.

But this attribute is only mentioned in older drafts.
So I think this attribute may change format or be removed in the future.

Also, the format of the group identifier varies from client to client.


a=msid-semantic: WMS *
Enter fullscreen mode Exit fullscreen mode


a=msid-semantic: WMS
Enter fullscreen mode Exit fullscreen mode

ssrc(Synchronization Source)

"a=ssrc-group:~" and "a=ssrc:~" rows are added in the media description sections(Video, Audio).

SDP Answer Message

m=video 9 UDP/TLS/RTP/SAVPF 96 97 98 99 102 121 127 120 125 107 108 109 123 118 116
a=msid:tJtqHKSvpmU907ayq0TVoHEXZKasH43rfz0S e246d6fc-71e2-4eaa-9e44-0a6e1793fd12 
a=ssrc-group:FID 3413810401 2077638419 
a=ssrc:3413810401 cname:nGUZl+/ZMBsWAlSN 
a=ssrc:3413810401 msid:tJtqHKSvpmU907ayq0TVoHEXZKasH43rfz0S e246d6fc-71e2-4eaa-9e44-0a6e1793fd12 
a=ssrc:2077638419 cname:nGUZl+/ZMBsWAlSN 
a=ssrc:2077638419 msid:tJtqHKSvpmU907ayq0TVoHEXZKasH43rfz0S e246d6fc-71e2-4eaa-9e44-0a6e1793fd12 
m=audio 9 UDP/TLS/RTP/SAVPF 111 9 0 8 
a=msid:tJtqHKSvpmU907ayq0TVoHEXZKasH43rfz0S 9c775cf1-6300-4535-8e38-73760a8a3f37 
a=ssrc:1964009319 cname:nGUZl+/ZMBsWAlSN 
a=ssrc:1964009319 msid:tJtqHKSvpmU907ayq0TVoHEXZKasH43rfz0S 9c775cf1-6300-4535-8e38-73760a8a3f37 
Enter fullscreen mode Exit fullscreen mode

"ssrc" is for identifing each media sources.

In this sample, every "ssrc" associate "cname", "msid", and "appdata".

In a RTP session, after updating the media source, "ssrc" will be changed.
To avoid losting the media source in the RTP session, "cname" is required when the SDP has "a=ssrc" rows.

At least if the SDP is made by Chrome(Chromium), "msid" is the same as MediaStream ID in JavaScript and "appdata" is the same as MediaStreamTrack.

Because the video stream sends packets with retransmitted packets, this sample has two "ssrc" for video, so "ssrc-group" associats them.

Top comments (0)