elixir-webrtc / ex_webrtc

An Elixir implementation of the W3C WebRTC API
Apache License 2.0
363 stars 14 forks source link

RTP demuxer fails when decoding RTX padding packet #129

Closed sgfn closed 4 months ago

sgfn commented 4 months ago

Error (peer_connection.ex:1139)

[error] Unable to demux RTP packet

Versions

* ex_dtls 0.15.1 (Hex package) (mix)
  locked at 0.15.1 (ex_dtls) 9cfebdfe
  ok
* ex_ice 0.7.1 (Hex package) (mix)
  locked at 0.7.1 (ex_ice) 78e6bc4a
  ok
* ex_libsrtp 0.7.2 (Hex package) (mix)
  locked at 0.7.2 (ex_libsrtp) 2e20645d
  ok
* ex_rtcp 0.4.0 (Hex package) (mix)
  locked at 0.4.0 (ex_rtcp) 28956602
  ok
* ex_rtp 0.4.0 (Hex package) (mix)
  locked at 0.4.0 (ex_rtp) 0f72d80d
  ok
* ex_sdp 0.17.0 (Hex package) (mix)
  locked at 0.17.0 (ex_sdp) c7fe0625
  ok
* ex_stun 0.2.0 (Hex package) (mix)
  locked at 0.2.0 (ex_stun) 1e01ba82
  ok
* ex_turn 0.1.0 (Hex package) (mix)
  locked at 0.1.0 (ex_turn) d677737f
  ok
* ex_webrtc 0.3.0 (Hex package) (mix)
  locked at 0.3.0 (ex_webrtc) a8a4f38c
  ok

Packet

%ExRTP.Packet{
  payload_type: 97,
  sequence_number: 27345,
  timestamp: 0,
  ssrc: 3984689052,
  payload: "",
  version: 2,
  padding: true,
  extension: true,
  marker: false,
  csrc: [],
  extension_profile: 48862,
  extensions: [%ExRTP.Packet.Extension{id: 3, data: <<0, 3>>}],
  padding_size: 255
}

Demuxer state

%ExWebRTC.PeerConnection.Demuxer{
  ssrc_to_mid: %{341204668 => "1", 2343971353 => "0"},
  mid_ext_id: 1,
  pt_to_mid: %{}
}

Offer

v=0
o=- 31029109419067238 0 IN IP4 127.0.0.1
s=-
t=0 0
a=ice-options:trickle
a=group:BUNDLE 0 1 2 3
a=extmap-allow-mixed
a=msid-semantic:WMS *
m=video 9 UDP/TLS/RTP/SAVPF 96 97
c=IN IP4 0.0.0.0
a=rtcp:9 IN IP4 0.0.0.0
a=recvonly
a=mid:0
a=ice-ufrag:w44P
a=ice-pwd:tDBZSBL7rvo05A92JNnBUw==
a=ice-options:trickle
a=fingerprint:sha-256 B4:12:9A:19:72:30:E0:A3:B7:C3:78:15:36:F5:13:3B:C8:7E:3F:92:9A:22:87:0D:93:FB:96:F4:DF:4D:62:42
a=setup:actpass
a=rtcp-mux
a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid
a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id
a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id
a=rtpmap:96 VP8/90000
a=rtcp-fb:96 nack
a=rtcp-fb:96 transport-cc
a=rtcp-fb:96 nack pli
a=rtcp-fb:96 ccm fir
a=rtpmap:97 rtx/90000
a=fmtp:97 apt=96
m=audio 9 UDP/TLS/RTP/SAVPF 111
c=IN IP4 0.0.0.0
a=rtcp:9 IN IP4 0.0.0.0
a=recvonly
a=mid:1
a=ice-ufrag:w44P
a=ice-pwd:tDBZSBL7rvo05A92JNnBUw==
a=ice-options:trickle
a=fingerprint:sha-256 B4:12:9A:19:72:30:E0:A3:B7:C3:78:15:36:F5:13:3B:C8:7E:3F:92:9A:22:87:0D:93:FB:96:F4:DF:4D:62:42
a=setup:actpass
a=rtcp-mux
a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid
a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=rtpmap:111 opus/48000/2
a=rtcp-fb:111 transport-cc
m=video 9 UDP/TLS/RTP/SAVPF 96 97
c=IN IP4 0.0.0.0
a=rtcp:9 IN IP4 0.0.0.0
a=sendonly
a=mid:2
a=ice-ufrag:w44P
a=ice-pwd:tDBZSBL7rvo05A92JNnBUw==
a=ice-options:trickle
a=fingerprint:sha-256 B4:12:9A:19:72:30:E0:A3:B7:C3:78:15:36:F5:13:3B:C8:7E:3F:92:9A:22:87:0D:93:FB:96:F4:DF:4D:62:42
a=setup:actpass
a=rtcp-mux
a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid
a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id
a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id
a=msid:G7E33KZCTWS73XECX3SISU5BUCZZ2LMP 78562607892595419815202402666
a=rtpmap:96 VP8/90000
a=rtcp-fb:96 nack
a=rtcp-fb:96 transport-cc
a=rtcp-fb:96 nack pli
a=rtcp-fb:96 ccm fir
a=rtpmap:97 rtx/90000
a=fmtp:97 apt=96
m=audio 9 UDP/TLS/RTP/SAVPF 111
c=IN IP4 0.0.0.0
a=rtcp:9 IN IP4 0.0.0.0
a=sendonly
a=mid:3
a=ice-ufrag:w44P
a=ice-pwd:tDBZSBL7rvo05A92JNnBUw==
a=ice-options:trickle
a=fingerprint:sha-256 B4:12:9A:19:72:30:E0:A3:B7:C3:78:15:36:F5:13:3B:C8:7E:3F:92:9A:22:87:0D:93:FB:96:F4:DF:4D:62:42
a=setup:actpass
a=rtcp-mux
a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid
a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=msid:G7E33KZCTWS73XECX3SISU5BUCZZ2LMP 17533364118069262875592596908
a=rtpmap:111 opus/48000/2
a=rtcp-fb:111 transport-cc

Answer

v=0
o=- 5105218418410676618 2 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE 0 1 2 3
a=extmap-allow-mixed
a=msid-semantic: WMS
m=video 50212 UDP/TLS/RTP/SAVPF 96 97
c=IN IP4 1.2.3.4
a=rtcp:9 IN IP4 0.0.0.0
a=candidate:3261013555 1 udp 2122260223 192.168.82.219 50212 typ host generation 0 network-id 1 network-cost 10
a=candidate:59853177 1 udp 1686052607 1.2.3.4 50212 typ srflx raddr 192.168.82.219 rport 50212 generation 0 network-id 1 network-cost 10
a=candidate:3163618475 1 tcp 1518280447 192.168.82.219 9 typ host tcptype active generation 0 network-id 1 network-cost 10
a=ice-ufrag:mSzr
a=ice-pwd:qPYYNlkST5S/WkAbQXJ9+I1q
a=ice-options:trickle
a=fingerprint:sha-256 A0:2A:73:FD:C6:6E:0F:ED:DC:09:0E:F4:2F:67:FE:8F:03:AF:27:76:8F:41:F8:DB:77:D9:01:A0:CB:81:D6:7C
a=setup:active
a=mid:0
a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid
a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id
a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id
a=sendonly
a=msid:- 6bbedb4e-ca11-4c56-9726-2c6e69a72463
a=rtcp-mux
a=rtpmap:96 VP8/90000
a=rtcp-fb:96 transport-cc
a=rtcp-fb:96 ccm fir
a=rtcp-fb:96 nack
a=rtcp-fb:96 nack pli
a=rtpmap:97 rtx/90000
a=fmtp:97 apt=96
a=ssrc-group:FID 2343971353 3984689052
a=ssrc:2343971353 cname:AmuRgxs+9JzwkmSG
a=ssrc:3984689052 cname:AmuRgxs+9JzwkmSG
m=audio 9 UDP/TLS/RTP/SAVPF 111
c=IN IP4 0.0.0.0
a=rtcp:9 IN IP4 0.0.0.0
a=ice-ufrag:mSzr
a=ice-pwd:qPYYNlkST5S/WkAbQXJ9+I1q
a=ice-options:trickle
a=fingerprint:sha-256 A0:2A:73:FD:C6:6E:0F:ED:DC:09:0E:F4:2F:67:FE:8F:03:AF:27:76:8F:41:F8:DB:77:D9:01:A0:CB:81:D6:7C
a=setup:active
a=mid:1
a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid
a=sendonly
a=msid:- 5ce40c59-0091-40b4-8587-8755d1749539
a=rtcp-mux
a=rtpmap:111 opus/48000/2
a=rtcp-fb:111 transport-cc
a=fmtp:111 minptime=10;useinbandfec=1
a=ssrc:341204668 cname:AmuRgxs+9JzwkmSG
m=video 9 UDP/TLS/RTP/SAVPF 96 97
c=IN IP4 0.0.0.0
a=rtcp:9 IN IP4 0.0.0.0
a=ice-ufrag:mSzr
a=ice-pwd:qPYYNlkST5S/WkAbQXJ9+I1q
a=ice-options:trickle
a=fingerprint:sha-256 A0:2A:73:FD:C6:6E:0F:ED:DC:09:0E:F4:2F:67:FE:8F:03:AF:27:76:8F:41:F8:DB:77:D9:01:A0:CB:81:D6:7C
a=setup:active
a=mid:2
a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid
a=extmap:2 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id
a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id
a=recvonly
a=rtcp-mux
a=rtpmap:96 VP8/90000
a=rtcp-fb:96 transport-cc
a=rtcp-fb:96 ccm fir
a=rtcp-fb:96 nack
a=rtcp-fb:96 nack pli
a=rtpmap:97 rtx/90000
a=fmtp:97 apt=96
m=audio 9 UDP/TLS/RTP/SAVPF 111
c=IN IP4 0.0.0.0
a=rtcp:9 IN IP4 0.0.0.0
a=ice-ufrag:mSzr
a=ice-pwd:qPYYNlkST5S/WkAbQXJ9+I1q
a=ice-options:trickle
a=fingerprint:sha-256 A0:2A:73:FD:C6:6E:0F:ED:DC:09:0E:F4:2F:67:FE:8F:03:AF:27:76:8F:41:F8:DB:77:D9:01:A0:CB:81:D6:7C
a=setup:active
a=mid:3
a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:1 urn:ietf:params:rtp-hdrext:sdes:mid
a=recvonly
a=rtcp-mux
a=rtpmap:111 opus/48000/2
a=rtcp-fb:111 transport-cc
a=fmtp:111 minptime=10;useinbandfec=1