直播:PLI 关键帧请求、观众 RTCP 读取、断线自动重连

Made-with: Cursor
This commit is contained in:
whm
2026-03-25 16:30:48 +08:00
parent d83a69c23a
commit 70e6782713
3 changed files with 55 additions and 17 deletions

View File

@@ -168,9 +168,19 @@ func (h *Hub) attachForwardersToViewerPC(v *viewerSession) {
if err != nil {
continue
}
if _, err := v.pc.AddTrack(lt); err != nil {
rtpSender, err := v.pc.AddTrack(lt)
if err != nil {
continue
}
// Drain RTCP feedback to keep interceptors/senders healthy.
go func() {
rtcpBuf := make([]byte, 1500)
for {
if _, _, e := rtpSender.Read(rtcpBuf); e != nil {
return
}
}
}()
tf.addViewer(v.id, lt)
}
}