DEV Community

Masui Masanori
Masui Masanori

Posted on

[Pion/WebRTC] Try reading Offer messages

Intro

This time, I will try reading Offer messages.
I output the logs of my application created with Pion/WebRTC.

Both the client and server side run on a single machine.

Environments

  • Surface Pro 6
  • Windows 11 Pro Insider Preview ver.22H2
  • Google Chrome ver.103.0.5060.66
  • Go ver.go1.18.3 windows/amd64
  • Pion/WebRTC ver.3.1.42

SDP(Session Description Protocol)

Peers send data to each other in SDP format to establish a WebRTC connection.

According to SDP specifications, the Offer message can be divided into four parts.

Although my application can share video and audio tracks with multiple clients, the stream to establish WebRTC connection is Unicast stream.

Offer

Session-Level Section

SDP Offer Message

# [RFC8866 - 5.1] Session Description Protocol version is 0
v=0
# [RFC8866 - 5.2] user-name:-, sess-id:8899840538985226342, sess-verison:1656783194
#   nettype:Internet, addtype:IPv4, unicast-address:0.0.0.0
o=- 8899840538985226342 1656783194 IN IP4 0.0.0.0
# [RFC8866 - 5.3][RFC3264 - 5] Session Name:-
s=-
# [RFC8866 - 5.9][RFC3264 - 5] The session is regarded as permanent
t=0 0
# [RFC8445 - 7.2.4][RFC8122 - 5] A finger print for connectivity check
a=fingerprint:sha-256 B5:9E:D5:18:B5:CB:F6:2C:C7:E9:4B:03:08:98:70:AC:4F:49:1D:B5:A1:90:85:5C:22:83:92:AA:17:FB:C8:3E
# [RFC8285 - 6] Negotiate the use of one byte and two bytes in the same RTP stream
#   (RFC8285 - 4.1.2, 4.2, 4.3)
a=extmap-allow-mixed
# [RFC5888 - 5][RFC8859 - 4.5][RFC8843 - 7.2.1] Use a single transport for sending and receiving medias
#   (video, audio, data channel)
a=group:BUNDLE 0 1 2
...
Enter fullscreen mode Exit fullscreen mode

Media Description(Video)

Most lines are media-level attributes for adding information about the media description.

SDP Offer Message

...
# [RFC8866 - 5.14][RFC8840 - 4.1.1][RFC8839 - 4.2.5][RFC4145 - 4]
# media type:video, transport port:9, transport protocol: UDP/TLS/RTP/SAVPF
#   format: 96 97 98 99 100 101 102 121 127 120 125 107 108 109 123 118 116
m=video 9 UDP/TLS/RTP/SAVPF 96 97 98 99 100 101 102 121 127 120 125 107 108 109 123 118 116
# [RFC8866 - 5.7][RFC8839 - 4.2.5][RFC9143 - 7.1] This value must be the same with other bundled medias
c=IN IP4 0.0.0.0
# [RFC4145 - 4] The endpoint is willing to accept an incoming connection or to initiate an outgoing connection.
a=setup:actpass
# [RFC5888 - 4] Media Stream ID for grouping
a=mid:0
# [RFC8839 - 4.2.1.3, 4.2.5, 5.4] username fragment for STUN connectivity checks
a=ice-ufrag:hqOEoWujrDVDRqSt
# [RFC8839 - 4.2.1.3, 4.2.5, 5.4] password for STUN connectivity checks
a=ice-pwd:geVGJdXTqMLAdRTrCdzbcfebBTcXhSsg
# [RFC5761 - 5.1.1][RFC9143 - 9.3.1] Multiplex RTP and RTCP onto a single port
a=rtcp-mux
# [RFC5506 - 5] To use Reduced-Size RTCP
a=rtcp-rsize
# [RFC8866 - 6.6] RTP payload type number:96, media format:VP8/90000
# media format: encoding-name/clock-rate
a=rtpmap:96 VP8/90000
# [RFC4585 - 4.2] RTCP Feedback
# [RFC4585][https://datatracker.ietf.org/doc/html/draft-alvestrand-rmcat-remb-03 - 2.3]
a=rtcp-fb:96 goog-remb 
# [RFC4585][RFC5104]
a=rtcp-fb:96 ccm fir
# [RFC4585 - 6.2.1] Generic NACK
a=rtcp-fb:96 nack 
# [RFC4585 - 6.3.1] Picture Loss Indication (PLI)
a=rtcp-fb:96 nack pli
# [RFC4585 - 6.2.1]
a=rtcp-fb:96 nack
# [RFC4585 - 6.3.1]
a=rtcp-fb:96 nack pli
a=rtcp-fb:96 transport-cc 
# [RFC8866 - 6.6]
a=rtpmap:97 rtx/90000
# [RFC8866 - 6.15] Media format-specific parameters what associated with the payload type number.
a=fmtp:97 apt=96
# [RFC4585 - 6.2.1]
a=rtcp-fb:97 nack 
# [RFC4585 - 6.3.1]
a=rtcp-fb:97 nack pli
a=rtcp-fb:97 transport-cc
# [RFC8866 - 6.6]
a=rtpmap:98 VP9/90000
# [RFC8866 - 6.15]
a=fmtp:98 profile-id=0
# [RFC4585][https://datatracker.ietf.org/doc/html/draft-alvestrand-rmcat-remb-03 - 2.3]
a=rtcp-fb:98 goog-remb 
# [RFC4585][RFC5104]
a=rtcp-fb:98 ccm fir
# [RFC4585 - 6.2.1]
a=rtcp-fb:98 nack 
# [RFC4585 - 6.3.1]
a=rtcp-fb:98 nack pli
# [RFC4585 - 6.2.1]
a=rtcp-fb:98 nack 
# [RFC4585 - 6.3.1]
a=rtcp-fb:98 nack pli
a=rtcp-fb:98 transport-cc 
# [RFC8866 - 6.6]
a=rtpmap:99 rtx/90000
# [RFC8866 - 6.15]
a=fmtp:99 apt=98
# [RFC4585 - 6.2.1]
a=rtcp-fb:99 nack 
# [RFC4585 - 6.3.1]
a=rtcp-fb:99 nack pli
a=rtcp-fb:99 transport-cc
# [RFC8866 - 6.6]
a=rtpmap:100 VP9/90000
# [RFC8866 - 6.15]
a=fmtp:100 profile-id=1
# [RFC4585][https://datatracker.ietf.org/doc/html/draft-alvestrand-rmcat-remb-03 - 2.3]
a=rtcp-fb:100 goog-remb 
# [RFC4585][RFC5104]
a=rtcp-fb:100 ccm fir
# [RFC4585 - 6.2.1]
a=rtcp-fb:100 nack
# [RFC4585 - 6.3.1]
a=rtcp-fb:100 nack pli
# [RFC4585 - 6.2.1]
a=rtcp-fb:100 nack 
# [RFC4585 - 6.3.1]
a=rtcp-fb:100 nack pli
a=rtcp-fb:100 transport-cc
# [RFC8866 - 6.6]
a=rtpmap:101 rtx/90000
# [RFC8866 - 6.15]
a=fmtp:101 apt=100
# [RFC4585 - 6.2.1]
a=rtcp-fb:101 nack 
# [RFC4585 - 6.3.1]
a=rtcp-fb:101 nack pli
a=rtcp-fb:101 transport-cc
# [RFC8866 - 6.6]
a=rtpmap:102 H264/90000
# [RFC8866 - 6.15]
a=fmtp:102 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f
# [RFC4585][https://datatracker.ietf.org/doc/html/draft-alvestrand-rmcat-remb-03 - 2.3]
a=rtcp-fb:102 goog-remb
# [RFC4585][RFC5104]
a=rtcp-fb:102 ccm fir
# [RFC4585 - 6.2.1]
a=rtcp-fb:102 nack
# [RFC4585 - 6.3.1]
a=rtcp-fb:102 nack pli
# [RFC4585 - 6.2.1]
a=rtcp-fb:102 nack 
# [RFC4585 - 6.3.1]
a=rtcp-fb:102 nack pli
a=rtcp-fb:102 transport-cc
# [RFC8866 - 6.6]
a=rtpmap:121 rtx/90000
# [RFC8866 - 6.15]
a=fmtp:121 apt=102
# [RFC4585 - 6.2.1]
a=rtcp-fb:121 nack 
# [RFC4585 - 6.3.1]
a=rtcp-fb:121 nack pli
a=rtcp-fb:121 transport-cc
# [RFC8866 - 6.6]
a=rtpmap:127 H264/90000
# [RFC8866 - 6.15]
a=fmtp:127 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42001f
# [RFC4585][https://datatracker.ietf.org/doc/html/draft-alvestrand-rmcat-remb-03 - 2.3]
a=rtcp-fb:127 goog-remb
# [RFC4585][RFC5104]
a=rtcp-fb:127 ccm fir
# [RFC4585 - 6.2.1]
a=rtcp-fb:127 nack 
# [RFC4585 - 6.3.1]
a=rtcp-fb:127 nack pli
# [RFC4585 - 6.2.1]
a=rtcp-fb:127 nack 
# [RFC4585 - 6.3.1]
a=rtcp-fb:127 nack pli
a=rtcp-fb:127 transport-cc
# [RFC8866 - 6.6]
a=rtpmap:120 rtx/90000
# [RFC8866 - 6.15]
a=fmtp:120 apt=127
# [RFC4585 - 6.2.1]
a=rtcp-fb:120 nack 
# [RFC4585 - 6.3.1]
a=rtcp-fb:120 nack pli
a=rtcp-fb:120 transport-cc 
# [RFC8866 - 6.6]
a=rtpmap:125 H264/90000
# [RFC8866 - 6.15]
a=fmtp:125 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f
# [RFC4585][https://datatracker.ietf.org/doc/html/draft-alvestrand-rmcat-remb-03 - 2.3]
a=rtcp-fb:125 goog-remb
# [RFC4585][RFC5104]
a=rtcp-fb:125 ccm fir
# [RFC4585 - 6.2.1]
a=rtcp-fb:125 nack
# [RFC4585 - 6.3.1]
a=rtcp-fb:125 nack pli
# [RFC4585 - 6.2.1]
a=rtcp-fb:125 nack 
# [RFC4585 - 6.3.1]
a=rtcp-fb:125 nack pli
a=rtcp-fb:125 transport-cc 
# [RFC8866 - 6.6]
a=rtpmap:107 rtx/90000
# [RFC8866 - 6.15]
a=fmtp:107 apt=125
# [RFC4585 - 6.2.1]
a=rtcp-fb:107 nack 
# [RFC4585 - 6.3.1]
a=rtcp-fb:107 nack pli
a=rtcp-fb:107 transport-cc 
# [RFC8866 - 6.6]
a=rtpmap:108 H264/90000
# [RFC8866 - 6.15]
a=fmtp:108 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42e01f
# [RFC4585][https://datatracker.ietf.org/doc/html/draft-alvestrand-rmcat-remb-03 - 2.3]
a=rtcp-fb:108 goog-remb
# [RFC4585][RFC5104]
a=rtcp-fb:108 ccm fir
# [RFC4585 - 6.2.1]
a=rtcp-fb:108 nack 
# [RFC4585 - 6.3.1]
a=rtcp-fb:108 nack pli
# [RFC4585 - 6.2.1]
a=rtcp-fb:108 nack 
# [RFC4585 - 6.3.1]
a=rtcp-fb:108 nack pli
a=rtcp-fb:108 transport-cc 
# [RFC8866 - 6.6]
a=rtpmap:109 rtx/90000
# [RFC8866 - 6.15]
a=fmtp:109 apt=108
# [RFC4585 - 6.2.1]
a=rtcp-fb:109 nack 
# [RFC4585 - 6.3.1]
a=rtcp-fb:109 nack pli
a=rtcp-fb:109 transport-cc 
# [RFC8866 - 6.6]
a=rtpmap:123 H264/90000
# [RFC8866 - 6.15]
a=fmtp:123 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=640032
# [RFC4585][https://datatracker.ietf.org/doc/html/draft-alvestrand-rmcat-remb-03 - 2.3]
a=rtcp-fb:123 goog-remb
# [RFC4585][RFC5104]
a=rtcp-fb:123 ccm fir
# [RFC4585 - 6.2.1]
a=rtcp-fb:123 nack 
# [RFC4585 - 6.3.1]
a=rtcp-fb:123 nack pli
# [RFC4585 - 6.2.1]
a=rtcp-fb:123 nack 
# [RFC4585 - 6.3.1]
a=rtcp-fb:123 nack pli
a=rtcp-fb:123 transport-cc 
# [RFC8866 - 6.6]
a=rtpmap:118 rtx/90000
# [RFC8866 - 6.15]
a=fmtp:118 apt=123
# [RFC4585 - 6.2.1]
a=rtcp-fb:118 nack 
# [RFC4585 - 6.3.1]
a=rtcp-fb:118 nack pli
a=rtcp-fb:118 transport-cc 
# [RFC8866 - 6.6]
a=rtpmap:116 ulpfec/90000
# [RFC4585 - 6.2.1]
a=rtcp-fb:116 nack 
# [RFC4585 - 6.3.1]
a=rtcp-fb:116 nack pli
a=rtcp-fb:116 transport-cc
# https://datatracker.ietf.org/doc/html/draft-holmer-rmcat-transport-wide-cc-extensions-01
# RTP header extension and an RTCP message   for use in congestion control algorithms for RTP-based media flows
a=extmap:1 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
# [RFC8866 - 6.7.1] Receive-Only
a=recvonly
...
Enter fullscreen mode Exit fullscreen mode

Media Description(Audio)

SDP Offer Message

...
# [RFC8866 - 5.14][RFC8840 - 4.1.1][RFC8839 - 4.2.5][RFC4145 - 4]
m=audio 9 UDP/TLS/RTP/SAVPF 111 9 0 8
# [RFC8866 - 5.7][RFC8839 - 4.2.5]
c=IN IP4 0.0.0.0
# [RFC4145 - 4]
a=setup:actpass
# [RFC5888 - 4]
a=mid:1
# [RFC8839 - 4.2.1.3, 4.2.5, 5.4] 
a=ice-ufrag:hqOEoWujrDVDRqSt
# [RFC8839 - 4.2.1.3, 4.2.5, 5.4] 
a=ice-pwd:geVGJdXTqMLAdRTrCdzbcfebBTcXhSsg
# [RFC5761 - 5.1.1][RFC9143 - 9.3.1]
a=rtcp-mux
# [RFC5506 - 5] 
a=rtcp-rsize
# [RFC8866 - 6.6]
a=rtpmap:111 opus/48000/2
# [RFC8866 - 6.15]
a=fmtp:111 minptime=10;useinbandfec=1
a=rtcp-fb:111 transport-cc 
# [RFC8866 - 6.6]
a=rtpmap:9 G722/8000
a=rtcp-fb:9 transport-cc 
# [RFC8866 - 6.6]
a=rtpmap:0 PCMU/8000
a=rtcp-fb:0 transport-cc 
# [RFC8866 - 6.6]
a=rtpmap:8 PCMA/8000
a=rtcp-fb:8 transport-cc
# https://datatracker.ietf.org/doc/html/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:1 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
# [RFC8866 - 6.7.1] Receive-Only
a=recvonly
...
Enter fullscreen mode Exit fullscreen mode

Media Description(Data Channel)

SDP Offer Message

...
# [RFC8866 - 5.14][RFC8840 - 4.1.1][RFC8839 - 4.2.5][RFC4145 - 4][RFC8864]
# media type:application, transport port:9, transport protocol: UDP/DTLS/SCTP
#   format: webrtc-datachannel
m=application 9 UDP/DTLS/SCTP webrtc-datachannel
# [RFC8866 - 5.7][RFC8839 - 4.2.5]
c=IN IP4 0.0.0.0
# [RFC4145 - 4]
a=setup:actpass
# [RFC5888 - 4]
a=mid:2
# [RFC8866 - 6.7.2] Send-Receive
a=sendrecv
# [RFC8841 - 5] SCTP-Port: Because "sctp-port" has no default value, this line can't be omitted
a=sctp-port:5000
# [RFC8839 - 4.2.1.3, 4.2.5, 5.4] 
a=ice-ufrag:hqOEoWujrDVDRqSt
# [RFC8839 - 4.2.1.3, 4.2.5, 5.4] 
a=ice-pwd:geVGJdXTqMLAdRTrCdzbcfebBTcXhSsg
Enter fullscreen mode Exit fullscreen mode

Resources

Top comments (0)