Skip to content

Commit efc5153

Browse files
committed
Clear RTP Header Extensions before forwarding
FireFox/Chrome use different extension IDs. Users should decide which extensions they support and then write the correct values before passing them through Resolves pion/webrtc#2888
1 parent ab55840 commit efc5153

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

sfu-ws/main.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919

2020
"github.com/gorilla/websocket"
2121
"github.com/pion/rtcp"
22+
"github.com/pion/rtp"
2223
"github.com/pion/webrtc/v3"
2324
)
2425

@@ -301,13 +302,23 @@ func websocketHandler(w http.ResponseWriter, r *http.Request) {
301302
defer removeTrack(trackLocal)
302303

303304
buf := make([]byte, 1500)
305+
rtpPkt := &rtp.Packet{}
306+
304307
for {
305308
i, _, err := t.Read(buf)
306309
if err != nil {
307310
return
308311
}
309312

310-
if _, err = trackLocal.Write(buf[:i]); err != nil {
313+
if err = rtpPkt.Unmarshal(buf[:i]); err != nil {
314+
log.Println(err)
315+
return
316+
}
317+
318+
rtpPkt.Extension = false
319+
rtpPkt.Extensions = nil
320+
321+
if err = trackLocal.WriteRTP(rtpPkt); err != nil {
311322
return
312323
}
313324
}

0 commit comments

Comments
 (0)