pion / webrtc

Pure Go implementation of the WebRTC API
https://pion.ly
MIT License
13.66k stars 1.65k forks source link

WHIP WHEP example is broken #2922

Closed tyohan closed 1 week ago

tyohan commented 1 week ago

I'm building my a simple version SFU for one-to-many using WHIP and WHEP. I can't make it work to subscribe using WHEP following the Pion example. Turn out it might be an issue with the Pion WebRTC or other modules because I try the example it also throw the same exception.

I use the latest version of Pion WebRTC to run the whip-whep-example and there is an issue when trying to subscribe the video with WHEP endpoint. Tested on Mac, both Chrome beta version 130.0.6723.31 (Official Build) beta (arm64) and stable version. I use the example to publish and subscribe the video by following the example instructions:

  1. Run the whip-whep example server
  2. Open a browser and click the publish button, successfully connected
  3. Open another browser tab and click the subscribe button, the console will show error Uncaught (in promise) InvalidAccessError: Failed to execute 'setRemoteDescription' on 'RTCPeerConnection': Failed to set remote answer sdp: Failed to add remote stream ssrc: 4136156682 to {mid: 0, media_type: video}

Below is the SDP that throw the exception:

v=0
o=- 248417554686852298 1728278331 IN IP4 0.0.0.0
s=-
t=0 0
a=msid-semantic:WMS*
a=fingerprint:sha-256 93:15:12:9F:D0:69:FB:20:E4:C9:5D:B2:DD:7E:8C:DD:B7:C1:96:45:9C:2C:43:65:D6:0B:72:0B:8C:46:14:21
a=extmap-allow-mixed
a=group:BUNDLE 0
m=video 9 UDP/TLS/RTP/SAVPF 96 97 98 99 100 101 102 103 104 105 106 107 108 109 127 125 39 40 45 46 112 113
c=IN IP4 0.0.0.0
a=setup:active
a=mid:0
a=ice-ufrag:SbAebPJaKhZwHNmC
a=ice-pwd:jWxbOQBuYfVUEXAXAclybKUtNnEhcLns
a=rtcp-mux
a=rtcp-rsize
a=rtpmap:96 VP8/90000
a=rtcp-fb:96 goog-remb 
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=rtpmap:98 VP9/90000
a=fmtp:98 profile-id=0
a=rtcp-fb:98 goog-remb 
a=rtcp-fb:98 transport-cc 
a=rtcp-fb:98 ccm fir
a=rtcp-fb:98 nack 
a=rtcp-fb:98 nack pli
a=rtpmap:99 rtx/90000
a=fmtp:99 apt=98
a=rtpmap:100 VP9/90000
a=fmtp:100 profile-id=2
a=rtcp-fb:100 goog-remb 
a=rtcp-fb:100 transport-cc 
a=rtcp-fb:100 ccm fir
a=rtcp-fb:100 nack 
a=rtcp-fb:100 nack pli
a=rtpmap:101 rtx/90000
a=fmtp:101 apt=100
a=rtpmap:102 H264/90000
a=fmtp:102 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f
a=rtcp-fb:102 goog-remb 
a=rtcp-fb:102 transport-cc 
a=rtcp-fb:102 ccm fir
a=rtcp-fb:102 nack 
a=rtcp-fb:102 nack pli
a=rtpmap:103 rtx/90000
a=fmtp:103 apt=102
a=rtpmap:104 H264/90000
a=fmtp:104 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42001f
a=rtcp-fb:104 goog-remb 
a=rtcp-fb:104 transport-cc 
a=rtcp-fb:104 ccm fir
a=rtcp-fb:104 nack 
a=rtcp-fb:104 nack pli
a=rtpmap:105 rtx/90000
a=fmtp:105 apt=104
a=rtpmap:106 H264/90000
a=fmtp:106 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f
a=rtcp-fb:106 goog-remb 
a=rtcp-fb:106 transport-cc 
a=rtcp-fb:106 ccm fir
a=rtcp-fb:106 nack 
a=rtcp-fb:106 nack pli
a=rtpmap:107 rtx/90000
a=fmtp:107 apt=106
a=rtpmap:108 H264/90000
a=fmtp:108 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42e01f
a=rtcp-fb:108 goog-remb 
a=rtcp-fb:108 transport-cc 
a=rtcp-fb:108 ccm fir
a=rtcp-fb:108 nack 
a=rtcp-fb:108 nack pli
a=rtpmap:109 rtx/90000
a=fmtp:109 apt=108
a=rtpmap:127 H264/90000
a=fmtp:127 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=4d001f
a=rtcp-fb:127 goog-remb 
a=rtcp-fb:127 transport-cc 
a=rtcp-fb:127 ccm fir
a=rtcp-fb:127 nack 
a=rtcp-fb:127 nack pli
a=rtpmap:125 rtx/90000
a=fmtp:125 apt=127
a=rtpmap:39 H264/90000
a=fmtp:39 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=4d001f
a=rtcp-fb:39 goog-remb 
a=rtcp-fb:39 transport-cc 
a=rtcp-fb:39 ccm fir
a=rtcp-fb:39 nack 
a=rtcp-fb:39 nack pli
a=rtpmap:40 rtx/90000
a=fmtp:40 apt=39
a=rtpmap:45 AV1/90000
a=fmtp:45 level-idx=5;profile=0;tier=0
a=rtcp-fb:45 goog-remb 
a=rtcp-fb:45 transport-cc 
a=rtcp-fb:45 ccm fir
a=rtcp-fb:45 nack 
a=rtcp-fb:45 nack pli
a=rtpmap:46 rtx/90000
a=fmtp:46 apt=45
a=rtpmap:112 H264/90000
a=fmtp:112 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=64001f
a=rtcp-fb:112 goog-remb 
a=rtcp-fb:112 transport-cc 
a=rtcp-fb:112 ccm fir
a=rtcp-fb:112 nack 
a=rtcp-fb:112 nack pli
a=rtpmap:113 rtx/90000
a=fmtp:113 apt=112
a=extmap:4 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:9 urn:ietf:params:rtp-hdrext:sdes:mid
a=extmap:10 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id
a=extmap:11 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id
a=ssrc-group:FID 563236888 3297005252
a=ssrc:563236888 cname:pion
a=ssrc:563236888 msid:pion video
a=ssrc:563236888 mslabel:pion
a=ssrc:563236888 label:video
a=msid:pion video
a=sendonly
a=candidate:2761992278 1 udp 2130706431 x.x.x.x 53156 typ host
a=candidate:2761992278 2 udp 2130706431 x.x.x.x 53156 typ host
a=candidate:1835900232 1 udp 1694498815 x.x.x.x 56233 typ srflx raddr 0.0.0.0 rport 56233
a=candidate:1835900232 2 udp 1694498815 x.x.x.x 56233 typ srflx raddr 0.0.0.0 rport 56233
a=end-of-candidates

Any idea what can be possibly the problem here?

boks1971 commented 1 week ago

Possibly two issues here?

  1. There was a recent PR to add RTX on send side. Can see the SDP change here.

    a=ssrc-group:FID 563236888 3297005252
    a=ssrc:563236888 cname:pion
    a=ssrc:563236888 msid:pion video
    a=ssrc:563236888 mslabel:pion
    a=ssrc:563236888 label:video
    a=msid:pion video

    But, the above is missing a=ssrc: lines for the RTX SSRC.

  2. Looks like the actual stream is using a completely different SSRC from what is sent in SDP.