fix: fix bug where the srv side ignored WebRTC renegotiation

This commit is contained in:
zarazaex69
2026-05-03 02:04:41 +03:00
parent 1114a394fa
commit 6183233eeb

View File

@@ -527,8 +527,8 @@ func (p *Peer) handleSignaling(ctx context.Context) {
return
}
if offer, ok := msg["subscriberSdpOffer"].(map[string]interface{}); ok && !pubSent {
if err := p.handleSdpOffer(offer, uid); err != nil {
if offer, ok := msg["subscriberSdpOffer"].(map[string]interface{}); ok {
if err := p.handleSdpOffer(offer, uid, !pubSent); err != nil {
logger.Debugf("sdp offer error: %v", err)
continue
}
@@ -586,7 +586,7 @@ func (p *Peer) handleCommonMessages(msg map[string]interface{}, uid string) {
}
}
func (p *Peer) handleSdpOffer(offer map[string]interface{}, uid string) error {
func (p *Peer) handleSdpOffer(offer map[string]interface{}, uid string, sendPub bool) error {
sdp, _ := offer["sdp"].(string)
pcSeq, _ := offer["pcSeq"].(float64)
@@ -624,6 +624,10 @@ func (p *Peer) handleSdpOffer(offer map[string]interface{}, uid string) error {
}
}
if !sendPub {
return nil
}
time.Sleep(300 * time.Millisecond)
pubOffer, err := p.pcPub.CreateOffer(nil)